コード例 #1
0
        private void ProcessManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            _translate.X += e.TranslationDelta.Width;
            _translate.Y += e.TranslationDelta.Height;

            _rotate.Angle += e.RotationDelta * 180 / Math.PI;

            _scale.ScaleX *= e.ScaleDelta;
            _scale.ScaleY *= e.ScaleDelta;         
        }
コード例 #2
0
ファイル: ChromiumWebBrowser.cs プロジェクト: poloab/CefSharp
        protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
        {
            base.OnManipulationDelta(e);

            if (!e.Handled)
            {
                var point = e.ManipulationOrigin;

                if (browser != null)
                {
                    browser.GetHost().SendMouseWheelEvent(
                        (int)point.X,
                        (int)point.Y,
                        deltaX: (int)e.DeltaManipulation.Translation.X,
                        deltaY: (int)e.DeltaManipulation.Translation.Y,
                        modifiers: CefEventFlags.None);
                }
            }
        }
コード例 #3
0
ファイル: MainPage.xaml.cs プロジェクト: HydroRifle/WPMDP
        private void Canvas_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            // Scale the rectangle.
            if ((e.DeltaManipulation.Scale.X == 0) || (e.DeltaManipulation.Scale.Y == 0))
            {
                // Increase ScaleX and ScaleY by 5%.
                this.scale.ScaleX *= 1.05;
                this.scale.ScaleY *= 1.05;
            }
            else
            {
                this.scale.ScaleX *= e.DeltaManipulation.Scale.X;
                this.scale.ScaleY *= e.DeltaManipulation.Scale.Y;
            }

            // Move the rectangle.
            this.translation.X += e.DeltaManipulation.Translation.X;
            this.translation.Y += e.DeltaManipulation.Translation.Y;
        }
コード例 #4
0
        /*internal void AnimateScrollViewer(int x, int y)
         * {
         *  var scrollViewer = (lessonContainerComponent as Nine.Views.Controls.TouchScrollViewer);
         *  var keyTime =  KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(750));
         *  var keySpline = new KeySpline(0.25, 1, 0.05, 1);
         *
         *  if (x != 0)
         *  {
         *      var xAnimation = new DoubleAnimationUsingKeyFrames();
         *      var newXOffset = HorizontalOffset + x;
         *      xAnimation.KeyFrames.Add(new SplineDoubleKeyFrame(newXOffset, keyTime, keySpline));
         *      xAnimation.Completed += new System.EventHandler(AnimateScrollViewerCompleted);
         *      scrollViewer.BeginAnimation(Nine.Views.Controls.TouchScrollViewer.HorizontalOffsetProperty, xAnimation);
         *  }
         *
         *  if (y != 0)
         *  {
         *      var yAnimation = new DoubleAnimationUsingKeyFrames();
         *      var newYOffset = VerticalOffset + y;
         *      yAnimation.KeyFrames.Add(new SplineDoubleKeyFrame(newYOffset, keyTime, keySpline));
         *      yAnimation.Completed += new System.EventHandler(AnimateScrollViewerCompleted);
         *      scrollViewer.BeginAnimation(Nine.Views.Controls.TouchScrollViewer.VerticalOffsetProperty, yAnimation);
         *  }
         * }
         *
         * private void AnimateScrollViewerCompleted(object sender, EventArgs e)
         * {
         *  // Ne marche pas (Le TouchScrollViewer ne marche plus après ça
         *  var scrollViewer = (lessonContainerComponent as Nine.Views.Controls.TouchScrollViewer);
         *  scrollViewer.ScrollToHorizontalOffset(HorizontalOffset);
         *  scrollViewer.ScrollToVerticalOffset(VerticalOffset);
         *  RaisePropertyChanged("HorizontalOffset");
         *  RaisePropertyChanged("VerticalOffset");
         *  lessonContainerComponent.UpdateLayout();
         * }*/

        //private double cumulativeDelta = 0;

        public void ContainerManipulationDelta(ManipulationDeltaEventArgs e)
        {
            // Finger inking disable manipulation
            if (layerStack.CurrentState.FingerInkingEnabled)
            {
                return;
            }

            //var delta = (e.DeltaManipulation.Scale.X - 1);
            //cumulativeDelta += delta;

            //if (Math.Abs(cumulativeDelta) > 0.05)
            {
                //Zoom(cumulativeDelta + 1);
                Zoom(e.DeltaManipulation.Scale.X);
                ZoomTranslate(e.ManipulationOrigin, e.DeltaManipulation.Translation);
                //cumulativeDelta = 0;
            }
        }
コード例 #5
0
 void ManipulationElement_ManipulationDelta(object?sender, ManipulationDeltaEventArgs e)
 {
     foreach (var m in mouseProcessors)
     {
         if (e.Handled)
         {
             break;
         }
         m.PreprocessManipulationDelta(e);
     }
     if (!e.Handled)
     {
         defaultMouseProcessor.OnManipulationDelta(sender, e);
     }
     foreach (var m in mouseProcessors)
     {
         m.PostprocessManipulationDelta(e);
     }
 }
コード例 #6
0
        /// <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();
            }
        }
コード例 #7
0
        private void Border_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            // suppress zoom
            if (e.DeltaManipulation.Scale.X != 0.0 ||
                e.DeltaManipulation.Scale.Y != 0.0)
            {
                e.Handled = true;
            }

            // optionally suppress scrolling
            if (ScrollDisabled)
            {
                if (e.DeltaManipulation.Translation.X != 0.0 ||
                    e.DeltaManipulation.Translation.Y != 0.0)
                {
                    e.Handled = true;
                }
            }
        }
コード例 #8
0
        private void OnManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            e.Handled = true;
            Point translation1 = e.DeltaManipulation.Translation;
            // ISSUE: explicit reference operation
            double x            = translation1.X;
            double num1         = Math.Abs(x);
            Point  translation2 = e.DeltaManipulation.Translation;
            // ISSUE: explicit reference operation
            double num2 = Math.Abs(translation2.Y);

            if ((num1 >= num2 ? 1 : 0) != 1 || x == 0.0)
            {
                return;
            }
            this._wasDragged      = true;
            this._dragTranslation = this._dragTranslation + x;
            this.Translation      = Math.Max(0.0, Math.Min(this._checkedTranslation, this._dragTranslation));
        }
コード例 #9
0
        void TouchableThing_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            // Get the Rectangle and its RenderTransform matrix.
            Rectangle rectToMove  = new Rectangle();// e.OriginalSource as Rectangle;
            Matrix    rectsMatrix = ((MatrixTransform)rectToMove.RenderTransform).Matrix;

            // Rotate the Rectangle.
            rectsMatrix.RotateAt(e.DeltaManipulation.Rotation,
                                 e.ManipulationOrigin.X,
                                 e.ManipulationOrigin.Y);

            // Resize the Rectangle.  Keep it square
            // so use only the X value of Scale.
            rectsMatrix.ScaleAt(e.DeltaManipulation.Scale.X,
                                e.DeltaManipulation.Scale.X,
                                e.ManipulationOrigin.X,
                                e.ManipulationOrigin.Y);

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

            this.LineRuler.Width *= e.DeltaManipulation.Scale.X;
            //this.LineRuler.Height *= e.DeltaManipulation.Scale.Y;

            // the center never changes in this sample, although we always compute it.
            Point center = new Point(this.LineRuler.RenderSize.Width / 2.0, this.LineRuler.RenderSize.Height / 2.0);

            // apply the rotation at the center of the rectangle if it has changed
            this.rotation.CenterX = center.X;
            this.rotation.CenterY = center.Y;
            this.rotation.Angle  += e.DeltaManipulation.Rotation;

            // apply translation
            this.translation.X += e.DeltaManipulation.Translation.X;
            this.translation.Y += e.DeltaManipulation.Translation.Y;

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

            e.Handled = true;
        }
コード例 #10
0
        private void OnTextManipulatonDelta(object sender, ManipulationDeltaEventArgs e)
        {
            Vector2 vector2 = new Vector2();

            while (TouchPanel.IsGestureAvailable)
            {
                vector2 = TouchPanel.ReadGesture().Position;
            }
            if (Orientation == PageOrientation.LandscapeLeft)
            {
                vector2 = new Vector2(vector2.Y, 480f - vector2.X);
            }
            else if (Orientation == PageOrientation.LandscapeRight)
            {
                vector2 = new Vector2((float)ActualWidth - vector2.Y, vector2.X);
            }
            if (!this._textManipulationStarted)
            {
                return;
            }
            var            point = new Point(vector2.X - _offsetX, vector2.Y - _offsetY);
            TextRenderData a     = PageCanvas.CurrentTexts.FirstOrDefault(l => l.Rect.Contains(point));

            if (a == null)
            {
                return;
            }

            if (a.TokenID < _lastWord.TokenID)
            {
                a = PageCanvas.CurrentTexts.FirstOrDefault(l => l.TokenID == a.TokenID);
            }
            else
            {
                a = PageCanvas.CurrentTexts.LastOrDefault(l => l.TokenID == a.TokenID);
            }


            PageCanvas.SetSelection(a, _lastWord);

            Debug.WriteLine(_lastWord.Text);
        }
コード例 #11
0
ファイル: MainWindow.xaml.cs プロジェクト: LuckyTeng/FirstWPF
        void Window_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            // Get the Rectangle and its RenderTransform matrix.
            Rectangle rectToMove  = e.OriginalSource as Rectangle;
            Matrix    rectsMatrix = ((MatrixTransform)rectToMove.RenderTransform).Matrix;

            // Rotate the Rectangle.
            rectsMatrix.RotateAt(e.DeltaManipulation.Rotation,
                                 e.ManipulationOrigin.X,
                                 e.ManipulationOrigin.Y);

            // Resize the Rectangle.  Keep it square
            // so use only the X value of Scale.
            rectsMatrix.ScaleAt(e.DeltaManipulation.Scale.X,
                                e.DeltaManipulation.Scale.X,
                                e.ManipulationOrigin.X,
                                e.ManipulationOrigin.Y);

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

            // 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;
        }
コード例 #12
0
        protected override void OnManipulationDelta(ManipulationDeltaEventArgs args)
        {
            UIElement         element = args.Source as UIElement;
            MatrixTransform   xform   = element.RenderTransform as MatrixTransform;
            Matrix            matrix  = xform.Matrix;
            ManipulationDelta delta   = args.DeltaManipulation;
            Point             center  = args.ManipulationOrigin;

            /*
             * matrix.Translate(-center.X, -center.Y);
             * matrix.Scale(delta.Scale.X, delta.Scale.Y);
             * matrix.Rotate(delta.Rotation);
             * matrix.Translate(center.X, center.Y);
             * matrix.Translate(delta.Translation.X, delta.Translation.Y);
             * xform.Matrix = matrix;
             */
            Matrix to = matrix;

            to.Translate(-center.X, -center.Y);
            to.Scale(delta.Scale.X, delta.Scale.Y);
            to.Rotate(delta.Rotation);
            to.Translate(center.X, center.Y);
            to.Translate(delta.Translation.X, delta.Translation.Y);

            MatrixAnimation b = new MatrixAnimation()
            {
                From         = matrix,
                To           = to,
                Duration     = TimeSpan.FromMilliseconds(0),
                FillBehavior = FillBehavior.HoldEnd
            };

            (element.RenderTransform as MatrixTransform).BeginAnimation(MatrixTransform.MatrixProperty, b);



            tbTranslate.Text  = string.Format("Translation: {0}, {1}", delta.Translation.X, delta.Translation.Y);
            tbTranslate.Text += string.Format("\r\nTotal Translation: {0}, {1}", args.CumulativeManipulation.Translation.X, args.CumulativeManipulation.Translation.Y);

            args.Handled = true;
            base.OnManipulationDelta(args);
        }
コード例 #13
0
        private void OnManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            var scaling     = IsScaling(e, FingersDown);
            var translating = FingersDown == 1 && (Math.Abs(e.DeltaManipulation.Translation.X) > 0 || Math.Abs(e.DeltaManipulation.Translation.Y) > 0);

            double angle;
            var    rotating = IsRotating(_lastPrimaryTouchPoint, _lastSecondaryTouchPoint, _primaryTouchPoint, _secondaryTouchPoint, FingersDown, out angle);

            //bool rotating = false;

            if (scaling || translating || rotating)
            {
                _isTap = false;
                AbortTapHold();
            }

            if (rotating && Math.Abs(angle) > RotationThreshold)
            {
                RaiseEvent(sender, Rotate, new RotateGestureEventArgs
                {
                    Origin = e.ManipulationOrigin,
                    Angle  = angle
                });
            }
            else if (scaling)
            {
                RaiseEvent(sender, Scale, new ScaleGestureEventArgs
                {
                    Origin          = e.ManipulationOrigin,
                    DeltaScale      = e.DeltaManipulation.Scale,
                    CumulativeScale = e.CumulativeManipulation.Scale
                });
            }
            else if (translating)
            {
                RaiseEvent(sender, Pan, new PanGestureEventArgs
                {
                    Origin      = e.ManipulationOrigin,
                    Translation = e.DeltaManipulation.Translation
                });
            }
        }
コード例 #14
0
        private void OnManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            // Get the UI element and its RenderTransform matrix
            var uiElement = e.OriginalSource as UIElement;

            if (uiElement != null)
            {
                var matrixTransform = (MatrixTransform)uiElement.RenderTransform;
                var matrix          = matrixTransform.Matrix;

                // Rotate the element
                matrix.RotateAt(e.DeltaManipulation.Rotation,
                                e.ManipulationOrigin.X,
                                e.ManipulationOrigin.Y);

                // Resize the element
                matrix.ScaleAt(e.DeltaManipulation.Scale.X,
                               e.DeltaManipulation.Scale.Y,
                               e.ManipulationOrigin.X,
                               e.ManipulationOrigin.Y);

                // Move the element
                matrix.Translate(e.DeltaManipulation.Translation.X,
                                 e.DeltaManipulation.Translation.Y);

                // Apply the changes to the element
                matrixTransform.Matrix = matrix;

                var manipulationContainer = (FrameworkElement)e.ManipulationContainer;
                var containingRect        = new Rect(manipulationContainer.RenderSize);
                var shapeBounds           = uiElement.RenderTransform.TransformBounds(new Rect(uiElement.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))
                {
                    e.Complete();
                }
            }

            e.Handled = true;
        }
コード例 #15
0
        //Update picture state
        private void ProcessManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            //if (index == int.MinValue)
            //    return;
            //System.Windows.Controls.Image image = _pictureTrackerManager.SpiralSummarization.KeyFrames[index].Image;
            // Console.WriteLine(index);

            //image.Margin = new Thickness(image.Margin.Left + e.TranslationDelta.Width, image.Margin.Top + e.TranslationDelta.Height,0,0);
            if (e.ScaleDelta > 1)
            {
                _pictureTrackerManager.ZoomState = 1;
            }
            else if (e.ScaleDelta < 1)
            {
                _pictureTrackerManager.ZoomState = 2;
            }
            //Console.WriteLine("index:" + index);
            //Console.WriteLine("scaledelda:" + e.ScaleDelta);
            // Console.WriteLine("zoomState:" + _pictureTrackerManager.ZoomState);
        }
コード例 #16
0
 protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
 {
     if (this.Column.AllowResizing)
     {
         this.TreeGrid.ColumnResizingController.DoActionOnMouseMove(touchDevice.GetTouchPoint(this.TreeGrid.TreeGridPanel).Position, this);
     }
     if (!this.TreeGrid.ColumnResizingController.isHovering && isTouchPressed && this.Cursor == Cursors.Arrow)
     {
         if (this.Column.AllowDragging)
         {
             List <IManipulator> devices = e.Manipulators.ToList();
             var pointerMove             = devices[0].GetPosition(this);
             ShowPopup(pointerMove, touchDevice);
             isTouchPressed = false;
             e.Handled      = true;
             return;
         }
     }
     base.OnManipulationDelta(e);
 }
コード例 #17
0
        private void OnDragDelta(object sender, ManipulationDeltaEventArgs e)
        {
            if (isGestureOnTarget)
            {
                // HorizontalChange and VerticalChange from DragDeltaGestureEventArgs are now
                // DeltaManipulation.Translation.X and DeltaManipulation.Translation.Y.

                // The translation is given in the coordinate space of e.ManipulationContainer, which in
                // this case is the border control that we're applying transforms to. We need to apply
                // the the current rotation and scale transforms to the deltas to get back to screen coordinates.
                // Note that if other ancestors of the border control had transforms applied as well, we would
                // need to use UIElement.TransformToVisual to get the aggregate transform between
                // the border control and Application.Current.RootVisual. See GestureListenerStatic.cs in the
                // WP8 toolkit source for a detailed look at how this can be done.
                Point transformedTranslation = GetTransformNoTranslation(transform).Transform(e.DeltaManipulation.Translation);

                transform.TranslateX += transformedTranslation.X;
                transform.TranslateY += transformedTranslation.Y;
            }
        }
コード例 #18
0
        void Canvas_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            MatrixTransform transform = photo.RenderTransform as MatrixTransform;

            if (transform != null)
            {
                // Применить дельты к матрице, затем воспользоваться
                // созданной матрицей в преобразовании MatrixTransform
                Matrix matrix = transform.Matrix;
                matrix.Translate(e.DeltaManipulation.Translation.X,
                                 e.DeltaManipulation.Translation.Y);
                matrix.RotateAt(e.DeltaManipulation.Rotation,
                                e.ManipulationOrigin.X, e.ManipulationOrigin.Y);
                matrix.ScaleAt(e.DeltaManipulation.Scale.X,
                               e.DeltaManipulation.Scale.Y,
                               e.ManipulationOrigin.X, e.ManipulationOrigin.Y);
                transform.Matrix = matrix;
                e.Handled        = true;
            }
        }
コード例 #19
0
        private void OnManipulationDelta(object sender, ManipulationDeltaEventArgs manipulationDeltaEventArgs)
        {
            var delta = manipulationDeltaEventArgs.DeltaManipulation;
            var sb    = new StringBuilder();

            sb.AppendLine("Rotation:    " + delta.Rotation);
            sb.AppendLine("Translation: " + delta.Translation.ToString());
            sb.AppendLine("Expansion:   " + delta.Expansion.ToString());
            sb.AppendLine("Scale:       " + delta.Scale.ToString());

            _popup.DataContext = sb.ToString();

            //if (Math.Abs(delta.Scale.Length) < 0.001d)
            //    return;

            //var scale = Scale * delta.Scale.Length;
            //_scaleFactor = Math.Log(scale, ZoomPow);
            //UpdateScale();
            ////ScaleContainer.LayoutTransform = new ScaleTransform(scale, scale);
        }
コード例 #20
0
        protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
        {
            // the center never changes in this sample, although we always compute it.
            Point center = new Point(BasicRect.RenderSize.Width / 2.0, BasicRect.RenderSize.Height / 2.0);

            // apply the rotation at the center of the rectangle if it has changed
            rotation.CenterX = center.X;
            rotation.CenterY = center.Y;
            rotation.Angle  += e.DeltaManipulation.Rotation;

            // Scale is always uniform, by definition, so the x and y will always have the same magnitude
            scale.CenterX = center.X;
            scale.CenterY = center.Y;
            scale.ScaleX *= e.DeltaManipulation.Scale.X;
            scale.ScaleY *= e.DeltaManipulation.Scale.Y;

            // apply translation
            translation.X += e.DeltaManipulation.Translation.X;
            translation.Y += e.DeltaManipulation.Translation.Y;
        }
コード例 #21
0
        private void pivot_ManipulationCompleted(object sender, ManipulationDeltaEventArgs e)
        {
            Point endPoint = e.ManipulationOrigin;

            if (endPoint.X - startPoint.X >= 0)
            {
                #region Control Right Side
                e.Complete();
                e.Handled = true;
                #endregion
            }

            if (endPoint.X - startPoint.X < 0)
            {
                #region Control Left Side
                e.Complete();
                e.Handled = true;
                #endregion
            }
        }
コード例 #22
0
ファイル: Touch.cs プロジェクト: mrossmann/Tutorials
    void ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
    {
        var rectangle = (Rectangle)e.Source;
        var transform = (MatrixTransform)rectangle.RenderTransform;
        var matrix    = transform.Matrix;

        float rotation     = e.DeltaManipulation.Rotation * Mathf.Deg2Rad;
        float originX      = e.ManipulationOrigin.X;
        float originY      = e.ManipulationOrigin.Y;
        float scale        = e.DeltaManipulation.Scale;
        float translationX = e.DeltaManipulation.Translation.X;
        float translationY = e.DeltaManipulation.Translation.Y;

        matrix.RotateAt(rotation, originX, originY);
        matrix.ScaleAt(scale, scale, originX, originY);
        matrix.Translate(translationX, translationY);

        transform.Matrix = matrix;
        e.Handled        = true;
    }
コード例 #23
0
        private void centerImageView_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            // get current matrix of the element.
            Matrix borderMatrix = ((MatrixTransform)MapImage.RenderTransform).Matrix;
            //determine if action is zoom or pinch
            var maxScale = Math.Max(e.DeltaManipulation.Scale.X, e.DeltaManipulation.Scale.Y);

            //check if not crossing minimum and maximum zoom limit
            if ((maxScale < 1 && borderMatrix.M11 * maxScale > 0) ||
                (maxScale > 1 && borderMatrix.M11 * maxScale < 100))
            {
                //scale to most recent change (delta) in X & Y
                borderMatrix.ScaleAt(e.DeltaManipulation.Scale.X,
                                     e.DeltaManipulation.Scale.Y,
                                     MapImage.ActualWidth / 2,
                                     MapImage.ActualHeight / 2);
                //render new matrix
                MapImage.RenderTransform = new MatrixTransform(borderMatrix);
            }
        }
コード例 #24
0
        static void panZoomPanel_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            PanZoomPanel panZoomPanel = sender as PanZoomPanel;

            if (panZoomPanel != null)
            {
                var scale = e.DeltaManipulation.Scale;

                if (scale.X != 1 && scale.Y != 1)
                {
                    var zoomfactor = 1 - (scale.Length / Math.Sqrt(2));
                    panZoomPanel.Zoom -= zoomfactor;
                }
                else
                {
                    panZoomPanel.OffsetX += e.DeltaManipulation.Translation.X;
                    panZoomPanel.OffsetY += e.DeltaManipulation.Translation.Y;
                }
            }
        }
コード例 #25
0
ファイル: Flip.xaml.cs プロジェクト: mvkolos/BM
        void GridMovementDelta(object sender, ManipulationDeltaEventArgs e)
        {
            Point currentpoint = e.ManipulationOrigin;

            System.Diagnostics.Debug.WriteLine(currentpoint.X - initialpoint.X);


            if (currentpoint.X - initialpoint.X >= 500)    //500 is the threshold value, where you want to trigger the swipe right event
            {
                System.Diagnostics.Debug.WriteLine("Swipe Right");
                //TabControl.SpinToPrevious();
                e.Complete();
            }
            if (currentpoint.X - initialpoint.X <= -500)
            {
                System.Diagnostics.Debug.WriteLine("Swipe Left");
                //TabControl.SpinToPrevious();
                e.Complete();
            }
        }
コード例 #26
0
ファイル: Ventana2.xaml.cs プロジェクト: Arthyom/C-Xmpls
        // manipular el rectangulo, el evento delta se llama cuando se mueve el dedo por un dispositivo tactil o se levanta el dedo
        private void Window_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            Rectangle Rget       = e.OriginalSource as Rectangle;
            Matrix    RgetMatrix = ((MatrixTransform)Rget.RenderTransform).Matrix;

            /// rotar el rectangulo de creacion
            RgetMatrix.RotateAt(e.DeltaManipulation.Rotation, e.ManipulationOrigin.X, e.ManipulationOrigin.Y);

            /// redimencionar el rectangulo
            RgetMatrix.ScaleAt(e.DeltaManipulation.Scale.X, e.DeltaManipulation.Scale.Y, e.ManipulationOrigin.X, e.ManipulationOrigin.Y);

            // mover el rectangulo
            RgetMatrix.Translate(e.DeltaManipulation.Translation.X, e.DeltaManipulation.Translation.Y);

            // aplicar los cambios al rectangulo
            Rget.RenderTransform = new MatrixTransform(RgetMatrix);

            Rect contenedor = new Rect(((FrameworkElement)e.ManipulationContainer).RenderSize);
            Rect formsLado  = Rget.RenderTransform.TransformBounds(new Rect(Rget.RenderSize));
        }
コード例 #27
0
        /// <summary>
        /// <inheritdoc/>
        /// </summary>
        protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
        {
            if (e != null && e.CumulativeManipulation != null)
            {
                if ((e.Manipulators.Count() == 1 || e.IsInertial) && !_zoomManipulationActive)
                {
                    HorizontalOffset = _startManipulationHorizontalOffset - e.CumulativeManipulation.Translation.X;
                    VerticalOffset   = _startManipulationVerticalOffset - e.CumulativeManipulation.Translation.Y;
                }
                else if (e.Manipulators.Count() == 2)
                {
                    _zoomManipulationActive = true;
                    var factor  = (e.CumulativeManipulation.Scale.X + e.CumulativeManipulation.Scale.Y) / 2;
                    var newZoom = _startManipulationZoom * factor;
                    PDFZoomComponent.CurrentZoomFactor = newZoom;
                }
            }

            base.OnManipulationDelta(e);
        }
コード例 #28
0
        protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
        {
            base.OnManipulationDelta(e);

            if (e.PinchManipulation == null)
            {
                bool isZoomed = SelectedIndex >= 0 && _containers[_displayedContainerIndex].IsZoomedIn;
                if (!isZoomed && _state == FlipperState.Initialized && ItemsSource.Count > 0)
                {
                    _state = FlipperState.Dragging;
                    DragStartedEventHandler();
                }

                if (_state == FlipperState.Dragging || _state == FlipperState.DraggingAndSquishing)
                {
                    _dragState.GotDragDelta = true;
                    ProcessDragDelta(e.DeltaManipulation.Translation.X, e.DeltaManipulation.Translation.Y);
                }
            }
        }
コード例 #29
0
        private static void OnPinchCompleted(ManipulationDeltaEventArgs lastPinchInfo, bool gestureCompleted = false)
        {
            var transformToRoot = GetInverseTransform(true, lastPinchInfo.ManipulationContainer);
            var originalPrimary = transformToRoot.Transform(_previousDelta.PinchManipulation.Original.PrimaryContact);
            var currentPrimary  = transformToRoot.Transform(_previousDelta.PinchManipulation.Current.PrimaryContact);

            RaiseGestureEvent(
                (handler) => handler.PinchCompleted,
                () => new Microsoft.Phone.Controls.PinchGestureEventArgs(
                    originalPrimary,
                    transformToRoot.Transform(_previousDelta.PinchManipulation.Original.SecondaryContact),
                    currentPrimary,
                    transformToRoot.Transform(_previousDelta.PinchManipulation.Current.SecondaryContact)),
                false);

            if (gestureCompleted)
            {
                OnGestureComplete(originalPrimary, currentPrimary);
            }
        }
コード例 #30
0
ファイル: Touch.cs プロジェクト: nastajus/Tutorials
    void ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
    {
        var rectangle = (Rectangle)e.Source;
        var transform = (MatrixTransform)rectangle.RenderTransform;
        var matrix = transform.Matrix;

        float rotation = e.DeltaManipulation.Rotation * Mathf.Deg2Rad;
        float originX = e.ManipulationOrigin.X;
        float originY = e.ManipulationOrigin.Y;
        float scale = e.DeltaManipulation.Scale;
        float translationX = e.DeltaManipulation.Translation.X;
        float translationY = e.DeltaManipulation.Translation.Y;

        matrix.RotateAt(rotation, originX, originY);
        matrix.ScaleAt(scale, scale, originX, originY);
        matrix.Translate(translationX, translationY);

        transform.Matrix = matrix;
        e.Handled = true;
    }
コード例 #31
0
ファイル: MainPage.xaml.cs プロジェクト: ITSF/WP8Book
        //Behandeln der Manipulationsdaten, die während der des Ziehens des Stackpanels auftreten
        void PhoneApplicationPage_ManupualtionDelta(object sender, ManipulationDeltaEventArgs e)
        {
            e.Handled = true;

            //aktuelle Koordinaten des Stackpanels aktualisieren
            _currentX += e.DeltaManipulation.Translation.X;
            _currentY += e.DeltaManipulation.Translation.Y;


            //ermitteln wo sich die Ränder des bewegten Stackpanels befinden
            double rightCorner  = _currentX + stackForDrag.ActualWidth;
            double leftCorner   = _currentX;
            double bottomCorner = _currentY + stackForDrag.ActualHeight;
            double upperCorner  = _currentY;

            //prüfen, ob Stackpanels außerhalb seines Containers gezogen wurde
            if (rightCorner <= _containerWidth && bottomCorner <= _containerHeight &&
                leftCorner >= 0 && upperCorner >= 0)
            {
                //stackpanel in X-Richtung bewegen
                _translation.X += e.DeltaManipulation.Translation.X;
                _translation.Y += e.DeltaManipulation.Translation.Y;
            }
            else
            {
                //Stackpanel auf den Startpunkt zurücksetzen
                _translation.X = stackForDrag.RenderTransformOrigin.X;
                _translation.Y = stackForDrag.RenderTransformOrigin.Y;

                //aktuelle Position zurücksetzen
                _currentX = 0;
                _currentY = 0;

                //setzen des Status, dass Stackpanel außerhalb seines Containers gezogen wurde
                e.Complete();
            }

            //Ausgabe der aktuellen Koordinaten des Stackpanels
            txt_mouseX.Text = _currentX.ToString();
            txt_mouseY.Text = _currentY.ToString();
        }
コード例 #32
0
ファイル: TiltEffect.cs プロジェクト: amarish-kumar/Jirabox
        /// <summary>
        /// Continues a tilt effect that is currently applied to an element, presumably because
        /// the user moved their finger
        /// </summary>
        /// <param name="element">The element being tilted</param>
        /// <param name="e">The manipulation event args</param>
        static void ContinueTiltEffect(FrameworkElement element, ManipulationDeltaEventArgs e)
        {
            FrameworkElement container = e.ManipulationContainer as FrameworkElement;

            if (container == null || element == null)
            {
                return;
            }

            Point tiltTouchPoint = container.TransformToVisual(element).Transform(e.ManipulationOrigin);

            // If touch moved outside bounds of element, then pause the tilt (but don't cancel it)
            if (new Rect(0, 0, currentTiltElement.ActualWidth, currentTiltElement.ActualHeight).Contains(tiltTouchPoint) != true)
            {
                PauseTiltEffect();
                return;
            }

            // Apply the updated tilt effect
            ApplyTiltEffect(currentTiltElement, e.ManipulationOrigin, currentTiltElementCenter);
        }
コード例 #33
0
 private void PhoneApplicationPage_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
 {
 }
コード例 #34
0
ファイル: SlideView.cs プロジェクト: Biocodr/HearthstoneCards
 void SlideView_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)