示例#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;
 }
示例#2
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}");
            }
        }
示例#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
        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;
            }
        }
示例#5
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)));
        }
示例#6
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);
        }
示例#7
0
 public Point GetPosition(IVisual relativeTo) => _ev.GetPosition(relativeTo);
示例#8
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;
                        }
                    }
                }
            }
        }
 public Point GetPosition(IVisual?relativeTo) => lastPointerEventArgs.GetPosition(relativeTo);
 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
		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);
		}
示例#12
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);
            }
        }