예제 #1
0
 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();                
            }
        }
예제 #3
0
        protected override void OnPointerMoved(PointerEventArgs e)
        {
            if (_lastPoint.HasValue)
            {
                var ev = new VectorEventArgs
                {
                    RoutedEvent = DragDeltaEvent,
                    Vector = e.GetPosition(this) - _lastPoint.Value,
                };

                RaiseEvent(ev);
            }
        }
예제 #4
0
        /// <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}");
            }
        }
예제 #5
0
        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;
            }
        }
예제 #6
0
        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;
        }
예제 #7
0
        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);
            }
        }
예제 #8
0
        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;
        }
예제 #9
0
 /// <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);
     }
 }
예제 #11
0
 /// <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;
 }
예제 #12
0
 /// <summary>
 /// Called before the <see cref="PointerMoved"/> event occurs.
 /// </summary>
 /// <param name="e">The event args.</param>
 protected virtual void OnPointerMoved(PointerEventArgs e)
 {
 }
예제 #13
0
 /// <summary>
 /// Captura os eventos do Ponteiro ao deixar a região da Mola
 /// </summary>
 public void OnPointerEnter(object sender, Avalonia.Input.PointerEventArgs e)
 {
 }
예제 #14
0
 /// <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;
 }
예제 #15
0
        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;
        }
예제 #16
0
        /// <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();
            }
        }
예제 #17
0
		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);
		}
예제 #18
0
        /// <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;
            }
        }
예제 #19
0
        /// <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));
            }
        }
예제 #20
0
        /// <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;
 }
예제 #22
0
        /// <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);
        }
예제 #23
0
        /// <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)));
        }
예제 #24
0
 /// <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);
 }
예제 #25
0
 protected override void OnPointerReleased(PointerEventArgs e)
 {
     _mouseDown = false;
     base.OnPointerReleased(e);
 }
예제 #26
0
        /// <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);
            }
        }
예제 #27
0
 private void BottomRightCorner_PointerMoved(object?sender, Avalonia.Input.PointerEventArgs e)
 {
     Resize?.Invoke(this, e);
 }
예제 #28
0
 /// <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;
     }
 }
예제 #29
0
 protected override void OnPointerReleased(PointerEventArgs e)
 {
     if (e.Device.Captured == TextView)
     {
         e.Device.Capture(null);
     }
 }
예제 #30
0
        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;
                        }
                    }
                }
            }
        }
예제 #31
-1
 protected void RemoveAdorner(object sender, PointerEventArgs e)
 {
     if (_adorner != null)
     {
         ((Panel)_adorner.Parent).Children.Remove(_adorner);
         _adorner = null;
     }
 }
예제 #32
-1
        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);
            }
        }