private void Control__PointerMoved(object sender, Avalonia.Input.PointerEventArgs e) { X = e.GetPosition(control_).X; Y = e.GetPosition(control_).Y; ellipse.Height = X; ellipse.Width = Y; }
protected override void OnPointerMoved(PointerEventArgs e) { base.OnPointerMoved(e); if(IsPointerOver && _mouseDown) { BeginMoveDrag(); } }
protected override void OnPointerMoved(PointerEventArgs e) { if (_lastPoint.HasValue) { var ev = new VectorEventArgs { RoutedEvent = DragDeltaEvent, Vector = e.GetPosition(this) - _lastPoint.Value, }; RaiseEvent(ev); } }
/// <summary> /// Captura os eventos do Ponteiro ao se mover sobre a mola /// </summary> private void OnPointerMoved(object sender, Avalonia.Input.PointerEventArgs e) { if (isPressed) { var p = e.GetPosition(sender as IVisual); p = new Point(p.X, p.Y); ViewModel.X = p.X + origin.X; //ViewModel.Y = p.Y + origin.Y; System.Diagnostics.Debug.WriteLine($"{ViewModel.X}; {ViewModel.Y}"); } }
private void _editor_PointerMoved(object sender, Avalonia.Input.PointerEventArgs e) { if (_popup.IsOpen) { var distance = e.GetPosition(_editor).DistanceTo(_lastPoint); if (distance > 25 && !_popup.PopupRoot.IsPointerOver) { _popup.Close(); } } else { var newPoint = e.GetPosition(_editor); if (newPoint != _lastPoint) { _timer.Stop(); _timer.Start(); } _lastPoint = newPoint; } }
private void ClearPointerOver(IPointerDevice device, IInputRoot root) { foreach (var control in _pointerOvers.ToList()) { PointerEventArgs e = new PointerEventArgs { RoutedEvent = InputElement.PointerLeaveEvent, Device = device, Source = control, }; _pointerOvers.Remove(control); control.RaiseEvent(e); } root.PointerOverElement = null; }
protected override void OnPointerReleased(PointerEventArgs e) { if (_lastPoint.HasValue) { e.Device.Capture(null); _lastPoint = null; var ev = new VectorEventArgs { RoutedEvent = DragCompletedEvent, Vector = (Vector)e.GetPosition(this), }; RaiseEvent(ev); } }
private bool MouseMove(IMouseDevice device, IInputRoot root, Point p, InputModifiers inputModifiers) { IInputElement source; if (Captured == null) { source = SetPointerOver(this, root, p); } else { var elements = Captured.GetSelfAndVisualAncestors().OfType<IInputElement>().ToList(); SetPointerOver(this, root, elements); source = Captured; } var e = new PointerEventArgs { Device = this, RoutedEvent = InputElement.PointerMovedEvent, Source = source, InputModifiers = inputModifiers }; source.RaiseEvent(e); return e.Handled; }
/// <summary> /// Called before the <see cref="PointerReleased"/> event occurs. /// </summary> /// <param name="e">The event args.</param> protected virtual void OnPointerReleased(PointerEventArgs e) { }
private void Border_PointerMoved(object sender, PointerEventArgs e) { if (_element != null && e.Device.Captured == _element) { Point point = e.GetPosition(_element); point = FixInvalidPointPosition(point); PanTo(point); } }
/// <summary> /// Called before the <see cref="PointerLeave"/> event occurs. /// </summary> /// <param name="e">The event args.</param> protected virtual void OnPointerLeave(PointerEventArgs e) { IsPointerOver = false; }
/// <summary> /// Called before the <see cref="PointerMoved"/> event occurs. /// </summary> /// <param name="e">The event args.</param> protected virtual void OnPointerMoved(PointerEventArgs e) { }
/// <summary> /// Captura os eventos do Ponteiro ao deixar a região da Mola /// </summary> public void OnPointerEnter(object sender, Avalonia.Input.PointerEventArgs e) { }
/// <summary> /// Called before the <see cref="PointerEnter"/> event occurs. /// </summary> /// <param name="e">The event args.</param> protected virtual void OnPointerEnter(PointerEventArgs e) { IsPointerOver = true; }
private IInputElement SetPointerOver(IPointerDevice device, IInputRoot root, IList<IInputElement> elements) { foreach (var control in _pointerOvers.Except(elements).ToList()) { PointerEventArgs e = new PointerEventArgs { RoutedEvent = InputElement.PointerLeaveEvent, Device = device, Source = control, }; _pointerOvers.Remove(control); control.RaiseEvent(e); } foreach (var control in elements.Except(_pointerOvers)) { PointerEventArgs e = new PointerEventArgs { RoutedEvent = InputElement.PointerEnterEvent, Device = device, Source = control, }; _pointerOvers.Add(control); control.RaiseEvent(e); } root.PointerOverElement = elements.FirstOrDefault() ?? root; return root.PointerOverElement; }
/// <inheritdoc/> protected override void OnPointerReleased(PointerEventArgs e) { base.OnPointerReleased(e); e.Device.Capture(null); PseudoClasses.Remove(":pressed"); e.Handled = true; if (ClickMode == ClickMode.Release && Classes.Contains(":pointerover")) { RaiseClickEvent(); } }
protected override void OnPointerMoved(PointerEventArgs e) { if (titleBar.IsPointerOver && mouseDown) { if (mouseDownPosition.DistanceTo(e.GetPosition(this)) > 12) { WindowState = WindowState.Normal; BeginMoveDrag(); mouseDown = false; } } base.OnPointerMoved(e); }
/// <summary> /// Called when the pointer leaves the <see cref="MenuItem"/>. /// </summary> /// <param name="e">The event args.</param> protected override void OnPointerLeave(PointerEventArgs e) { base.OnPointerLeave(e); if (_submenuTimer != null) { _submenuTimer.Dispose(); _submenuTimer = null; } }
/// <summary> /// Called when the pointer enters the <see cref="MenuItem"/>. /// </summary> /// <param name="e">The event args.</param> protected override void OnPointerEnter(PointerEventArgs e) { base.OnPointerEnter(e); var menu = Parent as Menu; if (menu != null) { if (menu.IsOpen) { IsSubMenuOpen = true; } } else if (HasSubMenu && !IsSubMenuOpen) { _submenuTimer = DispatcherTimer.Run( () => IsSubMenuOpen = true, TimeSpan.FromMilliseconds(400)); } }
/// <summary> /// Called when the pointer leaves a control with an attached tooltip. /// </summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event args.</param> private static void ControlPointerLeave(object sender, PointerEventArgs e) { var control = (Control)sender; if (control == s_current) { if (s_popup != null && s_popup.IsVisible) { s_popup.Hide(); } s_show.OnNext(null); } }
public EmulatedDevice(PointerEventArgs ev) { _ev = ev; }
/// <summary> /// Handle mouse up to handle selection and link click. /// </summary> /// <param name="parent">the control hosting the html to invalidate</param> /// <param name="e">the mouse event args</param> public void HandleLeftMouseUp(Control parent, PointerEventArgs e) { ArgChecker.AssertArgNotNull(parent, "parent"); ArgChecker.AssertArgNotNull(e, "e"); var mouseEvent = new RMouseEvent(true); _htmlContainerInt.HandleMouseUp(new ControlAdapter(parent), Util.Convert(e.GetPosition(parent)), mouseEvent); }
/// <summary> /// Handle mouse double click to select word under the mouse. /// </summary> /// <param name="parent">the control hosting the html to set cursor and invalidate</param> /// <param name="e">mouse event args</param> public void HandleMouseDoubleClick(Control parent, PointerEventArgs e) { ArgChecker.AssertArgNotNull(parent, "parent"); ArgChecker.AssertArgNotNull(e, "e"); _htmlContainerInt.HandleMouseDoubleClick(new ControlAdapter(parent), Util.Convert(e.GetPosition(parent))); }
/// <summary> /// Called when the pointer enters a control with an attached tooltip. /// </summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event args.</param> private static void ControlPointerEnter(object sender, PointerEventArgs e) { s_current = (Control)sender; s_show.OnNext(s_current); }
protected override void OnPointerReleased(PointerEventArgs e) { _mouseDown = false; base.OnPointerReleased(e); }
/// <summary> /// Called when the pointer leaves a control with an attached tooltip. /// </summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event args.</param> private static void ControlPointerLeave(object sender, PointerEventArgs e) { var control = (Control)sender; if (control == s_current) { if (s_popup != null) { // Clear the ToolTip's Content in case it has control content: this will // reset its visual parent allowing it to be used again. ((ToolTip)s_popup.Content).Content = null; // Dispose of the popup. s_popup.Dispose(); s_popup = null; } s_show.OnNext(null); } }
private void BottomRightCorner_PointerMoved(object?sender, Avalonia.Input.PointerEventArgs e) { Resize?.Invoke(this, e); }
/// <summary> /// Handles pointer presses in the window. /// </summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event args.</param> protected virtual void OnPreviewPointerPressed(object sender, PointerEventArgs e) { if (_showingAccessKeys) { _owner.ShowAccessKeys = false; } }
protected override void OnPointerReleased(PointerEventArgs e) { if (e.Device.Captured == TextView) { e.Device.Capture(null); } }
protected override void OnPointerMoved(PointerEventArgs e) { if (TextView != null) // Need to check this incase control was virtualized? { var point = e.GetPosition(TextView.TextSurface); if (e.Device.Captured == TextView) { var currentMouseOffset = TextView.GetOffsetFromPoint(point); if (currentMouseOffset != -1) { CaretIndex = currentMouseOffset; if (CaretIndex >= 0) { SelectionEnd = CaretIndex; } else { SelectionEnd = 0; } } } } }
protected void RemoveAdorner(object sender, PointerEventArgs e) { if (_adorner != null) { ((Panel)_adorner.Parent).Children.Remove(_adorner); _adorner = null; } }
protected void AddAdorner(object sender, PointerEventArgs e) { var node = (TreeNode)((Control)sender).DataContext; var layer = AdornerLayer.GetAdornerLayer(node.Control); if (layer != null) { _adorner = new Rectangle { Fill = new SolidColorBrush(0x80a0c5e8), [AdornerLayer.AdornedElementProperty] = node.Control, }; layer.Children.Add(_adorner); } }