From 54e5e515d5478896e029992b0c58e97e783f9317 Mon Sep 17 00:00:00 2001 From: kriastans Date: Mon, 5 Aug 2024 10:03:12 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E7=82=BA=E9=8E=96=E5=AE=9A=E7=9A=84?= =?UTF-8?q?=E5=A2=A8=E8=B7=A1=E9=98=BB=E6=AD=A2=E4=BA=86=E6=9D=BF=E6=93=A6?= =?UTF-8?q?=E5=92=8C=E5=A2=A8=E8=B7=A1=E6=93=A6=E7=9A=84=E6=93=A6=E9=99=A4?= =?UTF-8?q?=E8=A1=8C=E7=82=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- InkCanvasForClass/App.xaml.cs | 3 +-- InkCanvasForClass/FodyWeavers.xml | 3 --- InkCanvasForClass/InkCanvasForClass.csproj | 8 ------- InkCanvasForClass/MainWindow_cs/MW_Eraser.cs | 23 +++++++++++++------ .../MainWindow_cs/MW_SelectionGestures.cs | 5 +++- 5 files changed, 21 insertions(+), 21 deletions(-) delete mode 100644 InkCanvasForClass/FodyWeavers.xml diff --git a/InkCanvasForClass/App.xaml.cs b/InkCanvasForClass/App.xaml.cs index 4871188..415e92d 100644 --- a/InkCanvasForClass/App.xaml.cs +++ b/InkCanvasForClass/App.xaml.cs @@ -29,8 +29,7 @@ namespace Ink_Canvas public static string[] StartArgs = null; public static string RootPath = Environment.GetEnvironmentVariable("APPDATA") + "\\Ink Canvas\\"; - public App() - { + public App() { this.Startup += new StartupEventHandler(App_Startup); this.DispatcherUnhandledException += App_DispatcherUnhandledException; } diff --git a/InkCanvasForClass/FodyWeavers.xml b/InkCanvasForClass/FodyWeavers.xml deleted file mode 100644 index 1bf26da..0000000 --- a/InkCanvasForClass/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/InkCanvasForClass/InkCanvasForClass.csproj b/InkCanvasForClass/InkCanvasForClass.csproj index ab33dfe..6b9b6b6 100644 --- a/InkCanvasForClass/InkCanvasForClass.csproj +++ b/InkCanvasForClass/InkCanvasForClass.csproj @@ -141,14 +141,6 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/InkCanvasForClass/MainWindow_cs/MW_Eraser.cs b/InkCanvasForClass/MainWindow_cs/MW_Eraser.cs index 3ffca75..2dd5e61 100644 --- a/InkCanvasForClass/MainWindow_cs/MW_Eraser.cs +++ b/InkCanvasForClass/MainWindow_cs/MW_Eraser.cs @@ -108,14 +108,20 @@ namespace Ink_Canvas { StrokeHitEventArgs args) { StrokeCollection eraseResult = args.GetPointEraseResults(); - StrokeCollection strokesToReplace = new StrokeCollection(); - strokesToReplace.Add(args.HitStroke); - + StrokeCollection strokesToReplace = new StrokeCollection { + args.HitStroke + }; + // replace the old stroke with the new one. - if (eraseResult.Count > 0) { - inkCanvas.Strokes.Replace(strokesToReplace, eraseResult); + var filtered_2replace = strokesToReplace.Where(stroke => !stroke.ContainsPropertyData(IsLockGuid)); + var filtered2Replace = filtered_2replace as Stroke[] ?? filtered_2replace.ToArray(); + if (!filtered2Replace.Any()) return; + var filtered_result = eraseResult.Where(stroke=>!stroke.ContainsPropertyData(IsLockGuid)); + var filteredResult = filtered_result as Stroke[] ?? filtered_result.ToArray(); + if (filteredResult.Any()) { + inkCanvas.Strokes.Replace(new StrokeCollection(filtered2Replace), new StrokeCollection(filteredResult)); } else { - inkCanvas.Strokes.Remove(strokesToReplace); + inkCanvas.Strokes.Remove(new StrokeCollection(filtered2Replace)); } } @@ -123,7 +129,10 @@ namespace Ink_Canvas { if (!isUsingGeometryEraser) return; if (isUsingStrokesEraser) { - inkCanvas.Strokes.Remove(inkCanvas.Strokes.HitTest(pt)); + var _filtered = inkCanvas.Strokes.HitTest(pt).Where(stroke => !stroke.ContainsPropertyData(IsLockGuid)); + var filtered = _filtered as Stroke[] ?? _filtered.ToArray(); + if (!filtered.Any()) return; + inkCanvas.Strokes.Remove(new StrokeCollection(filtered)); } else { // draw eraser feedback var ct = EraserOverlay_DrawingVisual.DrawingVisual.RenderOpen(); diff --git a/InkCanvasForClass/MainWindow_cs/MW_SelectionGestures.cs b/InkCanvasForClass/MainWindow_cs/MW_SelectionGestures.cs index 2540c3e..b7708c7 100644 --- a/InkCanvasForClass/MainWindow_cs/MW_SelectionGestures.cs +++ b/InkCanvasForClass/MainWindow_cs/MW_SelectionGestures.cs @@ -438,7 +438,6 @@ namespace Ink_Canvas { var bd = new Binding("Visibility"); bd.Source = GridInkCanvasSelectionCover; BorderStrokeSelectionControl.SetBinding(Border.VisibilityProperty, bd); - updateBorderStrokeSelectionControlLocation(); // unlock isLockedStrokeSelectionHandle = false; @@ -453,6 +452,10 @@ namespace Ink_Canvas { // resize toast StrokeSelectionSizeToast.Visibility = Visibility.Collapsed; + + // update selection border size + UpdateStrokeSelectionBorder(true, inkCanvas.GetSelectionBounds()); + updateBorderStrokeSelectionControlLocation(); } private void StrokeSelectionBorderHandle_MouseMove(object sender, MouseEventArgs e) {