예제 #1
0
        private void Button_PreviewTouchDown(object sender, TouchEventArgs e)
        {
            if (touch1 == null)
            {
                touch1 = e.GetTouchPoint(sender as SurfaceButton);
            }
            else
            {
                touch2 = e.GetTouchPoint(sender as SurfaceButton);

                initialDist = touchDist(touch1, touch2);
            }
        }
예제 #2
0
        } //

        public void OnTouchDown(object xSender, TouchEventArgs e)
        {
            Canvas lCanvas = xSender as Canvas;
            if (lCanvas == null) return;

            TouchPoint lTouchPoint = e.GetTouchPoint(lCanvas);
            if (lTouchPoint == null) return;

            myTuple lTuple = _PointA;
            if (lTuple != null)
            {
                if (lTuple.Item1 == e.TouchDevice.Id) return; // this was finger 1, not going to happen anyway as it cannot touchdown twice
                Point lPointA = lTuple.Item2;

                // store second finger; we don't care about its ID, so it could also be finger 3, 4 or 5 ...
                Point lPointB = lTouchPoint.Position;
                _PointB = new myTuple(e.TouchDevice.Id, lPointB);
                RedrawRectangle(lPointA, lPointB);
                return;
            }

            // first finger
            DrawNewRectangle(lCanvas, lTouchPoint.Position, lTouchPoint.TouchDevice.Id);
            return;
        } //
예제 #3
0
 private void RecordTouchDown(object sender, TouchEventArgs e)
 {
     _touchPoints++;
     _recordRotation = true;
     System.Windows.Input.TouchPoint touchPoint = e.GetTouchPoint(this);
     System.Windows.Point point = touchPoint.Position;
     _recordY = point.Y;
     if (_touchPoints == 2)
     {
         if (!_isPlaying)
         {
             channel.PlaySample();
             _isPlaying = true;
         }
         else
         {
             channel.StopSample();
             _isPlaying = false;
         }
         _twoTouchLock = true;
     }
     if (_touchPoints == 1)
     {
         if (channel.IsPlaying())
             channel.Pause();
     }
 }
예제 #4
0
        private async void LessonContainer_TouchDown(object sender, TouchEventArgs e)
        {
            // Forward touch events to container
            //FrameworkElement control = sender as FrameworkElement;
            //control.CaptureTouch(e.TouchDevice);
            if (LayerStackDC.CurrentState.FingerInkingEnabled)
            {
                LessonContainer.IsContentManipulationEnabled = false;
                return;
            }

            // Saves current touch information
            //touchDevices.Add(e.TouchDevice);
            touchOrigin = e.GetTouchPoint(LessonContainer).Position;

            // Disable manipulation/drawing
            //LessonContainer.IsContentManipulationEnabled = false;
            LayerStackDC.ContainerTouchDown();

            // If touch-and-hold (within 10px radius circle, over 500ms)
            if (await TouchHelper.TouchHold(e, LessonContainer, 500, 10))
            {
                // Opens RadialMenu
                LessonContainer.IsContentManipulationEnabled = false;
                LayerStackDC.OpenRadialMenu(LayerStackDC.Viewport.GetViewport(),
                    e.GetTouchPoint(LessonContainer).Position, RadialMenuState.Levels.Main);

                // Un-forward touch events to container
                //control.ReleaseAllTouchCaptures();
            }
        }
예제 #5
0
        private void OnTouchMove(object sender, TouchEventArgs e)
        {
            if (!_AlreadySwiped)
            {

                var touch = e.GetTouchPoint(_ParentControl);

                //right now a swipe is 200 pixels

                //Swipe Left
                if (_TouchStart != null && touch.Position.X > (_TouchStart.Position.X + 200))
                {
                    if (OnSwipeLeft != null)
                        OnSwipeLeft(sender, e);
                    _AlreadySwiped = true;
                    StartTimer();
                }

                //Swipe Right
                if (_TouchStart != null && touch.Position.X < (_TouchStart.Position.X - 200))
                {
                    if (OnSwipeRight != null)
                        OnSwipeRight(sender, e);
                    _AlreadySwiped = true;
                    StartTimer();
                }
            }
            //e.Handled = true;
        }
예제 #6
0
 private void HandleTouch(TouchEventArgs e)
 {
     var visual = GetTouchVisual(e.TouchDevice.Id);
     var point = e.GetTouchPoint(this.fingerCanvas).Position;
     visual.SetValue(Canvas.LeftProperty, point.X);
     visual.SetValue(Canvas.TopProperty, point.Y);
 }
        private void SurfaceWindow_TouchDown(object sender, TouchEventArgs e)
        {
            //test
            Ellipse handRange = new Ellipse();
            handRange.Fill = System.Windows.Media.Brushes.DeepPink;
            handRange.Width = 100;
            handRange.Height = 100;
            TranslateTransform Pos = new TranslateTransform();
            Pos.X = (int)e.GetTouchPoint(this).Position.X;//-this.Width/2;
            Pos.Y = (int)e.GetTouchPoint(this).Position.Y;//-this.Height/2;
            handRange.RenderTransform = null;
            handRange.RenderTransform = Pos;
            // HandRange.
            DrawingCanvas.Children.Add(handRange);

            //testover


            int X = (int)e.GetTouchPoint(this).Position.X;
            int Y = (int)e.GetTouchPoint(this).Position.Y;
            watchingWindow.getHands((int)this.Width, (int)this.Height);
            Console.Out.WriteLine(watchingWindow.GetUser(X, Y, (int)this.Width, (int)this.Height));
            Dictionary<String, System.Drawing.Point> Hands = watchingWindow.getHands(WindowsWidth, WindowsHeight);
            foreach (KeyValuePair<String, System.Drawing.Point> pair in Hands)
            {
                System.Drawing.Point HandPoint = pair.Value;
                String HandString = pair.Key;
                //Console.Out.WriteLine("Hand in " + HandPoint.X + " , " + HandPoint.Y);
                if (HandPoint.X != 0 && HandPoint.Y != 0)
                    if (HandPoint.X < (int)this.Width && HandPoint.Y < (int)this.Height)
                    {
                        Ellipse HandRange = new Ellipse();
                        HandRange.Fill = System.Windows.Media.Brushes.DarkBlue;
                        HandRange.Width = 100;
                        HandRange.Height = 100;
                        TranslateTransform pos = new TranslateTransform();
                        pos.X = HandPoint.X;//-this.Width/2;
                        pos.Y = HandPoint.Y;// -this.Height / 2;
                        HandRange.RenderTransform = null; 
                        HandRange.RenderTransform = pos;
                        // HandRange.
                        
                        DrawingCanvas.Children.Add(HandRange);
                        Console.Out.WriteLine(HandString+" in " + HandPoint.X + " , " + HandPoint.Y);
                    }
            }
        }
예제 #8
0
        public void layoutRoot_TouchDown(object sender, TouchEventArgs e)
        {
            TouchPoint p = e.GetTouchPoint(GestureFramework.LayoutRoot);
            TouchInfo info = p.ToTouchInfo();
            UIElement source = e.OriginalSource as UIElement;

            base.AddNewTouchPoint(info, source);
        }
예제 #9
0
        protected override void OnPreviewTouchDown(TouchEventArgs e)
        {
            //오브젝트 선택
            TouchPoint pt = e.GetTouchPoint(this);
            this.HitTestHelper.SelectItemAt(pt.Position);

            base.OnPreviewTouchDown(e);
        }
예제 #10
0
        private void Slider_TouchDown(object sender, TouchEventArgs e)
        {
            VisualStateManager.GoToState((FrameworkElement)sender, "Pressed", true);

            var slider = (Slider)sender;
            slider.SetPositionByControlPoint(e.GetTouchPoint(slider).Position);
            slider.CaptureTouch(e.TouchDevice);
            e.Handled = true;
        }
예제 #11
0
        private void canvas_TouchMove(object sender, TouchEventArgs e)
        {
            // Get the ellipse that corresponds to the current touch-down.
            Ellipse ellipse = movingEllipses[e.TouchDevice.Id];

            // Move it to the new touch-down point.
            TouchPoint touchPoint = e.GetTouchPoint(canvas);
            Canvas.SetTop(ellipse, touchPoint.Bounds.Top);
            Canvas.SetLeft(ellipse, touchPoint.Bounds.Left);
        }
예제 #12
0
        protected override void OnTouchMove(System.Windows.Input.TouchEventArgs e)
        {
            int        id         = e.TouchDevice.Id;
            TouchPoint touchPoint = e.GetTouchPoint(this);

            System.Diagnostics.Debug.WriteLine(string.Format("id:{0} x:{1} y:{2}", id, touchPoint.Position.X, touchPoint.Position.Y));

            base.OnTouchMove(e);

            e.Handled = true;
        }
 protected override void OnTouchMove(TouchEventArgs e)
 {
     TouchPoint point = e.GetTouchPoint(card.CardControler.MainWindow.CardLayer);
     card.CardControler.MainWindow.TouchControler.TouchMove(this, this.GetType(), e.TouchDevice, point);
     if (STATICS.DEBUG_MODE)
     {
         card.CardControler.MainWindow.ControlWindow.UpdateTextInfo(card.CardControler.MainWindow.TouchControler.ToString(), 1);
     }
     e.Handled = true;
     base.OnTouchMove(e);
 }
 protected override void OnTouchUp(TouchEventArgs e)
 {
     TouchPoint point = e.GetTouchPoint(card.CardControler.MainWindow.CardLayer);
     card.CardControler.MainWindow.TouchControler.TouchUp(e.TouchDevice, point);
     card.CardControler.MainWindow.ControlWindow.UpdateTextInfo(card.CardControler.MainWindow.TouchControler.ToString(), 1);
     Matrix mtx = (this.RenderTransform as MatrixTransform).Matrix;
     mtx.ScaleAt(1.0 / 1.5, 1.0 / 1.5, this.Width / 2, -STATICS.DEAULT_CARD_SIZE.Height + this.Height / 2);
     this.RenderTransform = new MatrixTransform(mtx);
     e.Handled = true;
     base.OnTouchUp(e);
 }
 protected override void OnTouchDown(TouchEventArgs e)
 {
     this.CaptureTouch(e.TouchDevice);
     TouchPoint point = e.GetTouchPoint(card.CardControler.MainWindow.CardLayer);
     card.CardControler.MainWindow.TouchControler.TouchDown(this, this.GetType(), e.TouchDevice.Id, point);
     Matrix mtx = (this.RenderTransform as MatrixTransform).Matrix;
     mtx.ScaleAt(1.5, 1.5, this.Width / 2, this.Height / 2);
     this.RenderTransform = new MatrixTransform(mtx);
     card.CardControler.MainWindow.ControlWindow.UpdateTextInfo(card.CardControler.MainWindow.TouchControler.ToString(), 1);
     e.Handled = true;
     base.OnTouchMove(e);
 }
예제 #16
0
        public bool IsDoubleTap(TouchEventArgs e)
        {
            Point currentTapPosition = e.GetTouchPoint(_ParentControl).Position;
            bool tapsAreCloseInDistance = GetDistanceBetweenPoints(currentTapPosition, _LastTapLocation) < 40;
            _LastTapLocation = currentTapPosition;

            TimeSpan elapsed = _DoubleTapStopwatch.Elapsed;
            _DoubleTapStopwatch.Restart();
            bool tapsAreCloseInTime = (elapsed != TimeSpan.Zero && elapsed < TimeSpan.FromSeconds(0.7));

            return tapsAreCloseInDistance && tapsAreCloseInTime;
        }
예제 #17
0
 private void _channel1MixKnob_TouchMove(object sender, TouchEventArgs e)
 {
     if (_channel1MixDown)
     {
         System.Windows.Input.TouchPoint touchPoint = e.GetTouchPoint(this);
         System.Windows.Point point = touchPoint.Position;
         if (point.Y > _channel1Y)
         {
             trTns1.Y = point.Y - _channel1Y;
             _channel1MixKnob.RenderTransform = trGrp1;
         }
     }
 }
예제 #18
0
 public void TouchDownCard(Canvas element, TouchEventArgs e)
 {
     TouchPoint point = e.GetTouchPoint(control.MainWindow.CardLayer);
     control.TouchControler.TouchDown(element, element.GetType(), e.TouchDevice.Id, point);
     control.MainWindow.ControlWindow.UpdateTextInfo(control.TouchControler.ToString(), 1);
     if (element is Linking_Icon || element is Copy_Icon)
     {
         Matrix mtx = (element.RenderTransform as MatrixTransform).Matrix;
         mtx.ScaleAt(1.5, 1.5, mtx.OffsetX , mtx.OffsetY );
         element.RenderTransform = new MatrixTransform(mtx);
         control.MainWindow.ControlWindow.UpdateTextInfo(control.TouchControler.ToString(), 1);
     }
 }
예제 #19
0
        private void OnTouchMove(object sender, TouchEventArgs e)
        {
            // Get the touch point
            var touchPoint = e.GetTouchPoint(m_Canvas);

            // Retrieve the shape associated with this touch
            var shape = m_Shapes[touchPoint.TouchDevice.Id];
            var translateTransform = (TranslateTransform) shape.RenderTransform;

            // Update shape's position
            translateTransform.X = touchPoint.Position.X - shape.Width / 2;
            translateTransform.Y = touchPoint.Position.Y - shape.Height / 2;

            e.Handled = true;
        }
예제 #20
0
 protected override void OnTouchMove(TouchEventArgs e)
 {
     base.OnTouchMove(e);
     if (e.TouchDevice.Captured == canvas)
     {
         // Находим нужное изображение
         Image fingerprint = fingerprints[e.TouchDevice];
         TranslateTransform transform =
         fingerprint.RenderTransform as TranslateTransform;
         // Перемещаем его в новое место
         TouchPoint point = e.GetTouchPoint(canvas);
         transform.X = point.Position.X;
         transform.Y = point.Position.Y;
     }
 }
예제 #21
0
        private void Canvas1_TouchDown(object sender, TouchEventArgs e)
        {
            var pt = e.GetTouchPoint(Canvas1);

            // 縦線を作ります。
            var lineV = new Line();
            lineV.X1 = lineV.X2 = pt.Position.X;
            lineV.Y1 = 0;
            lineV.Y2 = ActualHeight;
            lineV.Stroke = Brushes.Red;
            Canvas1.Children.Add(lineV);
            lineVList[e.TouchDevice] = lineV;

            // 横線を作ります。
            var lineH = new Line();
            lineH.X1 = 0;
            lineH.X2 = ActualWidth;
            lineH.Y1 = lineH.Y2 = pt.Position.Y;
            lineH.Stroke = Brushes.Red;
            Canvas1.Children.Add(lineH);
            lineHList[e.TouchDevice] = lineH;

            // 円を作ります。
            var ellipse = new Ellipse();
            ellipse.Width = 50;
            ellipse.Height = 50;
            ellipse.Fill = Brushes.Blue;
            ellipse.RenderTransform
                = new TranslateTransform(pt.Position.X - ellipse.RenderSize.Width / 2,
                                           pt.Position.Y - ellipse.RenderSize.Height / 2);
            Canvas1.Children.Add(ellipse);
            ellipseList[e.TouchDevice] = ellipse;

            // idを表すラベルを作ります。
            var label = new Label();
            label.Foreground = Brushes.White;
            label.FontSize = 36;
            label.Content = e.TouchDevice.Id;
            label.RenderTransform = new TranslateTransform(pt.Position.X - label.RenderSize.Width / 2,
                                           pt.Position.Y - label.RenderSize.Height / 2);
            Canvas1.Children.Add(label);
            labelList[e.TouchDevice] = label;

            Canvas1.InvalidateVisual();

            Canvas1.CaptureTouch(e.TouchDevice);
        }
        private void TextEditor_TouchUp(object sender, System.Windows.Input.TouchEventArgs e)
        {
            var endPoint = e.GetTouchPoint(TextEditor);
            int start, length;

            if (endPoint.Position.Y > _startPoint.Position.Y)
            {
                start  = TextEditor.GetCharacterIndexFromPoint(_startPoint.Position, true);
                length = TextEditor.GetCharacterIndexFromPoint(endPoint.Position, true) - start;
            }
            else
            {
                start  = TextEditor.GetCharacterIndexFromPoint(endPoint.Position, true);
                length = TextEditor.GetCharacterIndexFromPoint(_startPoint.Position, true) - start + 1;
            }
            TextEditor.Select(start, length);
        }
예제 #23
0
 private void MainWindow_TouchMove(object sender, System.Windows.Input.TouchEventArgs e)
 {
     if (this.touchDownPoint.HasValue)
     {
         Point pos = e.GetTouchPoint(this).Position;
         if (this.touchDownPoint.Value.X - pos.X >= 200)
         {
             this.DrillUp();
             this.touchDownPoint = null;
         }
         else if (pos.X - this.touchDownPoint.Value.X >= 200)
         {
             this.DrillDown();
             this.touchDownPoint = null;
         }
     }
 }
예제 #24
0
        /// <summary>
        /// Returns an awaitable Task that transform a TouchDown event in a TouchDown&Hold event
        /// </summary>
        /// <param name="originalEvent">Original TouchDown event</param>
        /// <param name="element">Original touched Control</param>
        /// <param name="msDuration">Duration before considering the TouchDown event as a TouchDown&Hold event</param>
        /// <param name="pxDelta">Circle radius in witch the TouchDown event must stay to be considered as a TouchDown&Hold event</param>
        /// <returns>Returns an awaitable Task that returns a Boolean</returns>
        public static Task<bool> TouchHold(TouchEventArgs originalEvent, FrameworkElement element, int msDuration,
            int pxDelta)
        {
            var originalPosition = originalEvent.GetTouchPoint(element).Position;
            var task = new TaskCompletionSource<bool>();
            var timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromMilliseconds(msDuration);

            EventHandler<TouchEventArgs> touchUpHandler = (o, e) =>
            {
                timer.Stop();
                if (task.Task.Status == TaskStatus.Running)
                {
                    task.SetResult(false);
                }
            };

            EventHandler<TouchEventArgs> touchMoveHandler = (o, e) =>
            {
                var currentPosition = e.GetTouchPoint(element).Position;
                if (Distance(currentPosition, originalPosition) > pxDelta)
                {
                    timer.Stop();
                    if (task.Task.Status == TaskStatus.Running)
                    {
                        task.SetResult(false);
                    }
                }
            };

            element.PreviewTouchUp += touchUpHandler;
            element.PreviewTouchMove += touchMoveHandler;

            timer.Tick += delegate
            {
                element.PreviewTouchUp -= touchUpHandler;
                element.PreviewTouchUp -= touchMoveHandler;
                timer.Stop();
                task.SetResult(true);
            };

            timer.Start();
            return task.Task;
        }
예제 #25
0
 protected override void OnTouchDown(TouchEventArgs e)
 {
     base.OnTouchDown(e);
     // Захватываем данное сенсорное устройство
     canvas.CaptureTouch(e.TouchDevice);
     // Создаем новое изображение для этого касания
     Image fingerprint = new Image
     {
         Source = new BitmapImage(
             new Uri("fingerprint.png"))
     };
     // Перемещаем изображение в точку касания
     TouchPoint point = e.GetTouchPoint(canvas);
     fingerprint.RenderTransform = new TranslateTransform(
     point.Position.X, point.Position.Y);
     // Запоминаем изображение и помещаем его на холст
     fingerprints[e.TouchDevice] = fingerprint;
     canvas.Children.Add(fingerprint);
 }
예제 #26
0
            private void TouchMove(object sender, TouchEventArgs e)
            {
                if (_mixerKnob.IsPressed())
                {
                    System.Windows.Input.TouchPoint touchPoint = e.GetTouchPoint(this);
                    System.Windows.Point point = touchPoint.Position;

                    double deltaY = point.Y - _touchPoint.Y;
                    
                    if (translate.Y <= SLIDERHEIGHT && translate.Y >= 0)
                    {
                        translate.Y += deltaY;
                        _mixerKnob.RenderTransform = transform;
                    }
                    if (translate.Y < 0) translate.Y = 0;
                    if (translate.Y > SLIDERHEIGHT) translate.Y = SLIDERHEIGHT;
                    _touchPoint = point;
                }
            }
예제 #27
0
        private void canvas_TouchDown(object sender, TouchEventArgs e)
        {
            // Create an ellipse to draw at the new touch-down point.
            Ellipse ellipse;
            ellipse = new Ellipse();
            ellipse.Width = 30;
            ellipse.Height = 30;
            ellipse.Stroke = Brushes.White;
            ellipse.Fill = Brushes.Green;

            // Position the ellipse at the touch-down point.
            TouchPoint touchPoint = e.GetTouchPoint(canvas);
            Canvas.SetTop(ellipse, touchPoint.Bounds.Top);
            Canvas.SetLeft(ellipse, touchPoint.Bounds.Left);

            // Store the ellipse in the active collection.
            movingEllipses[e.TouchDevice.Id] = ellipse;

            // Add the ellipse to the Canvas.
            canvas.Children.Add(ellipse);
        }
        private void TouchMove(object sender, TouchEventArgs e)
        {
            if (_mixerKnob.IsPressed())
            {
                System.Windows.Input.TouchPoint touchPoint = e.GetTouchPoint(this);
                System.Windows.Point point = touchPoint.Position;

                double deltaY = point.Y - _touchPoint.Y;

                if (translate.Y <= SLIDERBOTTOM && translate.Y >= 0)
                {
                    translate.Y += deltaY;
                    _mixerKnob.RenderTransform = transform;
                }
                //if the slider is at the top or bottom, set its transform(don't mess up the logic)
                if (translate.Y < 0) translate.Y = 0;
                if (translate.Y > SLIDERBOTTOM) translate.Y = SLIDERBOTTOM;

                //now convert the transform position into something useful
                //say volume control

                //control favors right deck
                if (translate.Y > midPoint)
                {
                    if (deck2.IsPlaying()) deck2.SetVolume(1.0f);
                    ratio = (halfLength - (translate.Y - midPoint)) / halfLength;
                    if (deck1.IsPlaying()) deck1.SetVolume((float)ratio);
                }

                //control favors left deck
                if(translate.Y < midPoint)
                {
                    if(deck1.IsPlaying()) deck1.SetVolume(1.0f);
                    ratio = (halfLength - (midPoint - translate.Y)) / halfLength;
                    if (deck2.IsPlaying()) deck2.SetVolume((float)ratio);
                }

                _touchPoint = point;
            }
        }
예제 #29
0
        private void OnTouchDown(object sender, TouchEventArgs e)
        {
            // Get the touch point
            var touchPoint = e.GetTouchPoint(m_Canvas);

            // Get the touch size
            var touchSize = touchPoint.Size;

            // If the touch device does not return proper size of the touch, create the shape with a default size
            var shapeSize = (touchSize.IsEmpty || touchSize.Height == 0.0 || touchSize.Width == 0.0)
                           ? new Size(100, 100)
                           : touchSize;

            // Create the shape
            var shape = GetShape(touchPoint.Position.X, touchPoint.Position.Y, shapeSize);

            // Stash the shape and add it to the canvas
            m_Shapes.Add(touchPoint.TouchDevice.Id, shape);
            m_Canvas.Children.Add(shape);

            e.Handled = true;
        }
예제 #30
0
        protected override void OnTouchMove(TouchEventArgs e)
        {
            base.OnTouchMove(e);
            TouchPoint tp = e.GetTouchPoint(this.mainCanvas);
            if (lastPoint == tp.Position)
            {
                return;
            }
            if (lastPoint == new System.Windows.Point())
            {
                lastPoint = tp.Position;
                return;
            }
            Line _line = new Line();
            _line.Stroke = new RadialGradientBrush(Colors.White, Colors.Black);
            _line.X1 = lastPoint.X;
            _line.X2 = tp.Position.X;
            _line.Y1 = lastPoint.Y;
            _line.Y2 = tp.Position.Y;

            _line.StrokeThickness = 2;
            mainCanvas.Children.Add(_line);
            lastPoint = tp.Position;
        }
        private void myCanvas_TouchMove(object sender, TouchEventArgs e)
        {
            //tpCurr = e.GetTouchPoint(this);

            int tempId = e.TouchDevice.Id;
            Point tempPoint = e.GetTouchPoint(this).Position;

            currTouches.Add(tempId, tempPoint);

            draw(Brushes.Black, prevTouches[tempId], currTouches[tempId], 3);

            prevTouches[tempId] = currTouches[tempId];

            // set prev touch collect to current
            //tpPrev = tpCurr;
        }
        private void myCanvas_TouchDown(object sender, TouchEventArgs e)
        {
            //tpPrev = e.GetTouchPoint(this);

            // Store the touch id and the touch location
            int tempId = e.TouchDevice.Id;
            Point tempPoint = e.GetTouchPoint(this).Position;

            prevTouches.Add(tempId, tempPoint);
        }
예제 #33
0
        void XamlCanvas_TouchMove(object sender, TouchEventArgs e)
        {
            var id = new IntPtr (e.TouchDevice.Id);
            CanvasTouch t;
            if (!_activeTouches.TryGetValue (id, out t)) return;

            t.SuperCanvasPreviousLocation = t.SuperCanvasLocation;
            t.CanvasPreviousLocation = t.CanvasLocation;
            t.PreviousTime = t.Time;

            var spt = e.GetTouchPoint ((FrameworkElement)Parent);
            var pt = e.GetTouchPoint (this);
            t.CanvasLocation = new PointF ((float)pt.Position.X, (float)pt.Position.Y);
            t.SuperCanvasLocation = new PointF ((float)spt.Position.X, (float)spt.Position.Y);
            t.Time = DateTime.UtcNow;

            if (Content != null) {
                Content.TouchesMoved (new[] { t });
            }
        }
 private void TextEditor_TouchDown(object sender, System.Windows.Input.TouchEventArgs e)
 {
     _startPoint = e.GetTouchPoint(TextEditor);
 }
예제 #35
0
 private void MainWindow_TouchDown(object sender, System.Windows.Input.TouchEventArgs e)
 {
     this.touchDownPoint = e.GetTouchPoint(this).Position;
 }
 private void ScrollViewer_TouchDown(object sender, System.Windows.Input.TouchEventArgs e)
 {
     LastPosition = e.GetTouchPoint(this.TextBlockTitulo).Position;
 }