[update] 為鎖定的墨跡阻止了板擦和墨跡擦的擦除行為

This commit is contained in:
Dubi906w 2024-08-05 10:03:12 +08:00
parent 3a33f26356
commit 54e5e515d5
5 changed files with 21 additions and 21 deletions

View File

@ -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;
}

View File

@ -1,3 +0,0 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura DisableCleanup="false" IncludeDebugSymbols="true" CreateTemporaryAssemblies="true"></Costura>
</Weavers>

View File

@ -141,14 +141,6 @@
<None Include="app.manifest" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Costura.Fody" Version="5.7.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Fody" Version="6.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
<PackageReference Include="iNKORE.UI.WPF.Modern" Version="0.9.27" />
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />

View File

@ -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();

View File

@ -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) {