improve:线擦擦除

This commit is contained in:
2025-11-15 18:06:36 +08:00
parent e7c2e92879
commit b918809dca
@@ -391,6 +391,8 @@ namespace Ink_Canvas
{ {
var stroke = GetStrokeVisual(e.StylusDevice.Id).Stroke; var stroke = GetStrokeVisual(e.StylusDevice.Id).Stroke;
if (stroke != null)
{
inkCanvas.Strokes.Add(stroke); inkCanvas.Strokes.Add(stroke);
await Task.Delay(5); await Task.Delay(5);
inkCanvas.Children.Remove(GetVisualCanvas(e.StylusDevice.Id)); inkCanvas.Children.Remove(GetVisualCanvas(e.StylusDevice.Id));
@@ -398,6 +400,12 @@ namespace Ink_Canvas
inkCanvas_StrokeCollected(inkCanvas, inkCanvas_StrokeCollected(inkCanvas,
new InkCanvasStrokeCollectedEventArgs(stroke)); new InkCanvasStrokeCollectedEventArgs(stroke));
} }
else
{
await Task.Delay(5);
inkCanvas.Children.Remove(GetVisualCanvas(e.StylusDevice.Id));
}
}
catch (Exception ex) catch (Exception ex)
{ {
LogHelper.WriteLogToFile($"MainWindow_StylusUp 出错: {ex}", LogHelper.LogType.Error); LogHelper.WriteLogToFile($"MainWindow_StylusUp 出错: {ex}", LogHelper.LogType.Error);