private IEnumerator <object> MainTask() { var p = new SeparatorsHitTestPresenter(); CompoundPostPresenter.Add(p); while (true) { bool isNeedToInvalidate = false; if (separartorRenderer.SeparatorUnderMouse != p.SeparatorUnderMouse) { separartorRenderer.SeparatorUnderMouse = p.SeparatorUnderMouse; isNeedToInvalidate = true; } if (IsMouseOver() && p.SeparatorUnderMouse >= 0) { WidgetContext.Current.MouseCursor = MouseCursor.SizeNS; if (Input.WasMousePressed()) { separartorRenderer.isSeparatorUnderMouseDrag = true; Window.Current.Invalidate(); yield return(DragSeparatorTask(p.SeparatorUnderMouse)); separartorRenderer.isSeparatorUnderMouseDrag = false; isNeedToInvalidate = true; } } if (isNeedToInvalidate) { Window.Current.Invalidate(); } yield return(null); } }
public ThemedCheckBox() { Layout = new StackLayout(); AddNode(new Button { Id = "Button", Presenter = new CheckBoxPresenter(this), LayoutCell = new LayoutCell(Alignment.Center), MinMaxSize = Theme.Metrics.CheckBoxSize, TabTravesable = null }); TabTravesable = new TabTraversable(); CompoundPostPresenter.Add(new Theme.MouseHoverBorderPresenter()); LateTasks.Add(Theme.MouseHoverInvalidationTask(this)); }
private IEnumerator <object> MainTask() { var p = new SeparatorsHitTestPresenter(); CompoundPostPresenter.Add(p); while (true) { if (IsMouseOver() && p.SeparatorUnderMouse >= 0) { WidgetContext.Current.MouseCursor = MouseCursor.SizeNS; if (Input.WasMousePressed()) { yield return(DragSeparatorTask(p.SeparatorUnderMouse)); } } yield return(null); } }
public RulersWidget() { LayoutCell = new LayoutCell(); Anchors = Anchors.LeftRightTopBottom; topRulerBar = new Widget { Anchors = Anchors.LeftRight, Id = "TopRuler", HitTestTarget = true, MinMaxHeight = RulerHeight, Height = RulerHeight, }; leftRulerBar = new Widget { Anchors = Anchors.Left | Anchors.Bottom | Anchors.Top, HitTestTarget = true, Id = "LeftRuler", MinMaxWidth = RulerHeight, Width = RulerHeight, }; topRulerBar.Tasks.Add(CreateLineTask(topRulerBar, RulerOrientation.Horizontal)); leftRulerBar.Tasks.Add(CreateLineTask(leftRulerBar, RulerOrientation.Vertical)); Nodes.Add(leftRulerBar); Nodes.Add(topRulerBar); topRulerBar.CompoundPostPresenter.Push(new RulerBarPresenter(RulerOrientation.Horizontal)); leftRulerBar.CompoundPostPresenter.Push(new RulerBarPresenter(RulerOrientation.Vertical)); CompoundPostPresenter.Push(new RulerLinesPresenter(leftRulerBar, topRulerBar)); this.AddChangeWatcher(LocalMousePosition, _ => { if (SceneView.Instance.Panel.IsMouseOverThisOrDescendant()) { Window.Current.Invalidate(); } }); this.AddChangeWatcher(() => ProjectUserPreferences.Instance.RulerVisible, v => { topRulerBar.Visible = v; leftRulerBar.Visible = v; }); }