void OnUnhandledPointerMoved(InkUnprocessedInput sender, PointerEventArgs args) { if (this.selectionLine != null) { this.selectionLine.Points.Add(args.CurrentPoint.Position); } }
private void UnprocessedInput_PointerMoved(InkUnprocessedInput sender, PointerEventArgs args) { if (_inkCanvasToolBar.ActiveTool == _inkCanvasToolBar.GetToolButton(InkToolbarTool.Eraser) || args.CurrentPoint.Properties.IsEraser) { _drawingSurfaceRenderer.Erase(args.CurrentPoint.Position, ViewPort, _infiniteCanvasScrollViewer.ZoomFactor); } }
internal void AddListeners(InkUnprocessedInput unprocessedInput) { unprocessedInput.PointerMoved += UnprocessedInput_PointerMoved; unprocessedInput.PointerReleased += UnprocessedInput_PointerReleased; unprocessedInput.PointerExited += UnprocessedInput_PointerExited; unprocessedInput.PointerLost += UnprocessedInput_PointerLost; }
private void Canvas_PointerReleased(InkUnprocessedInput sender, PointerEventArgs args) { args.Handled = true; if (CanvasCase == null) { return; } if (canvasInputStatus == CanvasInputStatus.Drag) { CanvasRect.Position += Vector2.Transform(args.CurrentPoint.Position.ToVector2() - mousePreviousPosition.ToVector2(), yInvert); } else if (canvasInputStatus == CanvasInputStatus.DragRotate) { RotateProcess(args.CurrentPoint.Position.ToVector2(), mousePreviousPosition.ToVector2()); } else if (canvasInputStatus == CanvasInputStatus.None) { UpdateTransformMatriex(); Vector2 transformedVector = Vector2.Transform(args.CurrentPoint.Position.ToVector2(), toCanvasPos); if (paintAgent.DrawEnd(transformedVector, args.CurrentPoint, out var coveredTiles, out var tileRect)) { CanvasCase.ViewRenderer.RenderPart(coveredTiles, tileRect); } } PresentContent(); }
private void UnprocessedInput_PointerReleased(InkUnprocessedInput sender, PointerEventArgs args) { if (isPartPressure == true) { SelectedFigure(); isPartPressure = false; } else { lasso.Points.Add(args.CurrentPoint.RawPosition); boundingRect = inkCanvas.InkPresenter.StrokeContainer.SelectWithPolyLine(lasso.Points); isBoundRect = false; SelectedFigure(); /* * Angle angle = new Angle(); * * //각도를 측정하는 방식을 선택 * if (angleMethod == 1) * angle.getPoints(); * else if (angleMethod == 2) * angle.autoAngle(); */ } }
private void Canvas_PointerPressed(InkUnprocessedInput sender, PointerEventArgs args) { AppController.CurrentController.mainPage.Focus(FocusState.Programmatic); canvasInputStatus = CanvasInputStatus.None; mousePreviousPosition = args.CurrentPoint.Position; args.Handled = true; if (CanvasCase == null) { return; } if (args.CurrentPoint.Properties.IsMiddleButtonPressed || (args.KeyModifiers.HasFlag(VirtualKeyModifiers.Menu) && args.CurrentPoint.Properties.IsLeftButtonPressed)) { canvasInputStatus = CanvasInputStatus.Drag; } else if (args.KeyModifiers.HasFlag(VirtualKeyModifiers.Menu) && args.CurrentPoint.Properties.IsRightButtonPressed) { canvasInputStatus = CanvasInputStatus.DragRotate; } else { UpdateTransformMatriex(); Vector2 transformedVector = Vector2.Transform(args.CurrentPoint.Position.ToVector2(), toCanvasPos); if (paintAgent.DrawBegin(transformedVector, args.CurrentPoint, out var coveredTiles, out var tileRect)) { CanvasCase.ViewRenderer.RenderPart(coveredTiles, tileRect); PresentContent(); } } }
private void Select_Moved(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { if (isMooving) { if (lastPoint.X == -10000 && lastPoint.Y == -10000) { lastPoint = args.CurrentPoint.RawPosition; } else { Point newPoint = args.CurrentPoint.RawPosition; if (selectionCanvas.Children.Any()) { selectionCanvas.Children.Clear(); boundingRect = Rect.Empty; } boundingRect = canvas.InkPresenter.StrokeContainer.MoveSelected(new Point(newPoint.X - lastPoint.X, newPoint.Y - lastPoint.Y)); Select_Draw_Bounds(); lastPoint = newPoint; } } else { lasso.Points.Add(args.CurrentPoint.RawPosition);; } }
private void UnprocessedInput_PointerPressed(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { selectionPolylinePoints = new List <Point>(); selectionPolylinePoints.Add(args.CurrentPoint.RawPosition); canvasControl.Invalidate(); }
private void UnprocessedInputLaserpointer_PointerPressed(InkUnprocessedInput sender, PointerEventArgs args) { TranslateTransform_Ellipse_Laserpointer.X = (float)args.CurrentPoint.RawPosition.X - 12.5; TranslateTransform_Ellipse_Laserpointer.Y = (float)args.CurrentPoint.RawPosition.Y - 12.5; Ellipse_Laserpointer.Visibility = Visibility.Visible; Rectangle_Eraser.Visibility = Visibility.Collapsed; }
internal void RemoveListeners(InkUnprocessedInput unprocessedInput) { unprocessedInput.PointerMoved -= UnprocessedInput_PointerMoved; unprocessedInput.PointerReleased -= UnprocessedInput_PointerReleased; unprocessedInput.PointerExited -= UnprocessedInput_PointerExited; unprocessedInput.PointerLost -= UnprocessedInput_PointerLost; }
private void UnprocessedInput_PointerMoved(InkUnprocessedInput sender, PointerEventArgs args) { if (enableLasso) { lasso.Points.Add(args.CurrentPoint.RawPosition); } }
private void UnprocessedInput_PointerReleased(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { lasso.Points.Add(args.CurrentPoint.RawPosition); //Select Ink boundingRect = inkCanvas.InkPresenter.StrokeContainer.SelectWithPolyLine(lasso.Points); DrawBoundingRect(); }
/* * Comment related methods for comment mode in tool bar * */ private void MakeComment(InkUnprocessedInput sender, PointerEventArgs args) { PointerPoint point = args.CurrentPoint; var newComment = comments.CreateComment(point.Position.X, point.Position.Y, stickyColor); var rect = DrawRectangle(newComment); rect.ContextFlyout.ShowAt(rect); }
private void UnprocessedInput_PointerExited(InkUnprocessedInput sender, PointerEventArgs args) { if (this.isErasing) { args.Handled = true; } this.isErasing = true; }
private void UnprocessedInput_PointerReleased(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { lasso.Points.Add(args.CurrentPoint.RawPosition); boundingRect = inkCanvas.InkPresenter.StrokeContainer.SelectWithPolyLine(lasso.Points); DrawBoundingRect(); }
private void UnprocessedInput_PointerReleased(InkUnprocessedInput sender, PointerEventArgs args) { lasso.Points.Add(args.CurrentPoint.RawPosition); boundingRect = MainInkCanvas.InkPresenter.StrokeContainer.SelectWithPolyLine(lasso.Points); isBoundRect = false; DrawBoundingRect(); }
private void LassoPointerReleased(InkUnprocessedInput sender, PointerEventArgs args) { lasso.Points.Add(args.CurrentPoint.RawPosition); var lassoedRegion = mainCanvas.InkPresenter.StrokeContainer.SelectWithPolyLine(lasso.Points); outerCanvas.Children.Remove(lasso); HighlightLassoSelection(lassoedRegion); }
private void UnprocessedInput_PointerExited(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { if (_isErasing) { args.Handled = true; } _isErasing = false; }
private void UnprocessedInput_PointerReleased(InkUnprocessedInput sender, PointerEventArgs args) { if (_isErasing) { args.Handled = true; } _isErasing = false; }
void OnUnhandledPointerReleased(InkUnprocessedInput sender, PointerEventArgs args) { if (this.selectionLine != null) { this.selectionLine.Points.Add(args.CurrentPoint.Position); this.inkStrokeContainer.SelectWithPolyLine(this.selectionLine.Points); this.UpdateStrokesView(); } this.selectionLine = null; }
// 右键抬起 private void UnprocessedInput_PointerReleased(InkUnprocessedInput sender, PointerEventArgs args) { // 更新右键轨迹 _polyline.Points.Add(args.CurrentPoint.RawPosition); // 获取右键圈起来的区域内的涂鸦所在的 Rect 区域 _rect = inkCanvas.InkPresenter.StrokeContainer.SelectWithPolyLine(_polyline.Points); DrawBoundingRect(); }
private void UnprocessedInput_PointerReleased(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { selectionPolylinePoints.Add(args.CurrentPoint.RawPosition); selectionBoundingRect = inkManager.SelectWithPolyLine(selectionPolylinePoints); selectionPolylinePoints = null; canvasControl.Invalidate(); }
private void UnprocessedInput_PointerReleased(InkUnprocessedInput sender, PointerEventArgs args) { lasso.Points.Add(args.CurrentPoint.RawPosition); var rect = _strokeService.SelectStrokesByPoints(lasso.Points); enableLasso = false; _selectionCanvas.Children.Remove(lasso); _selectionRectangleService.UpdateSelectionRect(rect); }
private void UnprocessedInputEraser_PointerReleased(InkUnprocessedInput sender, PointerEventArgs args) { Rectangle_Eraser.Visibility = Visibility.Collapsed; StrokesAfter = new List <InkStroke>(); foreach (InkStroke isk in CurrentInkCanvas.InkPresenter.StrokeContainer.GetStrokes()) { StrokesAfter.Add(isk); } UndoRedoBase.AddOperationToUndoneOperations(new EraseByPointOperation(StrokesBefore, StrokesAfter)); }
void OnPointerEntered( InkUnprocessedInput sender, PointerEventArgs args) { var typeOfPointer = args.CurrentPoint.PointerDevice.PointerDeviceType; BitmapImage image = new BitmapImage( new Uri($"ms-appx:///Assets/{typeOfPointer}.png")); this.imgInput.Source = image; }
void OnUnhandledPointerPressed(InkUnprocessedInput sender, PointerEventArgs args) { this.backingCanvas.Children.Clear(); this.selectionLine = this.MakeBackingCanvasLine(Colors.Silver, 3, true); this.backingCanvas.Children.Add(this.selectionLine); this.selectionLine.Points.Add(args.CurrentPoint.Position); }
private void UnprocessedInput_PointerPressed(InkUnprocessedInput sender, PointerEventArgs args) { if (args.CurrentPoint.Properties.IsRightButtonPressed && args.CurrentPoint.PointerDevice.PointerDeviceType == PointerDeviceType.Mouse) { this.ShowInkSelectionToolbar(); return; } switch (this.toolbarMode) { case ToolbarMode.Erasing: this.lastPoint = args.CurrentPoint.Position; args.Handled = true; this.isErasing = true; break; case ToolbarMode.Lasso: if (this.selectionRectangle != null) { if (this.selectionRectangle.Value.Contains(args.CurrentPoint.RawPosition)) { this.selectionDragPoint = args.CurrentPoint.RawPosition; this.selectionOffset = new Size(args.CurrentPoint.RawPosition.X - this.selectionRectangle.Value.X, args.CurrentPoint.RawPosition.Y - this.selectionRectangle.Value.Y); this.isSelectionDragging = true; return; } this.isClickedOutsizeSelection = true; } else { this.ClearDrawnBoundingRect(); this.lasso = new Polyline() { Stroke = new SolidColorBrush(Colors.Blue), StrokeThickness = 1, StrokeDashArray = new DoubleCollection() { 5, 2 }, }; this.lasso.Points.Add(args.CurrentPoint.RawPosition); this.SelectionCanvas.Children.Add(this.lasso); this.isBoundRect = true; } break; } if (this.InkSelectionToolbar.Visibility == Visibility.Visible) { this.InkSelectionToolbar.Visibility = Visibility.Collapsed; } }
private void UnprocessedInputEraser_PointerPressed(InkUnprocessedInput sender, PointerEventArgs args) { TranslateTransform_Rectangle_Eraser.X = (float)args.CurrentPoint.RawPosition.X - EraserWidth; TranslateTransform_Rectangle_Eraser.Y = (float)args.CurrentPoint.RawPosition.Y - EraserWidth; Rectangle_Eraser.Visibility = Visibility.Visible; Ellipse_Laserpointer.Visibility = Visibility.Collapsed; StrokesBefore = new List <InkStroke>(); foreach (InkStroke isk in CurrentInkCanvas.InkPresenter.StrokeContainer.GetStrokes()) { StrokesBefore.Add(isk); } }
private void UnprocessedInput_PointerEntered(InkUnprocessedInput sender, PointerEventArgs args) { if (args.CurrentPoint.Properties.IsInverted == true && args.CurrentPoint.PointerDevice.PointerDeviceType == PointerDeviceType.Pen) { IsInkingToolAutoChanged = true; Eraser_Button.IsChecked = true; } else if (args.CurrentPoint.Properties.IsInverted == false && args.CurrentPoint.PointerDevice.PointerDeviceType == PointerDeviceType.Pen) { IsInkingToolAutoChanged = true; SelectLastInkingTool(); } }
private void UnprocessedInput_PointerPressed(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { lasso = new Polyline() { Stroke = new SolidColorBrush(Windows.UI.Colors.Blue), StrokeThickness = 1, StrokeDashArray = new DoubleCollection() {5, 2}, }; lasso.Points.Add(args.CurrentPoint.RawPosition); selectionCanvas.Children.Add(lasso); }
// Phase 2: // this method need to be super veloce because this happens, we have the chance to change the color but the inking will start even this isn't finished // so it can happens that if two stylust start exactly at the same time inking one of the two whon't have it's own DrawingAttributes stored in _stylusAttributes // because the ininkg process has started and we din't changed the DrawingAttributes private void UnprocessedInput_PointerHovered(InkUnprocessedInput sender, PointerEventArgs e) { int uniqueStylusId = this.GetUniqueStylusId(e.CurrentPoint); if (this.stylusAttributes.ContainsKey(uniqueStylusId) && this.stylusAttributes[uniqueStylusId] != null) { this.InkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(this.stylusAttributes[uniqueStylusId]); } else { this.SetStylusAttributes(uniqueStylusId); } }
private void UnprocessedInput_PointerMoved(InkUnprocessedInput sender, PointerEventArgs args) { if (isPartPressure == true) { selectionCanvas.Children.Remove(partRect); partLastPosition = args.CurrentPoint.Position; try { partRect = new Rectangle() { Stroke = new SolidColorBrush(Windows.UI.Colors.DarkGray), StrokeThickness = 1, StrokeDashArray = new DoubleCollection() { 5, 2 }, Width = partLastPosition.X - partStartPosition.X, Height = partLastPosition.Y - partStartPosition.Y }; } catch { partLastPosition = partStartPosition; partRect = new Rectangle() { Stroke = new SolidColorBrush(Windows.UI.Colors.DarkGray), StrokeThickness = 1, StrokeDashArray = new DoubleCollection() { 5, 2 }, Width = partLastPosition.X - partStartPosition.X, Height = partLastPosition.Y - partStartPosition.Y }; } Canvas.SetLeft(partRect, partStartPosition.X); Canvas.SetTop(partRect, partStartPosition.Y); selectionCanvas.Children.Add(partRect); } else { if (isBoundRect) { lasso.Points.Add(args.CurrentPoint.RawPosition); } } }
public InkUnprocessedInputEvents(InkUnprocessedInput This) { this.This = This; }
private void UnprocessedInput_PointerMoved(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { selectionPolylinePoints.Add(args.CurrentPoint.RawPosition); canvasControl.Invalidate(); }
private void UnprocessedInput_PointerMoved(InkUnprocessedInput sender, PointerEventArgs args) { if (isBoundRect) { lasso.Points.Add(args.CurrentPoint.RawPosition); } }
private void UnprocessedInput_PointerEntered1(InkUnprocessedInput sender, PointerEventArgs args) { border1.BorderBrush = new SolidColorBrush(Colors.Gray); border2.BorderBrush = new SolidColorBrush(Colors.Blue); inkToolbar.TargetInkCanvas = inkCanvas2; }
private void UnprocessedInput_PointerMoved(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { lasso.Points.Add(args.CurrentPoint.RawPosition); }