示例#1
0
 /// <summary>
 /// Raises the <see cref="MouseUp" /> event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
 protected virtual void OnTouchCompleted(object sender, OxyTouchEventArgs e)
 {
     var handler = this.TouchCompleted;
     if (handler != null)
     {
         handler(sender, e);
     }
 }
示例#2
0
 /// <summary>
 /// Adds the specified mouse hover manipulator and invokes the <see cref="TouchManipulator.Started" /> method with the specified mouse event arguments.
 /// </summary>
 /// <param name="view">The plot view.</param>
 /// <param name="manipulator">The manipulator.</param>
 /// <param name="args">The <see cref="OxyTouchEventArgs" /> instance containing the event data.</param>
 public virtual void AddTouchManipulator(
     IView view,
     ManipulatorBase <OxyTouchEventArgs> manipulator,
     OxyTouchEventArgs args)
 {
     this.TouchManipulators.Add(manipulator);
     manipulator.Started(args);
 }
示例#3
0
        /// <summary>
        /// Raises the <see cref="MouseUp" /> event.
        /// </summary>
        /// <param name="e">The <see cref="OxyTouchEventArgs" /> instance containing the event data.</param>
        protected internal virtual void OnTouchCompleted(OxyTouchEventArgs e)
        {
            var handler = this.TouchCompleted;

            if (handler != null)
            {
                handler(this, e);
            }
        }
        /// <summary>
        /// Handles the touch delta event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">A <see cref="OxyPlot.OxyTouchEventArgs" /> instance containing the event data.</param>
        public virtual void HandleTouchDelta(object sender, OxyTouchEventArgs e)
        {
            if (this.currentTouchEventElement != null)
            {
                this.currentTouchEventElement.OnTouchDelta(e);
            }

            if (!e.Handled)
            {
                this.OnTouchDelta(sender, e);
            }
        }
        /// <summary>
        /// Handles the touch completed event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">A <see cref="OxyPlot.OxyTouchEventArgs" /> instance containing the event data.</param>
        public virtual void HandleTouchCompleted(object sender, OxyTouchEventArgs e)
        {
            if (this.currentTouchEventElement != null)
            {
                this.currentTouchEventElement.OnTouchCompleted(e);
                this.currentTouchEventElement = null;
            }

            if (!e.Handled)
            {
                this.OnTouchCompleted(sender, e);
            }
        }
示例#6
0
        /// <summary>
        /// Handles touch started events.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyTouchEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public virtual bool HandleTouchStarted(IView view, OxyTouchEventArgs args)
        {
            lock (this.GetSyncRoot(view))
            {
                if (view.ActualModel != null)
                {
                    view.ActualModel.HandleTouchStarted(this, args);
                    if (args.Handled)
                    {
                        return(true);
                    }
                }

                var command = this.GetCommand(new OxyTouchGesture());
                return(this.HandleCommand(command, view, args));
            }
        }
示例#7
0
        /// <summary>
        /// Handles the touch started event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">A <see cref="OxyPlot.OxyTouchEventArgs" /> instance containing the event data.</param>
        public virtual void HandleTouchStarted(object sender, OxyTouchEventArgs e)
        {
            var args = new HitTestArguments(e.Position, MouseHitTolerance);
            foreach (var result in this.HitTest(args))
            {
                result.Element.OnTouchStarted(e);
                if (e.Handled)
                {
                    this.currentTouchEventElement = result.Element;
                    return;
                }
            }

            if (!e.Handled)
            {
                this.OnTouchStarted(sender, e);
            }
        }
示例#8
0
        /// <summary>
        /// Handles touch delta events.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyTouchEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public virtual bool HandleTouchDelta(IView view, OxyTouchEventArgs args)
        {
            lock (this.GetSyncRoot(view))
            {
                if (view.ActualModel != null)
                {
                    view.ActualModel.HandleTouchDelta(this, args);
                    if (args.Handled)
                    {
                        return(true);
                    }
                }

                foreach (var m in this.TouchManipulators)
                {
                    m.Delta(args);
                }

                return(args.Handled);
            }
        }
示例#9
0
        /// <summary>
        /// Handles touch completed events.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyTouchEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public virtual bool HandleTouchCompleted(IView view, OxyTouchEventArgs args)
        {
            lock (this.GetSyncRoot(view))
            {
                if (view.ActualModel != null)
                {
                    view.ActualModel.HandleTouchCompleted(this, args);
                    if (args.Handled)
                    {
                        return(true);
                    }
                }

                foreach (var m in this.TouchManipulators.ToArray())
                {
                    m.Completed(args);
                    this.TouchManipulators.Remove(m);
                }

                return(args.Handled);
            }
        }
示例#10
0
        /// <summary>
        /// Handles touch started events.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyTouchEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public bool HandleTouchStarted(IView view, OxyTouchEventArgs args)
        {
            lock (this.GetSyncRoot(view))
            {
                if (view.ActualModel != null)
                {
                    view.ActualModel.HandleTouchStarted(this, args);
                    if (args.Handled)
                    {
                        return true;
                    }
                }

                var command = this.GetCommand(new OxyTouchGesture());
                return this.HandleCommand(command, view, args);
            }
        }
示例#11
0
        /// <summary>
        /// Handles touch delta events.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyTouchEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public bool HandleTouchDelta(IView view, OxyTouchEventArgs args)
        {
            lock (this.GetSyncRoot(view))
            {
                if (view.ActualModel != null)
                {
                    view.ActualModel.HandleTouchDelta(this, args);
                    if (args.Handled)
                    {
                        return true;
                    }
                }

                foreach (var m in this.TouchManipulators)
                {
                    m.Delta(args);
                }

                return args.Handled;
            }
        }
示例#12
0
        /// <summary>
        /// Handles touch completed events.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyTouchEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public bool HandleTouchCompleted(IView view, OxyTouchEventArgs args)
        {
            lock (this.GetSyncRoot(view))
            {
                if (view.ActualModel != null)
                {
                    view.ActualModel.HandleTouchCompleted(this, args);
                    if (args.Handled)
                    {
                        return true;
                    }
                }

                foreach (var m in this.TouchManipulators.ToArray())
                {
                    m.Completed(args);
                    this.TouchManipulators.Remove(m);
                }

                return args.Handled;
            }
        }
示例#13
0
 /// <summary>
 /// Adds the specified mouse hover manipulator and invokes the <see cref="TouchManipulator.Started" /> method with the specified mouse event arguments.
 /// </summary>
 /// <param name="view">The plot view.</param>
 /// <param name="manipulator">The manipulator.</param>
 /// <param name="args">The <see cref="OxyTouchEventArgs" /> instance containing the event data.</param>
 public virtual void AddTouchManipulator(
     IView view,
     ManipulatorBase<OxyTouchEventArgs> manipulator,
     OxyTouchEventArgs args)
 {
     this.TouchManipulators.Add(manipulator);
     manipulator.Started(args);
 }
示例#14
0
 /// <summary>
 /// Raises the <see cref="MouseUp" /> event.
 /// </summary>
 /// <param name="e">The <see cref="OxyTouchEventArgs" /> instance containing the event data.</param>
 protected internal virtual void OnTouchCompleted(OxyTouchEventArgs e)
 {
     var handler = this.TouchCompleted;
     if (handler != null)
     {
         handler(this, e);
     }
 }
示例#15
0
        /// <summary>
        /// Called when a touch gesture is moving.
        /// </summary>
        /// <param name="touches">The touches.</param>
        /// <param name="evt">The event arguments.</param>
        public override void TouchesMoved(NSSet touches, UIEvent evt)
        {
            // it seems to be easier to handle touch events here than using UIPanGesturRecognizer and UIPinchGestureRecognizer
            base.TouchesMoved(touches, evt);

            // convert the touch points to an array
            var ta = touches.ToArray<UITouch>();

            if (ta.Length > 0)
            {
                // get current and previous location of the first touch point
                var t1 = ta[0];
                var l1 = t1.LocationInView(this).ToScreenPoint();
                var pl1 = t1.PreviousLocationInView(this).ToScreenPoint();
                var l = l1;
                var t = l1 - pl1;
                var s = new ScreenVector(1, 1);
                if (ta.Length > 1)
                {
                    // get current and previous location of the second touch point
                    var t2 = ta[1];
                    var l2 = t2.LocationInView(this).ToScreenPoint();
                    var pl2 = t2.PreviousLocationInView(this).ToScreenPoint();
                    var d = l1 - l2;
                    var pd = pl1 - pl2;
                    if (!this.KeepAspectRatioWhenPinching)
                    {
                        var scalex = System.Math.Abs(pd.X) > 0 ? System.Math.Abs(d.X / pd.X) : 1;
                        var scaley = System.Math.Abs(pd.Y) > 0 ? System.Math.Abs(d.Y / pd.Y) : 1;
                        s = new ScreenVector(scalex, scaley);
                    }
                    else
                    {
                        var scale = pd.Length > 0 ? d.Length / pd.Length : 1;
                        s = new ScreenVector(scale, scale);
                    }
                }

                var e = new OxyTouchEventArgs { Position = l, DeltaTranslation = t, DeltaScale = s };
                this.ActualController.HandleTouchDelta(this, e);
            }
        }
示例#16
0
 /// <summary>
 /// Handles touch move events.
 /// </summary>
 /// <param name="e">The motion event arguments.</param>
 /// <returns><c>true</c> if the event was handled.</returns>
 private bool OnTouchMoveEvent(MotionEvent e)
 {
     var currentTouchPoints = e.GetTouchPoints(Scale);
     var args = new OxyTouchEventArgs(currentTouchPoints, this.previousTouchPoints);
     var handled = this.ActualController.HandleTouchDelta(this, args);
     this.previousTouchPoints = currentTouchPoints;
     return handled;
 }
示例#17
0
        /// <summary>
        /// Handles the touch started event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">A <see cref="OxyPlot.OxyTouchEventArgs" /> instance containing the event data.</param>
        public virtual void HandleTouchStarted(object sender, OxyTouchEventArgs e)
        {
            var args = new HitTestArguments(e.Position, MouseHitTolerance);
            foreach (var result in this.HitTest(args))
            {
                result.Element.OnTouchStarted(e);
                if (e.Handled)
                {
                    this.currentTouchEventElement = result.Element;
                    return;
                }
            }

            if (!e.Handled)
            {
                this.OnTouchStarted(sender, e);
            }
        }
示例#18
0
        /// <summary>
        /// Handles the touch delta event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">A <see cref="OxyPlot.OxyTouchEventArgs" /> instance containing the event data.</param>
        public virtual void HandleTouchDelta(object sender, OxyTouchEventArgs e)
        {
            if (this.currentTouchEventElement != null)
            {
                this.currentTouchEventElement.OnTouchDelta(e);
            }

            if (!e.Handled)
            {
                this.OnTouchDelta(sender, e);
            }
        }
示例#19
0
        /// <summary>
        /// Handles the touch completed event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">A <see cref="OxyPlot.OxyTouchEventArgs" /> instance containing the event data.</param>
        public virtual void HandleTouchCompleted(object sender, OxyTouchEventArgs e)
        {
            if (this.currentTouchEventElement != null)
            {
                this.currentTouchEventElement.OnTouchCompleted(e);
                this.currentTouchEventElement = null;
            }

            if (!e.Handled)
            {
                this.OnTouchCompleted(sender, e);
            }
        }
示例#20
0
 /// <summary>
 /// Raises the <see cref="MouseUp" /> event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
 protected virtual void OnTouchCompleted(object sender, OxyTouchEventArgs e)
 {
     var handler = this.TouchCompleted;
     if (handler != null)
     {
         handler(sender, e);
     }
 }