private void gesture_PinchStarted(object sender, PinchStartedGestureEventArgs e)
 {
     var point = e.GetPosition(ContentPanel, 0);
     var point2 = e.GetPosition(ContentPanel, 1);
     message.Text = string.Format("pinch started at ({0},{1}) and ({1},{2}) with angle {3} and distance {4}",
         point.X, point.Y, point2.X, point2.Y, e.Angle, e.Distance);
     flickMessage.Text = null;
 }
コード例 #2
0
ファイル: FacPage.xaml.cs プロジェクト: nuieee/win-rt-feup
 private void OnPinchStarted(object sender, PinchStartedGestureEventArgs e)
 {
     Point point0 = e.GetPosition(image, 0);
     Point point1 = e.GetPosition(image, 1);
     Point midpoint = new Point((point0.X + point1.X) / 2, (point0.Y + point1.Y) / 2);
     image.RenderTransformOrigin = new Point(midpoint.X / image.ActualWidth, midpoint.Y / image.ActualHeight);
     //initialAngle = transform.Rotation;
     initialScale = transform.ScaleX;
     image.Opacity = 0.8;
 }
コード例 #3
0
ファイル: ComicPage.xaml.cs プロジェクト: rv1/XKCD_Browser
        private void GestureListener_PinchStarted(object sender, PinchStartedGestureEventArgs e)
        {
            // Store the initial rotation angle and scaling
            InitialScale = ImageTransformation.ScaleX;
            // Calculate the center for the zooming
            System.Windows.Point firstTouch = e.GetPosition(ComicImage, 0);
            System.Windows.Point secondTouch = e.GetPosition(ComicImage, 1);

            Center = new System.Windows.Point(firstTouch.X + (secondTouch.X - firstTouch.X) / 2.0, firstTouch.Y + (secondTouch.Y - firstTouch.Y) / 2.0);
        }
コード例 #4
0
        private void OnPinchStarted(object sender, PinchStartedGestureEventArgs e)
        {
            _initialAngle = MyMustacheTransformation.Rotation;
            _initialScale = MyMustacheTransformation.ScaleX;

            Point firstTouch = e.GetPosition(myMustache, 0);
            Point secondTouch = e.GetPosition(myMustache, 1);

            Point center = new Point(firstTouch.X + (secondTouch.X - firstTouch.X) / 2.0,
                                        firstTouch.Y + (secondTouch.Y - firstTouch.Y) / 2.0);

            MyMustacheTransformation.CenterX = center.X;
            MyMustacheTransformation.CenterY = center.Y;
        }
コード例 #5
0
ファイル: ImageBrowse.xaml.cs プロジェクト: chwzou/WP7Fanfou
        private void OnGestureListenerPinchStarted(object sender, PinchStartedGestureEventArgs args)
        {
            _isPinching = args.OriginalSource == image;

            if (_isPinching)
            {
                // Set transform centers
                Point ptPinchCenter = args.GetPosition(image);
                ptPinchCenter = previousTransform.Transform(ptPinchCenter);

                scaleTransform.CenterX = ptPinchCenter.X;
                scaleTransform.CenterY = ptPinchCenter.Y;

                rotateTransform.CenterX = ptPinchCenter.X;
                rotateTransform.CenterY = ptPinchCenter.Y;

                _ptPinchPositionStart = args.GetPosition(this);
            }
        }
コード例 #6
0
ファイル: Maps.xaml.cs プロジェクト: CodeObsessed/drumbleapp
 /// <summary>
 /// Initializes the zooming operation
 /// </summary>
 private void OnPinchStarted(object sender, PinchStartedGestureEventArgs e)
 {
     _oldFinger1 = e.GetPosition(ImgZoom, 0);
     _oldFinger2 = e.GetPosition(ImgZoom, 1);
     _oldScaleFactor = 1;
 }
コード例 #7
0
        private void gestureListener_PinchStarted(object sender, PinchStartedGestureEventArgs e)
        {
            if (imageMan == null)
                return;

            Interlocked.CompareExchange(ref zooming, 1, 0);
            _oldFinger1 = e.GetPosition(image, 0);
            _oldFinger2 = e.GetPosition(image, 1);
            _oldScaleFactor = 1;
            image.Source = imageMan.finalImage;
        }
コード例 #8
0
        private void OnPinchStarted(object sender, PinchStartedGestureEventArgs e)
        {
            if (isAnimating)
                return; 

            oldFinger1 = e.GetPosition(_content, 0);
            oldFinger2 = e.GetPosition(_content, 1);
            oldScaleFactor = 1;
            e.Handled = true; 
        }
コード例 #9
0
        void OnGestureListenerPinchStarted(object sender, PinchStartedGestureEventArgs args)
        {
            isPinching = true;

            //yve : remove current annotation
            CurrentAnnotationCanvas.Children.Clear();
            _manipulating = false;
            _polyline = null;

            if (isPinching)
            {
                // Set transform centers
                Point ptPinchCenter = args.GetPosition(OriginalImage);
                ptPinchCenter = previousTransform.Transform(ptPinchCenter);

                scaleTransform.CenterX = ptPinchCenter.X;
                scaleTransform.CenterY = ptPinchCenter.Y;

                ptPinchPositionStart = args.GetPosition(this);
            }
        }
コード例 #10
0
 void gestures_PinchStarted(object sender, PinchStartedGestureEventArgs e)
 {
     _oldFinger1 = e.GetPosition(theThingToZoom, 0);
     _oldFinger2 = e.GetPosition(theThingToZoom, 1);
     _oldScaleFactor = 1;
 }
コード例 #11
0
 /// <summary>
 /// Pinch started
 /// </summary>
 /// <param name="sender">Event sender</param>
 /// <param name="e">Event parameter</param>
 void GestureListener_PinchStarted(
         object sender,
         PinchStartedGestureEventArgs e)
 {
   _pinchdownmat = _mat;
   _pinchdown = _mat.Transform(e.GetPosition(_img));
 }
コード例 #12
0
 private void GestureListener_PinchStarted(object sender, PinchStartedGestureEventArgs e)
 {
     _oldFinger1 = e.GetPosition(ZoomableImage, 0);
     _oldFinger2 = e.GetPosition(ZoomableImage, 1);
     _oldScaleFactor = 1;
 }
コード例 #13
0
        // we only need to keep track of translation
        // and for translation, we only care about the middle
        // position of the two fingers
        // OK, so the correct translation/scale we want to perform is:
        //
        //    1. move the initial middle of the two finger back to the initial translation
        //    2. scale up by the current scaling
        //    3. move back to the current middle of the two fingers
        //
        // If,
        //       if1, if2: are the initial finger touch
        //       translationRef:  is the initial translation
        //       s: is the current scaling factor [this is e.DistanceRatio]
        //              e.DistanceRaio is the currentDistanceBetweenFingers/initDistanceBetweenFingers
        //       cf1, cf1: is the current finger position
        //
        // what we want is:
        //
        //       im = 0.5 * (if1 + if2)             <-- middle position of the two initial finger position
        //       deltaVec = translationRef - im   <-- translate back by im
        //       cm = 0.5 * (cf1 + cf2)             <-- middle position of the two current finger position
        //
        // Translation:  cm + (deltaVec * s)
        //
        private void GestureListener_PinchStarted(object sender, PinchStartedGestureEventArgs e)
        {
            Point if1 = e.GetPosition(this.mImageRectangle, 0);      // position of first finger
            Point if2 = e.GetPosition(this.mImageRectangle, 1);      // position of second finger
            Point im = new Point((0.5f * (if1.X + if2.X)),      // middle between the two fingers
                                 (0.5f * (if1.Y + if2.Y)));

            CompositeTransform t = this.imageToShow.Transform as CompositeTransform;
            this.translationRef.X = t.TranslateX;
            this.translationRef.Y = t.TranslateY;
            this.scaleRef = t.ScaleX;  // X and Y scales are always the same in our case

            // deltaVec will take the middle of initial touch position to the
            // initial translation position. This will give the proper effect of
            // scaling with respect to the initial touch position
            this.deltaVec.X = this.translationRef.X - im.X;
            this.deltaVec.Y = this.translationRef.Y - im.Y;
        }
コード例 #14
0
        /// <summary>
        /// Initializes the zooming operation
        /// </summary>
        private static void OnPinchStarted(object sender, PinchStartedGestureEventArgs e)
        {
            ImageZoomerSettings settings;
             Image image = sender as Image;

             if (image == null)
            return;

             if (Images.TryGetValue(image, out settings))
             {
            settings.oldFinger1 = e.GetPosition(image, 0);
            settings.oldFinger2 = e.GetPosition(image, 1);
            settings.oldScaleFactor = 1;
             }
        }
コード例 #15
0
 private void OnPinchStarted(object s, PinchStartedGestureEventArgs e)
 {
     _oldFinger1 = e.GetPosition(bigPicture, 0);
     _oldFinger2 = e.GetPosition(bigPicture, 1);
     _oldScaleFactor = 1;
 }
コード例 #16
0
        private void GestureListener_PinchStarted(object sender, PinchStartedGestureEventArgs e)
        {
            // store the initial rotation angle and scaling
            initialScale = ImageTransformation.ScaleX;
            // calculate the center for the zooming
            Point firstTouch = e.GetPosition(DetailImage, 0);
            Point secondTouch = e.GetPosition(DetailImage, 1);

            double centerX = firstTouch.X + (secondTouch.X - firstTouch.X) / 2.0;
            double centerY = firstTouch.Y + (secondTouch.Y - firstTouch.Y) / 2.0;

            center = new Point(centerX, centerY);

            _oldFinger1 = e.GetPosition(DetailImage, 0);
            _oldFinger2 = e.GetPosition(DetailImage, 1);
            _oldScaleFactor = 1;
        }
コード例 #17
0
 private void OnPinchStarted(object s, PinchStartedGestureEventArgs e)
 {
     _fingerOne = e.GetPosition(MyImage, 0);
     _fingerTwo = e.GetPosition(MyImage, 1);
     _previousScale = 1;
 }