コード例 #1
0
 void gestureRecognizer_ManipulationUpdated(Windows.UI.Input.GestureRecognizer sender, Windows.UI.Input.ManipulationUpdatedEventArgs args)
 {
     UpdateAngle((float)args.Delta.Translation.X, (float)args.Delta.Translation.Y);
 }
コード例 #2
0
 internal FilterManipulationEventArgs(Windows.UI.Input.ManipulationUpdatedEventArgs args)
 {
     Delta = args.Delta;
     Pivot = args.Position;
 }
コード例 #3
0
        private void OnManipulationUpdated(Windows.UI.Input.GestureRecognizer sender, Windows.UI.Input.ManipulationUpdatedEventArgs args)
        {
            _deltaTransform.TranslateX = args.Delta.Translation.X;
            _deltaTransform.TranslateY = args.Delta.Translation.Y;

            _target.SetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty, 0);
            _target.SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, 0);


            // Because of the way we process pointer events, all coordinates are expressed
            // in the coordinate system of the reference of the manipulation target.
            // args.Position stores the position of the pivot of this manipulation
            // args.Delta stores the deltas (Translation, Rotation in degrees, and Scale)

            var filteredArgs = new FilterManipulationEventArgs(args);

            OnFilterManipulation?.Invoke(this, filteredArgs);

            // Update the transform
            // filteredArgs.Pivot indicates the position of the pivot of this manipulation
            // filteredArgs.Delta indicates the deltas (Translation, Rotation in degrees, and Scale)
            _previousTransform.Matrix  = _transform.Value;
            _deltaTransform.CenterX    = filteredArgs.Pivot.X;
            _deltaTransform.CenterY    = filteredArgs.Pivot.Y;
            _deltaTransform.Rotation   = filteredArgs.Delta.Rotation;
            _deltaTransform.TranslateX = filteredArgs.Delta.Translation.X;
            _deltaTransform.TranslateY = filteredArgs.Delta.Translation.Y;

            if (ZoomBehavior == Controls.ZoomType.Resize)
            {
                _target.Height = _target.ActualHeight * filteredArgs.Delta.Scale;
                _target.Width  = _target.ActualWidth * filteredArgs.Delta.Scale;
            }
            else if (ZoomBehavior == Controls.ZoomType.Scale)
            {
                _deltaTransform.ScaleX = _deltaTransform.ScaleY = filteredArgs.Delta.Scale;
            }
        }
コード例 #4
0
        private void OnManipulationUpdated(Windows.UI.Input.GestureRecognizer sender, Windows.UI.Input.ManipulationUpdatedEventArgs args)
        {
            // Because of the way we process pointer events, all coordinates are expressed
            // in the coordinate system of the reference of the manipulation target.
            // args.Position stores the position of the pivot of this manipulation
            // args.Delta stores the deltas (Translation, Rotation in degrees, and Scale)

            var filteredArgs = new FilterManipulationEventArgs(args);

            if (OnFilterManipulation != null)
            {
                OnFilterManipulation(this, filteredArgs);
            }

            // Update the transform
            // filteredArgs.Pivot indicates the position of the pivot of this manipulation
            // filteredArgs.Delta indicates the deltas (Translation, Rotation in degrees, and Scale)
            this._previousTransform.Matrix  = _transform.Value;
            this._deltaTransform.CenterX    = filteredArgs.Pivot.X;
            this._deltaTransform.CenterY    = filteredArgs.Pivot.Y;
            this._deltaTransform.Rotation   = filteredArgs.Delta.Rotation;
            this._deltaTransform.ScaleX     = _deltaTransform.ScaleY = filteredArgs.Delta.Scale;
            this._deltaTransform.TranslateX = filteredArgs.Delta.Translation.X;
            this._deltaTransform.TranslateY = filteredArgs.Delta.Translation.Y;
        }
コード例 #5
0
 static void gr_ManipulationUpdated(Windows.UI.Input.GestureRecognizer sender, Windows.UI.Input.ManipulationUpdatedEventArgs args)
 {
     if (OnGestureRaised != null)
     {
         OnGestureRaised(sender, new CustomGestureArgs()
         {
             ManipulationUpdatedArgs = args
         });
     }
 }