コード例 #1
0
        private void HandlePanZoomGesture()
        {
            switch (panZoomGesture.State)
            {
            case UIGestureRecognizerState.Began:
                ActualController.HandleTouchStarted(this, panZoomGesture.TouchEventArgs);
                break;

            case UIGestureRecognizerState.Changed:
                ActualController.HandleTouchDelta(this, panZoomGesture.TouchEventArgs);
                break;

            case UIGestureRecognizerState.Ended:
            case UIGestureRecognizerState.Cancelled:
                ActualController.HandleTouchCompleted(this, panZoomGesture.TouchEventArgs);
                break;
            }
        }
コード例 #2
0
        /// <summary>
        /// Invoked when an unhandled MouseMove attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.Windows.Input.MouseEventArgs" /> that contains the event data.</param>
        protected override void OnPointerMoved(PointerEventArgs e)
        {
            base.OnPointerMoved(e);
            if (e.Handled)
            {
                return;
            }

            if (e.Pointer.Type == PointerType.Touch)
            {
                var point          = e.GetPosition(this).ToScreenPoint();
                var oldTouchPoints = TouchPositions.Values.ToArray();
                TouchPositions[e.Pointer.Id] = point;
                var newTouchPoints = TouchPositions.Values.ToArray();

                var touchEventArgs = new OxyTouchEventArgs(newTouchPoints, oldTouchPoints);

                e.Handled = ActualController.HandleTouchDelta(this, touchEventArgs);
            }
            else
            {
                e.Handled = ActualController.HandleMouseMove(this, e.ToMouseEventArgs(this));
            }
        }