当前位置: 首页>>代码示例>>C#>>正文


C# ManipulationDeltaEventArgs.Complete方法代码示例

本文整理汇总了C#中System.Windows.Input.ManipulationDeltaEventArgs.Complete方法的典型用法代码示例。如果您正苦于以下问题:C# ManipulationDeltaEventArgs.Complete方法的具体用法?C# ManipulationDeltaEventArgs.Complete怎么用?C# ManipulationDeltaEventArgs.Complete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Input.ManipulationDeltaEventArgs的用法示例。


在下文中一共展示了ManipulationDeltaEventArgs.Complete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnManipulationDelta

 private void OnManipulationDelta(object Sender, ManipulationDeltaEventArgs DeltaRoutedEventArgs)
 {
     if (DeltaRoutedEventArgs.CumulativeManipulation.Translation.X < -30)
     {
         _gameGrid.HandleMove(MoveDirection.Left);
         DeltaRoutedEventArgs.Complete();
         DeltaRoutedEventArgs.Handled = true;
     }
     else if (DeltaRoutedEventArgs.CumulativeManipulation.Translation.X > 30)
     {
         _gameGrid.HandleMove(MoveDirection.Right);
         DeltaRoutedEventArgs.Complete();
         DeltaRoutedEventArgs.Handled = true;
     }
     else if (DeltaRoutedEventArgs.CumulativeManipulation.Translation.Y < -30)
     {
         _gameGrid.HandleMove(MoveDirection.Up);
         DeltaRoutedEventArgs.Complete();
         DeltaRoutedEventArgs.Handled = true;
     }
     else if (DeltaRoutedEventArgs.CumulativeManipulation.Translation.Y > 30)
     {
         _gameGrid.HandleMove(MoveDirection.Down);
         DeltaRoutedEventArgs.Complete();
         DeltaRoutedEventArgs.Handled = true;
     }
 }
开发者ID:andrecurvello,项目名称:2048,代码行数:27,代码来源:MainPage.xaml.cs

示例2: OnManipulationDelta

        protected override void OnManipulationDelta(ManipulationDeltaEventArgs args)
        {
            if (!manipulationDeltaInProgress)
            {
                IsActive = true;

                if (!tapInertiaInProgess)
                    SelectedIndex = -1;
            }

            manipulationDeltaInProgress = true;

            // This is the fake inertia from a tap
            if (tapInertiaInProgess)
            {
                VerticalOffset -= args.DeltaManipulation.Translation.Y;
            }

            // All other direct manipulation and inertia
            else
            {
                // For non-wrappable panel, check for end of the line
                if (!isWrappableStackPanel)
                {
                    double newVerticalOffset = VerticalOffset - inertiaDirection * args.DeltaManipulation.Translation.Y;

                    if (FractionalCenteredIndexFromVerticalOffset(newVerticalOffset, false) < 0)
                    {
                        double verticalOffsetIncrement = VerticalOffset - VerticalOffsetFromCenteredIndex(0);
                        double verticalOffsetExcess = args.DeltaManipulation.Translation.Y - verticalOffsetIncrement;
                        VerticalOffset -= verticalOffsetIncrement;
                        SelectedIndex = 0;
                        args.ReportBoundaryFeedback(new ManipulationDelta(new Vector(0, verticalOffsetExcess), 0, new Vector(), new Vector()));
                        args.Complete();
                    }
                    else if (FractionalCenteredIndexFromVerticalOffset(newVerticalOffset, false) > Items.Count - 1)
                    {
                        double verticalOffsetIncrement = VerticalOffsetFromCenteredIndex(Items.Count - 1) - VerticalOffset;
                        double verticalOffsetExcess = args.DeltaManipulation.Translation.Y - verticalOffsetIncrement;
                        VerticalOffset += verticalOffsetIncrement;
                        SelectedIndex = Items.Count - 1;
                        args.ReportBoundaryFeedback(new ManipulationDelta(new Vector(0, verticalOffsetExcess), 0, new Vector(), new Vector()));
                        args.Complete();
                    }
                }

                // Here's where scrolling might reverse itself
                if (args.IsInertial && inertiaToUnknownIndex && !reverseInertiaChecked)
                    CheckForBackupManeuver(VerticalOffset, args.DeltaManipulation.Translation.Y, args.Velocities.LinearVelocity.Y);

                // This is the normal direct manipulation and inertia
                VerticalOffset -= inertiaDirection * args.DeltaManipulation.Translation.Y;
            }

            base.OnManipulationDelta(args);
        }
开发者ID:BoonieBear,项目名称:TinyMetro,代码行数:56,代码来源:WindowedItemsControl.Manipulation.cs

示例3: OnManipulationDelta

        protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
        {
            if (_panningInfo != null)
            {
                if (e.IsInertial && CompleteScrollManipulation)
                {
                    e.Complete();
                }
                else
                {
                    bool cancelManipulation = false;
                    if (_panningInfo.IsPanning)
                    {
                        // Do the scrolling if we already started it.
                        ManipulateScroll(e);
                    }
                    else if (CanStartScrollManipulation(e.CumulativeManipulation.Translation, out cancelManipulation))
                    {
                        // Check if we can start the scrolling and do accordingly
                        _panningInfo.IsPanning = true;
                        ManipulateScroll(e);
                    }
                    else if (cancelManipulation)
                    {
                        e.Cancel();
                        _panningInfo = null;
                    }
                }

                e.Handled = true;
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:32,代码来源:ScrollViewer.cs

示例4: Border_ManipulationDelta

 private void Border_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
 {
     //Debug.WriteLine("Border_ManipulationDelta");
     // optionally suppress zoom
     if ((ScrollDisabled || !userScalable) && (e.DeltaManipulation.Scale.X != 0.0 || e.DeltaManipulation.Scale.Y != 0.0))
     {
         e.Handled = true;
         e.Complete();
     }
     // optionally suppress scrolling
     if (ScrollDisabled && (e.DeltaManipulation.Translation.X != 0.0 || e.DeltaManipulation.Translation.Y != 0.0))
     {
         e.Handled = true;
         e.Complete();
     }
 }
开发者ID:Genosite,项目名称:cordova-wp8,代码行数:16,代码来源:BrowserMouseHelper.cs

示例5: player_ManipulationDelta


//.........这里部分代码省略.........
            FieldPlayer rectToMove = (FieldPlayer)sender;

            rectToMove.NormalizeTransformGroup();

            if (isFieldRotated == false)
            {
                rectToMove.OffsetTo((rectToMove.RenderTransform.Value.OffsetX + (e.DeltaManipulation.Translation.X / field.RenderTransform.Value.M22)), (rectToMove.RenderTransform.Value.OffsetY + (e.DeltaManipulation.Translation.Y / field.RenderTransform.Value.M22)));
            }
            else
            {
                rectToMove.OffsetTo((rectToMove.RenderTransform.Value.OffsetX + (e.DeltaManipulation.Translation.Y / field.RenderTransform.Value.M22)), (rectToMove.RenderTransform.Value.OffsetY + (-e.DeltaManipulation.Translation.X / field.RenderTransform.Value.M22)));
            }

            //Debugger.Break();

            double a = lastPlayerPointDot.X - (rectToMove.RenderTransform.Value.OffsetX + (e.DeltaManipulation.Translation.X / field.RenderTransform.Value.M22));
            double b = lastPlayerPointDot.Y - (rectToMove.RenderTransform.Value.OffsetY + (e.DeltaManipulation.Translation.Y / field.RenderTransform.Value.M22));
            double distance = Math.Sqrt(a * a + b * b);
            //lastPlayerPointDot = new Point(rectToMove.RenderTransform.Value.OffsetX, rectToMove.RenderTransform.Value.OffsetY);

            if (distance > (45 / field.RenderTransform.Value.M22))
            {
                lastPlayerPointDot = new Point(rectToMove.RenderTransform.Value.OffsetX, rectToMove.RenderTransform.Value.OffsetY);

                FieldPlayer tempFieldPlayer = (FieldPlayer)sender;

                Point locationFromWindow = tempFieldPlayer.TranslatePoint(new Point(0, 0), this);
                locationFromWindow.X = locationFromWindow.X / tempFieldPlayer.RenderTransform.Value.M22;

                Point locationFromScreen = tempFieldPlayer.PointToScreen(locationFromWindow);
                tempFieldPlayer.number.Text = (84 - (0.5 * ((1 / field.RenderTransform.Value.M22) - 1) * 168)).ToString();
                tempFieldPlayer.name.Text = (e.ManipulationOrigin.X - locationFromWindow.X).ToString();
                //if (e.ManipulationOrigin.X - locationFromWindow.X < 84 - (0.25 * ((1 / field.RenderTransform.Value.M22) - 1) * 168))
                if (tempFieldPlayer.playerTrailEnabled == true)
                {

                    Ellipse tempEllipse = new Ellipse();
                    tempEllipse.Height = 15 / field.RenderTransform.Value.M22;
                    tempEllipse.Width = 15 / field.RenderTransform.Value.M22;

                    tempEllipse.Fill = tempFieldPlayer.swatchBackground.Fill;
                    //tempEllipse.Fill = new SolidColorBrush(Colors.Red);

                    ScaleTransform ellipseScaleTransform = new ScaleTransform();
                    ellipseScaleTransform.ScaleY = 1;// / field.RenderTransform.Value.M22;
                    ellipseScaleTransform.ScaleX = 1;// / field.RenderTransform.Value.M22;
                    ellipseScaleTransform.CenterX = .5;
                    ellipseScaleTransform.CenterY = .5;

                    RotateTransform ellipseRotateTransform = new RotateTransform();
                    ellipseRotateTransform.Angle = 0;

                    TranslateTransform ellipseTranslate = new TranslateTransform();
                    ellipseTranslate.X = lastPlayerPointDot.X + rectToMove.Width / 2;// / field.RenderTransform.Value.M22;
                    ellipseTranslate.Y = lastPlayerPointDot.Y + rectToMove.Height / 2;// / field.RenderTransform.Value.M22;

                    SkewTransform ellipseSkew = new SkewTransform();
                    ellipseSkew.AngleX = 0;
                    ellipseSkew.AngleY = 0;

                    // Create a TransformGroup to contain the transforms
                    // and add the transforms to it.
                    TransformGroup ellipseTransformGroup = new TransformGroup();
                    ellipseTransformGroup.Children.Add(ellipseScaleTransform);
                    ellipseTransformGroup.Children.Add(ellipseRotateTransform);
                    ellipseTransformGroup.Children.Add(ellipseTranslate);
                    ellipseTransformGroup.Children.Add(ellipseSkew);

                    tempEllipse.RenderTransform = ellipseTransformGroup;

                    playerDots.Children.Add(tempEllipse);
                }
                //MessageBox.Show(playerDots.Children.Count.ToString());

            }
            //Matrix rectsMatrix = ((MatrixTransform)rectToMove.RenderTransform).Matrix;

            //// Move the Rectangle.
            //rectsMatrix.Translate(e.DeltaManipulation.Translation.X / field.RenderTransform.Value.M22,
            //                      e.DeltaManipulation.Translation.Y / field.RenderTransform.Value.M22);

            //// Apply the changes to the Rectangle.
            //rectToMove.RenderTransform = new MatrixTransform(rectsMatrix);

            Rect containingRect =
                new Rect(((FrameworkElement)e.ManipulationContainer).RenderSize);

            Rect shapeBounds =
                rectToMove.RenderTransform.TransformBounds(
                    new Rect(rectToMove.RenderSize));

            // Check if the rectangle is completely in the window.
            // If it is not and intertia is occuring, stop the manipulation.
            if (e.IsInertial && !containingRect.Contains(shapeBounds))
            {
                e.Complete();
            }

            e.Handled = true;
        }
开发者ID:clarksbrother,项目名称:STU-SoccerLineup2D,代码行数:101,代码来源:MainWindow.xaml.cs

示例6: DrawingCanvas_ManipulationDelta

        private void DrawingCanvas_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            TouchableImage image = e.OriginalSource as TouchableImage;
            if (image != null)
            {
                Rect containingRect = new Rect(((FrameworkElement)e.ManipulationContainer).RenderSize);
                Rect shapeBounds = image.transformGroup.TransformBounds(new Rect(image.RenderSize));

                if (e.IsInertial && !containingRect.Contains(shapeBounds))
                {
                    e.Complete();
                }

                Point center = new Point(image.RenderSize.Width / 2.0, image.RenderSize.Height / 2.0);

                //rotation
                image.rotate.CenterX = center.X;
                image.rotate.CenterY = center.Y;
                image.rotate.Angle += e.DeltaManipulation.Rotation;

                //scale
                image.scale.CenterX = center.X;
                image.scale.CenterY = center.Y;
                image.scale.ScaleX *= e.DeltaManipulation.Scale.X;
                image.scale.ScaleY *= e.DeltaManipulation.Scale.Y;

                //trans
                image.traslation.X += e.DeltaManipulation.Translation.X;
                image.traslation.Y += e.DeltaManipulation.Translation.Y;
            }
        }
开发者ID:habs57,项目名称:tablet-interaction,代码行数:31,代码来源:MainWindow.xaml.cs

示例7: OnManipulationDelta

        private void OnManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            if (_isPaused)
                return;

            e.Handled = true;

            if (e.CumulativeManipulation.Translation.X > 0 && IsFirstPage ||
                e.CumulativeManipulation.Translation.X < 0 && IsLastPage)
            {
               CancelNextEvent();
                e.Complete();
            }
            else
            {
                if ((_mode & FlippingMode.Slide) == FlippingMode.Slide)
                    ManipulationDelta(sender, e);
            }
        }
开发者ID:karbazol,项目名称:FBReaderCS,代码行数:19,代码来源:DragManipulationBase.cs

示例8: OnOwnerManipulationDelta

        /// <summary>
        /// Event fired when the user wiggles their finger after the initial press
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">Event arguments.</param>
        private void OnOwnerManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            // If the context menu is open already, then complete this gesture
            // good to do for owner of type ListBox, Pivot, Panorama
            if (IsOpen == true)
            {
                e.Complete();
                e.Handled = true;
            }

            // If there is a non-negative drag or multi-finger, then cancel the timer
            if (Math.Abs(e.DeltaManipulation.Translation.X) != ContextMenuCancelMovement
                || Math.Abs(e.DeltaManipulation.Translation.Y) != ContextMenuCancelMovement
                || Math.Abs(e.DeltaManipulation.Scale.X) != 0
                || Math.Abs(e.DeltaManipulation.Scale.Y) != 0)
            {
                tapAndHoldTimer.Stop();
            }
        }
开发者ID:blueprintmrk,项目名称:Workspaces,代码行数:24,代码来源:ContextMenu.cs

示例9: OnManipulationDelta

        protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
        {
            // manipulation canceled
            if (_tracker.Canceled) return;

            if (_tracker.TrackManipulation(e.CumulativeManipulation.Translation))
            {
                // mark as handled to stop
                // underlying control's manipulations
                e.Handled = true;

                // cancel capture from current object to disable click behavior,
                // if we've started scrolling. Not sure what the best technique is.
                // let's just hook/override OnManipulationCompleted
                // and force e.Handled on it for now...
                _hook.HookCompletedHandler(OnManipulationCompleted);

                // move to position
                double position = _tracker.Start.X - e.CumulativeManipulation.Translation.X;
                if (_trackHeader)
                {
                    // tracking Headers : Items move twice as fast
                    ScrollView.HeaderPosition = _tracker.Start.X - _tracker.Delta.X;
                    ScrollView.Position = _tracker.Start.Y - (_tracker.Delta.X * 2);
                }
                else
                {
                    // tracking Items : Headers move twice as slow
                    ScrollView.HeaderPosition = _tracker.Start.Y - (_tracker.Delta.X / 2);
                    ScrollView.Position = _tracker.Start.X - _tracker.Delta.X;
                }
            }

            // complete manipulation
            if (_tracker.Completed) e.Complete();
        }
开发者ID:eightrivers,项目名称:babelim,代码行数:36,代码来源:PivotControl.cs

示例10: image_ManipulationDelta

        void image_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            var element = e.Source as FrameworkElement;
            if (element != null)
            {
                var deltaManipulation = e.DeltaManipulation;
                var matrix = ((MatrixTransform)element.RenderTransform).Matrix;
                System.Windows.Point center = new System.Windows.Point(element.ActualWidth / 2, element.ActualHeight / 2);
                center = matrix.Transform(center);
                matrix.ScaleAt(deltaManipulation.Scale.X, deltaManipulation.Scale.Y, center.X, center.Y);
                matrix.RotateAt(e.DeltaManipulation.Rotation, center.X, center.Y);
                matrix.Translate(e.DeltaManipulation.Translation.X, e.DeltaManipulation.Translation.Y);

                ((MatrixTransform)element.RenderTransform).Matrix = matrix;
                e.Handled = true;

                if (e.IsInertial)
                {
                    Rect containingRect = new Rect(((FrameworkElement)e.ManipulationContainer).RenderSize);
                    Rect shapeBounds = element.RenderTransform.TransformBounds(new Rect(element.RenderSize));
                    if (e.IsInertial && !containingRect.Contains(shapeBounds))
                    {
                        e.ReportBoundaryFeedback(e.DeltaManipulation);
                        e.Complete();
                    }
                }
            }
        }
开发者ID:smallcube,项目名称:EHealthCarePatientApp,代码行数:28,代码来源:DisplayDicomImage.xaml.cs

示例11: OnManipulationDelta

        protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
        {
            // manipulation canceled
            if (_tracker.Canceled) return;

            if (_tracker.TrackManipulation(e.CumulativeManipulation.Translation))
            {
                // handle this one
                e.Handled = true;

                // cancel capture from current object to disable behaviors
                // for example, a button will not trigger the Click event
                // after we've done scrolling
                UIElement ui = e.ManipulationContainer as UIElement;
                ui.ReleaseMouseCapture();

                // the above code doesn't seem to work for unknown reasons
                // let's just hook/override it for now...
                _hack.Set(e.ManipulationContainer, OnManipulationCompleted);

                // move to position
                double position = _tracker.Start.X - e.CumulativeManipulation.Translation.X;
                if (_trackHeader)
                {
                    // tracking Headers : Items move twice as fast
                    ScrollView.HeaderPosition = _tracker.Start.X - _tracker.Delta.X;
                    ScrollView.Position = _tracker.Start.Y - (_tracker.Delta.X * 2);
                }
                else
                {
                    // tracking Items : Headers move twice as slow
                    ScrollView.HeaderPosition = _tracker.Start.Y - (_tracker.Delta.X / 2);
                    ScrollView.Position = _tracker.Start.X - _tracker.Delta.X;
                }
            }

            // complete manipulation
            if (_tracker.Completed) e.Complete();
        }
开发者ID:JamesHay,项目名称:FlightsNorway,代码行数:39,代码来源:PivotControl.cs

示例12: Canvas_ManipulationDelta


//.........这里部分代码省略.........
                double yScale = 1 + (e.DeltaManipulation.Scale.Y - 1) * this.ProtoDefinition.ScaleManipulation.YModifier;

                //discrete X Scaling
                if (this.ProtoDefinition.ScaleManipulation.DiscreteScalingX != 0)
                {
                    if (Math.Abs(this.DiscreteScalingCounter_X) >= 0.75)
                    {
                        xScale = 1 - (Math.Sign(1 - e.DeltaManipulation.Scale.X) * this.ProtoDefinition.ScaleManipulation.DiscreteScalingX);
                        this.DiscreteScalingCounter_X = 0;
                    }
                    else if(e.DeltaManipulation.Scale.X != 1.0)
                    {
                        this.DiscreteScalingCounter_X += ((1 - e.DeltaManipulation.Scale.X) * 10);
                        xScale = 1;
                    }
                }

                if (this.ProtoDefinition.ScaleManipulation.DiscreteScalingY != 0)
                {
                    if (Math.Abs(this.DiscreteScalingCounter_Y) >= 0.75)
                    {
                        yScale = 1 - (Math.Sign(1 - e.DeltaManipulation.Scale.Y) * this.ProtoDefinition.ScaleManipulation.DiscreteScalingY);
                        this.DiscreteScalingCounter_Y = 0;
                    }
                    else if (e.DeltaManipulation.Scale.Y != 1.0)
                    {
                        this.DiscreteScalingCounter_Y += ((1 - e.DeltaManipulation.Scale.Y) * 10);
                        yScale = 1;
                    }
                }

                rectsMatrix.ScaleAt(xScale, yScale, e.ManipulationOrigin.X, e.ManipulationOrigin.Y);

            }

            //translation with multiple fingers
            if (this.ProtoDefinition.MoveManipulation.IsEnabled)
            {
                //discrete movement, like on a chess board for example

                // standard movement formula
                double xDif = e.DeltaManipulation.Translation.X * this.ProtoDefinition.MoveManipulation.XModifier;
                double yDif = e.DeltaManipulation.Translation.Y * this.ProtoDefinition.MoveManipulation.YModifier;

                // overriding the standard movement if the ProtoDefinition contains a "discrete X movement distance"
                if (this.ProtoDefinition.MoveManipulation.DiscreteMovementDistanceX != 0)
                {
                    if (Math.Abs(this.DiscreteMovementCounter_X) >= this.ProtoDefinition.MoveManipulation.DiscreteMovementDistanceX)
                    {
                        xDif = Math.Sign(e.DeltaManipulation.Translation.X) * this.ProtoDefinition.MoveManipulation.DiscreteMovementDistanceX * this.ProtoDefinition.MoveManipulation.XModifier;
                        this.DiscreteMovementCounter_X = 0;
                    }
                    else if(e.DeltaManipulation.Translation.X != 0)
                    {
                        this.DiscreteMovementCounter_X += e.DeltaManipulation.Translation.X;
                        xDif = 0;
                    }
                }

                // overriding the standard movement if the ProtoDefinition contains a "discrete Y movement distance"
                if(this.ProtoDefinition.MoveManipulation.DiscreteMovementDistanceY != 0)
                {
                    if (Math.Abs(this.DiscreteMovementCounter_Y) >= this.ProtoDefinition.MoveManipulation.DiscreteMovementDistanceY)
                    {
                        yDif = Math.Sign(e.DeltaManipulation.Translation.Y) * this.ProtoDefinition.MoveManipulation.DiscreteMovementDistanceY * this.ProtoDefinition.MoveManipulation.YModifier;
                        this.DiscreteMovementCounter_Y = 0;
                    }
                    else if (e.DeltaManipulation.Translation.Y != 0)
                    {
                        this.DiscreteMovementCounter_Y += e.DeltaManipulation.Translation.Y;
                        yDif = 0;
                    }
                }

                //apply the translation values, either analogue or discrete, or a mixture with one axis analogue and the other discrete
                rectsMatrix.Translate(xDif, yDif);

            }

            //apply the matrix transformation to the render transform of the object
            this.RenderTransform = new MatrixTransform(rectsMatrix);

            //check if the object should be kept inside the given boundaries after inertia behaviour has started
            if (this.ProtoDefinition.KeepInsideBoundaries)
            {
                //window boundaries
                Rect boundaries = new Rect(((FrameworkElement)e.ManipulationContainer).RenderSize);
                //the objects bounds
                Rect thisBounds = this.RenderTransform.TransformBounds(new Rect(this.RenderSize));

                //stop movement inside boundaries
                if (e.IsInertial && !boundaries.Contains(thisBounds))
                {
                    e.Complete();
                }
            }
            e.Handled = true;

            //Console.WriteLine("Selfmade SVI, rendertransform: " + rectsMatrix.M11);
        }
开发者ID:ux-hs-mannheim,项目名称:lgRuntime,代码行数:101,代码来源:SelfmadeSVI.xaml.cs

示例13: cnvTable_ManipulationDelta

        private void cnvTable_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            Piece element = e.OriginalSource as Piece;

            // find the old center; arguaby this could be cached
            Point center = new Point(element.ActualWidth / 2, element.ActualHeight / 2);

            //element.RotatePiece(e.DeltaManipulation.Rotation,
            //                    e.ManipulationOrigin.X,
            //                    e.ManipulationOrigin.Y);

            //element.RotatePiece(e.DeltaManipulation.Rotation,
            //                    center.X,
            //                    center.Y);

            element.Rotate(e.DeltaManipulation.Rotation);

            element.MoveDeltaPiece(e.DeltaManipulation.Translation.X,
                             e.DeltaManipulation.Translation.Y);

            e.Handled = true;

            // checking boundaries during inertia
            if (e.IsInertial)
            {
                Rect containingRect = new Rect(((FrameworkElement)e.ManipulationContainer).RenderSize);

                Rect shapeBounds = element.RenderTransform.TransformBounds(new Rect(element.RenderSize));

                // Check if the element is completely in the window.
                // If it is not and intertia is occuring, stop the manipulation.
                if (e.IsInertial && !containingRect.Contains(shapeBounds))
                {
                    //Report that we have gone over our boundary
                    e.ReportBoundaryFeedback(e.DeltaManipulation);
                    e.Complete();
                }
            }

            UnionValidation();
            VerticalUnionValidation();
        }
开发者ID:virucho,项目名称:TouchInfoPoint,代码行数:42,代码来源:Puzzle.xaml.cs

示例14: OnManipulationDelta

        private void OnManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            Matrix m = _ImageTransform.Matrix;

            // If element beyond edge, report back to WPF
            Vector pastEdgeVector;
            if (ElementPastBoundary(_ImageControl, out pastEdgeVector))
            {
                m.Translate(-1.0 * pastEdgeVector.X, -1.0 * pastEdgeVector.Y);
                _ImageTransform.Matrix = m;

                e.Complete();
                e.Handled = true;
                return;
            }

            // Find center of element and then transform to get current location of center
            FrameworkElement fe = _ImageControl;
            if (fe == null)
                return;
            Point center = new Point(fe.ActualWidth / 2, fe.ActualHeight / 2);
            center = m.Transform(center);

            // Update matrix to reflect translation and rotation
            ManipulationDelta md = e.DeltaManipulation;
            m.Translate(md.Translation.X, md.Translation.Y);
            m.ScaleAt(md.Scale.X, md.Scale.Y, center.X, center.Y);

            _ImageTransform.Matrix = m;
            RaisePropertyChanged("ImageTransform");

            e.Handled = true;
        }
开发者ID:aert,项目名称:aert-csharp-extensions,代码行数:33,代码来源:TouchImageHelper.cs

示例15: ManipulateScroll

        private void ManipulateScroll(ManipulationDeltaEventArgs e)
        {
            Debug.Assert(_panningInfo != null);
            PanningMode panningMode = _panningInfo.PanningMode;
            if (panningMode != PanningMode.VerticalOnly)
            {
                // Scroll horizontally unless the mode is VerticalOnly
                ManipulateScroll(e.DeltaManipulation.Translation.X, e.CumulativeManipulation.Translation.X, true);
            }

            if (panningMode != PanningMode.HorizontalOnly)
            {
                // Scroll vertically unless the mode is HorizontalOnly
                ManipulateScroll(e.DeltaManipulation.Translation.Y, e.CumulativeManipulation.Translation.Y, false);
            }

            if (e.IsInertial && IsPastInertialLimit())
            {
                e.Complete();
            }
            else
            {
                double unusedX = _panningInfo.UnusedTranslation.X;
                if (!_panningInfo.InHorizontalFeedback &&
                    DoubleUtil.LessThan(Math.Abs(unusedX), PanningInfo.PreFeedbackTranslationX))
                {
                    unusedX = 0;
                }
                _panningInfo.InHorizontalFeedback = (!DoubleUtil.AreClose(unusedX, 0));

                double unusedY = _panningInfo.UnusedTranslation.Y;
                if (!_panningInfo.InVerticalFeedback &&
                    DoubleUtil.LessThan(Math.Abs(unusedY), PanningInfo.PreFeedbackTranslationY))
                {
                    unusedY = 0;
                }
                _panningInfo.InVerticalFeedback = (!DoubleUtil.AreClose(unusedY, 0));

                if (_panningInfo.InHorizontalFeedback || _panningInfo.InVerticalFeedback)
                {
                    // Report boundary feedback if needed
                    e.ReportBoundaryFeedback(new ManipulationDelta(new Vector(unusedX, unusedY), 0.0, new Vector(1.0, 1.0), new Vector()));

                    if (e.IsInertial && _panningInfo.InertiaBoundaryBeginTimestamp == 0)
                    {
                        _panningInfo.InertiaBoundaryBeginTimestamp = Environment.TickCount;
                    }
                }
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:50,代码来源:ScrollViewer.cs


注:本文中的System.Windows.Input.ManipulationDeltaEventArgs.Complete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。