private void DrawingBoard_PointerMoved(object sender, PointerRoutedEventArgs e) { lock (_renderer) { _renderer.OnPointerMoved(e.GetIntermediatePoints(DrawingControl)); } DrawingControl.Invalidate(); }
void OnPointerPressed(object sender, PointerRoutedEventArgs e) { var ps = e.GetIntermediatePoints(null); if (ps != null && ps.Count > 0) { _holdObj = sender; gestRec.ProcessDownEvent(ps[0]); e.Handled = true; } }
void OnPointerReleased(object sender, PointerRoutedEventArgs e) { var ps = e.GetIntermediatePoints(null); if (ps != null && ps.Count > 0) { gestRec.ProcessUpEvent(ps[0]); e.Handled = true; gestRec.CompleteGesture(); _holdObj = null; } }
private void OnPointerMoved(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs args) { if (args.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Pen) { return; } // Route the events to the gesture recognizer. // All intermediate points are passed to the gesture recognizer in // the coordinate system of the reference element. _gestureRecognizer.ProcessMoveEvents(args.GetIntermediatePoints(_reference)); // Mark event handled, to prevent execution of default event handlers args.Handled = true; }
// Route the pointer moved event to the gesture recognizer. // The points are in the reference frame of the canvas that contains the rectangle element. void OnPointerMoved(object sender, PointerRoutedEventArgs args) { // Feed the set of points into the gesture recognizer as a move event recognizer.ProcessMoveEvents(args.GetIntermediatePoints(reference)); }
/// <summary> /// Handles the pointer moved event. If the pointer is pressed and has moved it will /// draw the line on the canvas and add the points drawn to the points list /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void inkPresenter_OnPointerMoved(object sender, PointerRoutedEventArgs e) { if (!pressed) return; var positions = e.GetIntermediatePoints(this).Select(ppt => ppt.Position); var currentPosition = e.GetCurrentPoint(this).Position; //Only add points if previous and current positions are different if (positions.Any() && currentPosition.X != previousPosition.X && currentPosition.Y != previousPosition.Y) { points.Add(new List<Point>()); points.Last().Add(previousPosition); foreach (Point pt in positions) { this.inkPresenter.Children.Add( new Line() { X1 = previousPosition.X, Y1 = previousPosition.Y, X2 = pt.X, Y2 = pt.Y, Stroke = this.Stroke, StrokeThickness = this.StrokeWidth } ); previousPosition = pt; } points.Last().AddRange(positions); } }
void Canvas_PointerMoved(object sender, PointerRoutedEventArgs e) { if (editingRegion == null) return; // Add points to the edit region. regionPoints.AddRange(from point in e.GetIntermediatePoints(canvas) select ConvertDipsToPixels(point)); canvas.Invalidate(); e.Handled = true; }
static void page_PointerMoved(object sender, PointerRoutedEventArgs e) { _gr.ProcessMoveEvents(e.GetIntermediatePoints(null)); e.Handled = true; if (OnGestureRaised != null) OnGestureRaised(sender, new CustomGestureArgs() { MovedPointerRoutedEventArgs = e }); }
private void OnPointerMoved(object sender, PointerRoutedEventArgs e) { lock (touchPointsRenderer) { touchPointsRenderer.OnPointerMoved(e.GetIntermediatePoints(animatedControl)); } animatedControl.Invalidate(); }
void OnPointerMoved(object sender, PointerRoutedEventArgs e) { _holdObj = sender; gestRec.ProcessMoveEvents(e.GetIntermediatePoints(null)); e.Handled = true; }
private void Element_PointerMoved(object sender, PointerRoutedEventArgs e) { this.gestureRecognizer.ProcessMoveEvents(e.GetIntermediatePoints(this.element)); }
void OnPointerMoved(object sender, PointerRoutedEventArgs args) { // Pass all intermediate points to the gesture recognizer. recognizer.ProcessMoveEvents(args.GetIntermediatePoints(Rect1)); }
private void OnPointerMoved(object sender, PointerRoutedEventArgs args) { Gesture.ProcessMoveEvents(args.GetIntermediatePoints(this.Parent as UIElement)); args.Handled = true; }
private void GestureRecognizerDemo_PointerMoved(object sender, PointerRoutedEventArgs e) { // 告诉 GestureRecognizer 指针移动中,以便 GestureRecognizer 做手势监测 _gestureRecognizer.ProcessMoveEvents(e.GetIntermediatePoints(null)); }
void OnPointerMoved(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs args) { this.gestureRecognizer.ProcessMoveEvents(args.GetIntermediatePoints(this.reference)); args.Handled = true; }
private void OnPointerMoved(object sender, PointerRoutedEventArgs e) { _gr.ProcessMoveEvents(e.GetIntermediatePoints(null)); e.Handled = true; }
void OnPointerMoved( object sender, PointerRoutedEventArgs e) { _gr.ProcessMoveEvents( e.GetIntermediatePoints(_window)); PointerPoint pointer = e.GetCurrentPoint(_window); if (_pointers.ContainsKey(pointer.PointerId)) _pointers[pointer.PointerId] = pointer; switch (_pointerMode) { case PointerMode.kBeginDragMode: _previousPointerPos = pointer.Position; _pointerMode = PointerMode.kDragMode; break; case PointerMode.kDragMode: double xOffset = _previousPointerPos.X - pointer.Position.X; double yOffset = _previousPointerPos.Y - pointer.Position.Y; _dragDistance += GetDistance( _previousPointerPos, pointer.Position); _previousPointerPos = pointer.Position; _renderer.Rotate( (float)xOffset, (float)yOffset); break; case PointerMode.kScaleMode: var pointers = _pointers.Values.ToList(); double dist = GetDistance( ToDeviceCoordinate(pointers[0].RawPosition), ToDeviceCoordinate(pointers[1].RawPosition)); double accZoom = _accumulator.Accumulate(dist); _renderer.SetZoom((float)accZoom * 5.0f / 1000.0f); break; case PointerMode.kIdleMode: Point pos = ToDeviceCoordinate( pointer.RawPosition); _renderer.CheckPreSelection( (float)pos.X, (float)pos.Y); break; default: break; } }
private void canvas右邊手寫畫板_PointerMoved(object sender, PointerRoutedEventArgs e) { if (this.正在手寫中 == false) { return; } if (e.Pointer.PointerId == PenID || e.Pointer.PointerId == TouchID) { foreach (PointerPoint pointerPoint in e.GetIntermediatePoints(this.canvas右邊手寫畫板).Reverse()) { CurrentContactPoint = pointerPoint.Position; X1 = PreviousContactPoint.X; Y1 = PreviousContactPoint.Y; X2 = CurrentContactPoint.X; Y2 = CurrentContactPoint.Y; if (this.使用中的繪圖工具.手或筆與橡皮擦 == 手或筆與橡皮擦.筆) { 手寫物件軌跡_右.手寫物件s.Add(new 手寫物件() { //X1 = LastX, X1 = X1, X2 = X2, //Y1 = LastY, Y1 = Y1, Y2 = Y2, }); } else { 手寫物件軌跡_右.手寫物件s.Add(new 手寫物件() { X1 = X1, X2 = X2, Y1 = Y1, Y2 = Y2, }); } //LastX = CurrentContactPoint.X; //LastY = CurrentContactPoint.Y; PreviousContactPoint = CurrentContactPoint; } Redraw右邊手寫板(); } }
// Toggles the color of cells when they are clicked on. private void ProcessPointerInput(PointerRoutedEventArgs e) { if (!isPointerDown) return; // Invert the display transform, to convert pointer positions into simulation rendertarget space. Matrix3x2 transform; Matrix3x2.Invert(GetDisplayTransform(canvas), out transform); foreach (var point in e.GetIntermediatePoints(canvas)) { if (!point.IsInContact) continue; var pos = Vector2.Transform(point.Position.ToVector2(), transform); var x = canvas.ConvertDipsToPixels(pos.X, CanvasDpiRounding.Floor); var y = canvas.ConvertDipsToPixels(pos.Y, CanvasDpiRounding.Floor); // If the point is within the bounds of the rendertarget, and not the same as the last point... if (x >= 0 && y >= 0 && x < simulationW && y < simulationH && ((x != lastPointerX || y != lastPointerY))) { // We avoid manipulating GPU resources from inside an input event handler // (since we'd need to handle device lost and possible concurrent running with CreateResources). // Instead, we collect up a list of points and process them from the Draw handler. hitPoints.Add(new IntPoint(x, y)); lastPointerX = x; lastPointerY = y; } } canvas.Invalidate(); }
private void canvasControl_PointerMoved(object sender, PointerRoutedEventArgs e) { if (pickedUp.PatchIndex >= 0) { foreach (var point in e.GetIntermediatePoints(canvasControl)) { if (point.IsInContact) { patchPoints[pickedUp.PatchIndex][pickedUp.PointIndex] = point.Position.ToVector2(); gradientMesh = null; break; } } canvasControl.Invalidate(); e.Handled = true; } }
void OnPointerMoved(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs args) { this.gestureRecognizer.ProcessMoveEvents(args.GetIntermediatePoints(this.element)); }
static void page_PointerPressed(object sender, PointerRoutedEventArgs e) { var ps = e.GetIntermediatePoints(null); if (ps != null && ps.Count > 0) { _gr.ProcessDownEvent(ps[0]); e.Handled = true; } if (OnGestureRaised != null) OnGestureRaised(sender, new CustomGestureArgs() { PressedPointerRoutedEventArgs = e }); }
void OnPointerMoved(object sender, PointerRoutedEventArgs args) { gestureRecognizer.ProcessMoveEvents(args.GetIntermediatePoints(UIElement)); }