예제 #1
0
        private async void ImageGestureRecognizer_ManipulationUpdated(GestureRecognizer sender, ManipulationUpdatedEventArgs args)
        {
            if (manipulating || Lumix == null)
            {
                return;
            }

            manipulating = true;

            try
            {
                if (Math.Abs(args.Delta.Expansion) < 0.001 && Math.Abs(args.Delta.Translation.X) + Math.Abs(args.Delta.Translation.Y) < 0.001)
                {
                    return;
                }

                var now = DateTime.UtcNow;
                if (now - lastSkipable < skipableInterval)
                {
                    return;
                }

                lastSkipable = now;

                var pinchStage = manipulationJustStarted ? PinchStage.Start : PinchStage.Continue;
                if (Math.Abs(args.Delta.Expansion) < 0.001)
                {
                    await MoveFocusPoint(args.Position.X, args.Position.Y, pinchStage);

                    manipulationJustStarted = false;
                }
                else
                {
                    var floatPoint = ToFloatPoint(args.Position.X, args.Position.Y);
                    if (args.PointerDeviceType == PointerDeviceType.Mouse)
                    {
                        await PinchZoom(PinchStage.Start, floatPoint, 0);

                        var zoomed = args.Cumulative.Expansion * 3;
                        await Task.Delay(50);
                        await PinchZoom(PinchStage.Continue, floatPoint, 0.5f *zoomed);

                        await Task.Delay(50);
                        await PinchZoom(PinchStage.Stop, floatPoint, 1 *zoomed);
                    }
                    else
                    {
                        await PinchZoom(pinchStage, floatPoint, args.Cumulative.Expansion);
                    }

                    manipulationJustStarted = false;
                }
            }
            finally
            {
                manipulating = false;
            }
        }
 ManipulationVelocities IManipulationUpdatedEventArgsResolver.Velocities(ManipulationUpdatedEventArgs e) => e.Velocities;
 protected void GestureRecognizer_ManipulationUpdated(ManipulationUpdatedEventArgs args)
 {
     InputManager.Instance.RaiseManipulationUpdated(this, args.source.id, args.cumulativeDelta);
 }
 PointerDeviceType IManipulationUpdatedEventArgsResolver.PointerDeviceType(ManipulationUpdatedEventArgs e) => e.PointerDeviceType;
 ManipulationDelta IManipulationUpdatedEventArgsResolver.Delta(ManipulationUpdatedEventArgs e) => e.Delta;
 /// <summary>
 /// Gets values that indicate the changes in the transformation deltas (translation, rotation, scale)
 /// of a manipulation since the last manipulation event.
 /// </summary>
 /// <param name="e">The requested <see cref="ManipulationUpdatedEventArgs"/>.</param>
 /// <returns>The changes in transformation values since the last event.</returns>
 public static ManipulationDelta Delta(this ManipulationUpdatedEventArgs e) => Resolver.Delta(e);
 /// <summary>
 /// Gets values that indicate the velocities of the transformation deltas (translation, rotation, scale)
 /// for a manipulation at the <see cref="GestureRecognizer.ManipulationUpdated"/> event.
 /// </summary>
 /// <param name="e">The requested <see cref="ManipulationUpdatedEventArgs"/>.</param>
 /// <returns>The velocities of the accumulated transformations since a ManipulationStarted event.</returns>
 public static ManipulationVelocities Velocities(this ManipulationUpdatedEventArgs e) => Resolver.Velocities(e);
예제 #8
0
 private void GestureManipulationUpdated(ManipulationUpdatedEventArgs args)
 { SendAxesGesture("manipulation", args.cumulativeDelta); }
예제 #9
0
 protected void OnManipulationUpdatedEvent(ManipulationUpdatedEventArgs obj)
 {
     inputManager.RaiseManipulationUpdated(this, (uint)obj.source.id, obj.cumulativeDelta);
 }
예제 #10
0
        private void _gestureRecognizer_ManipulationUpdated(GestureRecognizer sender, ManipulationUpdatedEventArgs args)
        {
            Debug.WriteLine("UpdateManipulation=" + args.Cumulative.Scale + "Delta=" + args.Delta.Scale);

            if (args.Delta.Scale > 1)
            {
                var zoomIn = zoomInChange != 1 ? zoomInChange : args.Delta.Scale;
                if (!Zoom(zoomIn, false))
                {
                    zoomInChange *= args.Delta.Scale;
                }
                else
                {
                    zoomInChange = 1;
                }
            }
            else if (args.Delta.Scale < 1)
            {
                var zoomOut = zoomOutChange != 1 ? zoomOutChange : args.Delta.Scale;
                if (!Zoom(zoomOut, false))
                {
                    zoomOutChange *= args.Delta.Scale;
                }
                else
                {
                    zoomOutChange = 1;
                }
            }
        }
예제 #11
0
 public virtual void OnManipulationUpdated(GestureRecognizer sender, ManipulationUpdatedEventArgs args)
 {
 }
        internal ManipulationDeltaRoutedEventArgs(UIElement container, GestureRecognizer recognizer, ManipulationUpdatedEventArgs args)
            : base(container)
        {
            Container = container;

            _recognizer = recognizer;

            PointerDeviceType = args.PointerDeviceType;
            Position          = args.Position;
            Delta             = args.Delta;
            Cumulative        = args.Cumulative;
            IsInertial        = args.IsInertial;
        }
예제 #13
0
        /// <summary>
        /// The gesture recognizers manipulation updated event handler
        /// </summary>
        /// <param name="sender">the sender object</param>
        /// <param name="args">Manipulation started event args</param>
        private void m_gestureRecognizer_ManipulationUpdated(GestureRecognizer sender, ManipulationUpdatedEventArgs args)
        {
            //Calculate a scale matrix
            Matrix scaleMatrix = Scale(args.Cumulative.Scale);
            //Calculate a rotation matrix
            Matrix rotationMatrix = Rotation(args.Cumulative.Rotation);
            //Calculate a translation matrix
            Matrix translationMatrix = Translation(args.Cumulative.Translation.X, args.Cumulative.Translation.Y);

            //Calculate an updated transformation matrix
            Matrix mat = MatMull(MatMull(MatMull(MatMull(m_originToTranslation, scaleMatrix), translationMatrix), rotationMatrix), m_originFromTranslation);

            //Combine the new and old transformations and use them for the images render transformation
            (m_image.RenderTransform as MatrixTransform).Matrix = MatMull(mat, m_inMatrix);
        }
예제 #14
0
 public void OnManipulationUpdated(GestureRecognizer sender, ManipulationUpdatedEventArgs args)
 {
     camera.OnManipulationUpdated(sender, args);
 }
 /// <summary>
 /// Gets the device type of the input source.
 /// </summary>
 /// <param name="e">The requested <see cref="ManipulationUpdatedEventArgs"/>.</param>
 /// <returns>The device type.</returns>
 public static PointerDeviceType PointerDeviceType(this ManipulationUpdatedEventArgs e) => Resolver.PointerDeviceType(e);
예제 #16
0
 private void manipUpdated(ManipulationUpdatedEventArgs obj)
 {
 }
 /// <summary>
 /// Gets the location of the pointer associated with the manipulation for the last manipulation event.
 /// </summary>
 /// <param name="e">The requested <see cref="ManipulationUpdatedEventArgs"/>.</param>
 /// <returns>The screen coordinates, in device-independent pixel (DIP).</returns>
 public static Point Position(this ManipulationUpdatedEventArgs e) => Resolver.Position(e);
예제 #18
0
 void CaliMan.ManUpdate(ManipulationUpdatedEventArgs args)
 {
 }
 /// <summary>
 /// Gets values that indicate the accumulated transformation deltas (translation, rotation, scale)
 /// for a manipulation from the beginning of the interaction to the <see cref="GestureRecognizer.ManipulationUpdated"/> event.
 /// </summary>
 /// <param name="e">The requested <see cref="ManipulationUpdatedEventArgs"/>.</param>
 /// <returns>The accumulated transformation values up to the ManipulationUpdated event.</returns>
 public static ManipulationDelta Cumulative(this ManipulationUpdatedEventArgs e) => Resolver.Cumulative(e);
예제 #20
0
 void InterMan.ManUpdate(ManipulationUpdatedEventArgs args)
 {
 }
 /// <summary>
 /// Gets the current number of contact points for the ongoing <see cref="GestureRecognizer.ManipulationUpdated"/> event.
 /// </summary>
 /// <param name="e">The requested <see cref="ManipulationUpdatedEventArgs"/>.</param>
 /// <returns>The number of contact points.</returns>
 public static uint CurrentContactCount(this ManipulationUpdatedEventArgs e) => Resolver.CurrentContactCount(e);
예제 #22
0
 void AdjMan.ManUpdate(ManipulationUpdatedEventArgs args)
 {
 }
 Point IManipulationUpdatedEventArgsResolver.Position(ManipulationUpdatedEventArgs e) => e.Position;
 private void _gestureRecognizer_ManipulationUpdated(GestureRecognizer sender, ManipulationUpdatedEventArgs args)
 {
     if (Math.Abs(args.Cumulative.Translation.X) < this.ActualWidth)
     {
         _tracker.TryUpdatePosition(new Vector3((float)(_startX - args.Cumulative.Translation.X), 0f, 0f));
     }
 }
 ManipulationDelta IManipulationUpdatedEventArgsResolver.Cumulative(ManipulationUpdatedEventArgs e) => e.Cumulative;
예제 #26
0
 private void OnManipulationUpdated(ManipulationUpdatedEventArgs obj)
 {
     //throw new NotImplementedException();
 }
 uint IManipulationUpdatedEventArgsResolver.CurrentContactCount(ManipulationUpdatedEventArgs e) => e.CurrentContactCount;
예제 #28
0
        private async void ImageGestureRecognizer_ManipulationUpdated(GestureRecognizer sender, ManipulationUpdatedEventArgs args)
        {
            if (Lumix != null)
            {
                lastExpansion += args.Delta.Expansion;

                var now = DateTime.UtcNow;
                if (now - lastSkipable < skipableInterval)
                {
                    return;
                }

                lastSkipable = now;

                if (Math.Abs(lastExpansion) > 32)
                {
                    var sig = Math.Sign(lastExpansion);
                    lastExpansion = 0;
                    await Lumix.ResizeFocusPoint(sig);
                }

                if (Math.Abs(args.Delta.Expansion) < 0.001)
                {
                    await MoveFocusPoint(args.Position.X, args.Position.Y);
                }
            }
        }
예제 #29
0
 private void _ManipulationUpdate(object sender, ManipulationUpdatedEventArgs e)
 {
     TargetTracker.Position = e.Cumulative.Translation;
 }
예제 #30
0
 void gestureRecognizer_ManipulationUpdated(GestureRecognizer sender, ManipulationUpdatedEventArgs args)
 {
     offset         = offset - (float)args.Delta.Translation.Y;
     targetVelocity = -Math.Sign(args.Velocities.Linear.Y) * targetSpeed;
 }