protected virtual void InterpretInput(InputHelper inputHelper) { bool mouseHovering = false; bool mouseDown = false; bool mouseClicked = false; if (AbsoluteRectangle.Contains(inputHelper.MousePosition)) { mouseHovering = true; if (inputHelper.MouseLeftButtonDown()) { mouseDown = true; } if (inputHelper.MouseLeftButtonPressed()) { mouseClicked = true; InputUser = this; InvokeClickEvent(); } } MouseHovering = mouseHovering; MouseDown = mouseDown; MouseClicked = mouseClicked; }
public void DrawRectangle(AbsoluteRectangle rectangle, IBrush fill) { canvas.Save(); var paint = fill.ToSKPaint(); canvas.DrawRect(new SKRect(rectangle.X, rectangle.Y, rectangle.Right, rectangle.Bottom), paint); canvas.Restore(); }
public override void HandleInput(InputHelper inputHelper) { //Because the scrollbar is drawn first it needs to be the first object to have its input checked scrollBar.HandleInput(inputHelper); if (AbsoluteRectangle.Contains(inputHelper.MousePosition)) { ChildOffset = ChildOffset - inputHelper.ScrollDelta; } base.HandleInput(inputHelper); }
public void DrawMultilineText(AbsoluteRectangle box, Typeface typeface, string text, IBrush brush, float lineHeight = 1.2f) { var paint = typeface.ToSKPaint(brush); canvas.Save(); canvas.ClipRect(box.ToSKRect()); var lines = splitLines(text, paint, box.Width); for (var i = 0; i < lines.Length; i++) { DrawText(new AbsolutePoint(box.Location.X, box.Location.Y + (i + 1) * typeface.Size * lineHeight), typeface, lines[i].text, brush); } canvas.Restore(); }
public static SKRect ToSKRect(this AbsoluteRectangle rectangle) { return(new SKRect(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom)); }