delete:墨迹预测
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Numerics;
|
||||||
using System.Runtime.InteropServices.WindowsRuntime;
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Ink;
|
using System.Windows.Ink;
|
||||||
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using OSVersionExtension;
|
using OSVersionExtension;
|
||||||
using WinRtInkAnalyzer = global::Windows.UI.Input.Inking.Analysis.InkAnalyzer;
|
using WinRtInkAnalyzer = global::Windows.UI.Input.Inking.Analysis.InkAnalyzer;
|
||||||
@@ -103,8 +105,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
new global::Windows.Foundation.Point((float)pi.X, (float)pi.Y), (float)sp.PressureFactor));
|
new global::Windows.Foundation.Point((float)pi.X, (float)pi.Y), (float)sp.PressureFactor));
|
||||||
}
|
}
|
||||||
|
|
||||||
var transform = global::Windows.Foundation.Numerics.Matrix3x2.Identity;
|
return builder.CreateStrokeFromInkPoints(inkPoints, Matrix3x2.Identity);
|
||||||
return builder.CreateStrokeFromInkPoints(inkPoints, transform);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static global::Windows.UI.Input.Inking.Analysis.InkAnalysisInkDrawing FindPrimaryDrawing(
|
private static global::Windows.UI.Input.Inking.Analysis.InkAnalysisInkDrawing FindPrimaryDrawing(
|
||||||
|
|||||||
@@ -1125,23 +1125,6 @@
|
|||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
<TextBlock Text="{i18n:I18n Key=InkRecog_ShapeEngineHint}" TextWrapping="Wrap"
|
<TextBlock Text="{i18n:I18n Key=InkRecog_ShapeEngineHint}" TextWrapping="Wrap"
|
||||||
Foreground="#a1a1aa" MaxWidth="520" HorizontalAlignment="Left" />
|
Foreground="#a1a1aa" MaxWidth="520" HorizontalAlignment="Left" />
|
||||||
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
|
||||||
<TextBlock Foreground="#fafafa" Text="{i18n:I18n Key=InkRecog_InkStrokePrediction}" VerticalAlignment="Center"
|
|
||||||
FontSize="14" Margin="0,0,16,0" />
|
|
||||||
<ui:ToggleSwitch OnContent="" OffContent="" Name="ToggleSwitchInkStrokePredictionSettings"
|
|
||||||
IsOn="False" FontFamily="Microsoft YaHei UI" FontWeight="Bold"
|
|
||||||
Toggled="ToggleSwitchInkStrokePredictionSettings_Toggled" />
|
|
||||||
<ComboBox x:Name="ComboBoxInkStrokePredictionLeadSettings" Width="130" Margin="12,0,0,0"
|
|
||||||
FontFamily="Microsoft YaHei UI" VerticalAlignment="Center"
|
|
||||||
Visibility="Collapsed"
|
|
||||||
SelectionChanged="ComboBoxInkStrokePredictionLeadSettings_SelectionChanged">
|
|
||||||
<ComboBoxItem Content="自动" FontFamily="Microsoft YaHei UI" />
|
|
||||||
<ComboBoxItem Content="25ms" FontFamily="Microsoft YaHei UI" />
|
|
||||||
<ComboBoxItem Content="50ms" FontFamily="Microsoft YaHei UI" />
|
|
||||||
</ComboBox>
|
|
||||||
</ikw:SimpleStackPanel>
|
|
||||||
<TextBlock Text="{i18n:I18n Key=InkRecog_InkStrokePredictionHint}" TextWrapping="Wrap"
|
|
||||||
Foreground="#a1a1aa" MaxWidth="400" HorizontalAlignment="Left" />
|
|
||||||
<ikw:SimpleStackPanel Spacing="6"
|
<ikw:SimpleStackPanel Spacing="6"
|
||||||
Visibility="{Binding ElementName=ToggleSwitchEnableInkToShape, Path=IsOn, Converter={StaticResource BooleanToVisibilityConverter}}">
|
Visibility="{Binding ElementName=ToggleSwitchEnableInkToShape, Path=IsOn, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||||
@@ -4635,9 +4618,6 @@
|
|||||||
PreviewTouchDown="InkCanvas_PreviewTouchDown"
|
PreviewTouchDown="InkCanvas_PreviewTouchDown"
|
||||||
PreviewTouchMove="InkCanvas_PreviewTouchMove"
|
PreviewTouchMove="InkCanvas_PreviewTouchMove"
|
||||||
PreviewTouchUp="InkCanvas_PreviewTouchUp"
|
PreviewTouchUp="InkCanvas_PreviewTouchUp"
|
||||||
PreviewStylusMove="inkCanvas_PreviewStylusMove"
|
|
||||||
PreviewMouseMove="inkCanvas_PreviewMouseMoveForPrediction"
|
|
||||||
LostStylusCapture="inkCanvas_LostStylusCapture"
|
|
||||||
MouseDown="inkCanvas_MouseDown"
|
MouseDown="inkCanvas_MouseDown"
|
||||||
MouseMove="inkCanvas_MouseMove"
|
MouseMove="inkCanvas_MouseMove"
|
||||||
MouseUp="inkCanvas_MouseUp"
|
MouseUp="inkCanvas_MouseUp"
|
||||||
@@ -4647,12 +4627,6 @@
|
|||||||
ClipToBounds="False"
|
ClipToBounds="False"
|
||||||
Background="Transparent" />
|
Background="Transparent" />
|
||||||
|
|
||||||
<Canvas x:Name="InkPredictionOverlay" Background="Transparent" IsHitTestVisible="False"
|
|
||||||
Panel.ZIndex="900">
|
|
||||||
<Polyline x:Name="InkPredictionPolyline" Visibility="Collapsed" StrokeLineJoin="Round"
|
|
||||||
StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
|
|
||||||
</Canvas>
|
|
||||||
|
|
||||||
<Canvas x:Name="EraserOverlayCanvas"
|
<Canvas x:Name="EraserOverlayCanvas"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
|
|||||||
@@ -1156,9 +1156,6 @@ namespace Ink_Canvas
|
|||||||
Trace.WriteLine("Eraser: Overlay disabled in non-eraser mode");
|
Trace.WriteLine("Eraser: Overlay disabled in non-eraser mode");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inkCanvas1.EditingMode != InkCanvasEditingMode.Ink)
|
|
||||||
EndInkPredictionStroke();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Ink Canvas
|
#endregion Ink Canvas
|
||||||
@@ -2270,13 +2267,6 @@ namespace Ink_Canvas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.LeftButton == MouseButtonState.Pressed
|
|
||||||
&& inkCanvas != null
|
|
||||||
&& inkCanvas.EditingMode == InkCanvasEditingMode.Ink
|
|
||||||
&& penType != 1)
|
|
||||||
{
|
|
||||||
BeginInkPredictionStrokeIfNeeded();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 手写笔输入
|
// 手写笔输入
|
||||||
@@ -2284,13 +2274,11 @@ namespace Ink_Canvas
|
|||||||
{
|
{
|
||||||
// 使用辅助方法设置光标
|
// 使用辅助方法设置光标
|
||||||
SetCursorBasedOnEditingMode(sender as InkCanvas);
|
SetCursorBasedOnEditingMode(sender as InkCanvas);
|
||||||
BeginInkPredictionStrokeIfNeeded();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 手写笔抬起事件(用于橡皮擦自动切换)
|
// 手写笔抬起事件(用于橡皮擦自动切换)
|
||||||
private void inkCanvas_StylusUp(object sender, StylusEventArgs e)
|
private void inkCanvas_StylusUp(object sender, StylusEventArgs e)
|
||||||
{
|
{
|
||||||
EndInkPredictionStroke();
|
|
||||||
HandleEraserOperationEnded();
|
HandleEraserOperationEnded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,217 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Ink;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
|
|
||||||
namespace Ink_Canvas
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 墨迹预测:书写过程中根据速度与选项外推一小段预览线,减轻感知延迟。
|
|
||||||
/// </summary>
|
|
||||||
public partial class MainWindow
|
|
||||||
{
|
|
||||||
private bool _inkPredictionStrokeActive;
|
|
||||||
private bool _inkPredictionHasSample;
|
|
||||||
private bool _inkPredictionHasVelocity;
|
|
||||||
private Point _inkPredictionLastPos;
|
|
||||||
private int _inkPredictionLastTime;
|
|
||||||
private double _inkPredictionVx;
|
|
||||||
private double _inkPredictionVy;
|
|
||||||
|
|
||||||
private void SyncInkStrokePredictionLeadComboVisibility()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
bool on = Settings?.Canvas != null && Settings.Canvas.EnableInkStrokePrediction;
|
|
||||||
var v = on ? Visibility.Visible : Visibility.Collapsed;
|
|
||||||
if (ComboBoxInkStrokePredictionLeadSettings != null)
|
|
||||||
ComboBoxInkStrokePredictionLeadSettings.Visibility = v;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ClearInkPredictionOverlay()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (InkPredictionPolyline == null) return;
|
|
||||||
InkPredictionPolyline.Visibility = Visibility.Collapsed;
|
|
||||||
InkPredictionPolyline.Points.Clear();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void BeginInkPredictionStrokeIfNeeded()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (Settings?.Canvas == null || !Settings.Canvas.EnableInkStrokePrediction)
|
|
||||||
{
|
|
||||||
_inkPredictionStrokeActive = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_inkPredictionStrokeActive = inkCanvas != null
|
|
||||||
&& inkCanvas.EditingMode == InkCanvasEditingMode.Ink
|
|
||||||
&& penType != 1
|
|
||||||
&& !_isBoardBrushMode;
|
|
||||||
_inkPredictionHasSample = false;
|
|
||||||
_inkPredictionHasVelocity = false;
|
|
||||||
ClearInkPredictionOverlay();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
_inkPredictionStrokeActive = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void EndInkPredictionStroke()
|
|
||||||
{
|
|
||||||
_inkPredictionStrokeActive = false;
|
|
||||||
_inkPredictionHasSample = false;
|
|
||||||
_inkPredictionHasVelocity = false;
|
|
||||||
ClearInkPredictionOverlay();
|
|
||||||
}
|
|
||||||
|
|
||||||
private double GetInkPredictionLeadMs()
|
|
||||||
{
|
|
||||||
int mode = Settings?.Canvas?.InkStrokePredictionLeadMode ?? 0;
|
|
||||||
if (mode == 1) return 25.0;
|
|
||||||
if (mode == 2) return 50.0;
|
|
||||||
|
|
||||||
double speed = Math.Sqrt(_inkPredictionVx * _inkPredictionVx + _inkPredictionVy * _inkPredictionVy);
|
|
||||||
double norm = Math.Min(1.0, speed / 2600.0);
|
|
||||||
double lead = 16.0 + norm * 34.0;
|
|
||||||
return Math.Max(14.0, Math.Min(52.0, lead));
|
|
||||||
}
|
|
||||||
|
|
||||||
private double GetInkPredictionMaxDistance(double leadMs)
|
|
||||||
{
|
|
||||||
double baseD = Math.Max(4.0, Settings?.Canvas?.InkStrokePredictionMaxDistance ?? 18.0);
|
|
||||||
int mode = Settings?.Canvas?.InkStrokePredictionLeadMode ?? 0;
|
|
||||||
if (mode != 0)
|
|
||||||
return Math.Max(6.0, Math.Min(42.0, baseD * (leadMs / 24.0)));
|
|
||||||
|
|
||||||
double speed = Math.Sqrt(_inkPredictionVx * _inkPredictionVx + _inkPredictionVy * _inkPredictionVy);
|
|
||||||
double norm = Math.Min(1.0, speed / 2200.0);
|
|
||||||
return Math.Max(6.0, Math.Min(48.0, baseD + norm * baseD * 0.9));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void inkCanvas_PreviewStylusMove(object sender, StylusEventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (Settings?.Canvas == null || !Settings.Canvas.EnableInkStrokePrediction) return;
|
|
||||||
if (inkCanvas == null || InkPredictionPolyline == null) return;
|
|
||||||
if (!_inkPredictionStrokeActive || penType == 1) return;
|
|
||||||
if (inkCanvas.EditingMode != InkCanvasEditingMode.Ink) return;
|
|
||||||
|
|
||||||
if (e.InAir)
|
|
||||||
{
|
|
||||||
ClearInkPredictionOverlay();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var pos = e.GetPosition(inkCanvas);
|
|
||||||
UpdateInkPredictionCore(pos, e.Timestamp);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void inkCanvas_LostStylusCapture(object sender, StylusEventArgs e)
|
|
||||||
{
|
|
||||||
EndInkPredictionStroke();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void inkCanvas_PreviewMouseMoveForPrediction(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (Settings?.Canvas == null || !Settings.Canvas.EnableInkStrokePrediction) return;
|
|
||||||
if (inkCanvas == null || InkPredictionPolyline == null) return;
|
|
||||||
if (!_inkPredictionStrokeActive || penType == 1) return;
|
|
||||||
if (inkCanvas.EditingMode != InkCanvasEditingMode.Ink) return;
|
|
||||||
if (e.LeftButton != MouseButtonState.Pressed) return;
|
|
||||||
if (e.StylusDevice != null) return;
|
|
||||||
|
|
||||||
var pos = e.GetPosition(inkCanvas);
|
|
||||||
UpdateInkPredictionCore(pos, Environment.TickCount & int.MaxValue);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateInkPredictionCore(Point pos, int timestamp)
|
|
||||||
{
|
|
||||||
if (InkPredictionPolyline == null || Settings?.Canvas == null) return;
|
|
||||||
|
|
||||||
if (!_inkPredictionHasSample)
|
|
||||||
{
|
|
||||||
_inkPredictionLastPos = pos;
|
|
||||||
_inkPredictionLastTime = timestamp;
|
|
||||||
_inkPredictionHasSample = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
double dtMs = timestamp - _inkPredictionLastTime;
|
|
||||||
if (dtMs <= 0 || dtMs > 120) dtMs = 16;
|
|
||||||
|
|
||||||
double vx = (pos.X - _inkPredictionLastPos.X) / dtMs * 1000.0;
|
|
||||||
double vy = (pos.Y - _inkPredictionLastPos.Y) / dtMs * 1000.0;
|
|
||||||
|
|
||||||
const double velocitySmooth = 0.62;
|
|
||||||
if (!_inkPredictionHasVelocity)
|
|
||||||
{
|
|
||||||
_inkPredictionVx = vx;
|
|
||||||
_inkPredictionVy = vy;
|
|
||||||
_inkPredictionHasVelocity = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_inkPredictionVx = velocitySmooth * _inkPredictionVx + (1.0 - velocitySmooth) * vx;
|
|
||||||
_inkPredictionVy = velocitySmooth * _inkPredictionVy + (1.0 - velocitySmooth) * vy;
|
|
||||||
}
|
|
||||||
|
|
||||||
double leadMs = GetInkPredictionLeadMs();
|
|
||||||
double predX = pos.X + _inkPredictionVx * (leadMs / 1000.0);
|
|
||||||
double predY = pos.Y + _inkPredictionVy * (leadMs / 1000.0);
|
|
||||||
|
|
||||||
double maxDist = GetInkPredictionMaxDistance(leadMs);
|
|
||||||
double dx = predX - pos.X;
|
|
||||||
double dy = predY - pos.Y;
|
|
||||||
double len = Math.Sqrt(dx * dx + dy * dy);
|
|
||||||
if (len > maxDist && len > 1e-6)
|
|
||||||
{
|
|
||||||
double s = maxDist / len;
|
|
||||||
predX = pos.X + dx * s;
|
|
||||||
predY = pos.Y + dy * s;
|
|
||||||
}
|
|
||||||
|
|
||||||
_inkPredictionLastPos = pos;
|
|
||||||
_inkPredictionLastTime = timestamp;
|
|
||||||
|
|
||||||
var da = inkCanvas.DefaultDrawingAttributes;
|
|
||||||
var c = da.Color;
|
|
||||||
InkPredictionPolyline.Stroke = new SolidColorBrush(Color.FromArgb(110, c.R, c.G, c.B));
|
|
||||||
InkPredictionPolyline.StrokeThickness = Math.Max(1.0, da.Width * 0.42);
|
|
||||||
|
|
||||||
InkPredictionPolyline.Points.Clear();
|
|
||||||
InkPredictionPolyline.Points.Add(pos);
|
|
||||||
InkPredictionPolyline.Points.Add(new Point(predX, predY));
|
|
||||||
InkPredictionPolyline.Visibility = Visibility.Visible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2700,28 +2700,6 @@ namespace Ink_Canvas
|
|||||||
SaveSettingsToFile();
|
SaveSettingsToFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ToggleSwitchInkStrokePredictionSettings_Toggled(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if (!isLoaded) return;
|
|
||||||
|
|
||||||
bool on = ToggleSwitchInkStrokePredictionSettings != null && ToggleSwitchInkStrokePredictionSettings.IsOn;
|
|
||||||
Settings.Canvas.EnableInkStrokePrediction = on;
|
|
||||||
SyncInkStrokePredictionLeadComboVisibility();
|
|
||||||
if (!on)
|
|
||||||
EndInkPredictionStroke();
|
|
||||||
SaveSettingsToFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ComboBoxInkStrokePredictionLeadSettings_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
||||||
{
|
|
||||||
if (!isLoaded) return;
|
|
||||||
var cb = sender as ComboBox;
|
|
||||||
if (cb?.SelectedIndex < 0) return;
|
|
||||||
|
|
||||||
Settings.Canvas.InkStrokePredictionLeadMode = cb.SelectedIndex;
|
|
||||||
SaveSettingsToFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ToggleSwitchAutoStraightenLine_Toggled(object sender, RoutedEventArgs e)
|
private void ToggleSwitchAutoStraightenLine_Toggled(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!isLoaded) return;
|
if (!isLoaded) return;
|
||||||
|
|||||||
@@ -951,16 +951,6 @@ namespace Ink_Canvas
|
|||||||
// 初始化直线端点吸附相关设置
|
// 初始化直线端点吸附相关设置
|
||||||
ToggleSwitchLineEndpointSnapping.IsOn = Settings.Canvas.LineEndpointSnapping;
|
ToggleSwitchLineEndpointSnapping.IsOn = Settings.Canvas.LineEndpointSnapping;
|
||||||
ToggleSwitchCompressPicturesUploaded.IsOn = Settings.Canvas.IsCompressPicturesUploaded;
|
ToggleSwitchCompressPicturesUploaded.IsOn = Settings.Canvas.IsCompressPicturesUploaded;
|
||||||
|
|
||||||
int leadMode = Settings.Canvas.InkStrokePredictionLeadMode;
|
|
||||||
if (leadMode < 0 || leadMode > 2) leadMode = 0;
|
|
||||||
Settings.Canvas.InkStrokePredictionLeadMode = leadMode;
|
|
||||||
|
|
||||||
if (ToggleSwitchInkStrokePredictionSettings != null)
|
|
||||||
ToggleSwitchInkStrokePredictionSettings.IsOn = Settings.Canvas.EnableInkStrokePrediction;
|
|
||||||
if (ComboBoxInkStrokePredictionLeadSettings != null)
|
|
||||||
ComboBoxInkStrokePredictionLeadSettings.SelectedIndex = leadMode;
|
|
||||||
SyncInkStrokePredictionLeadComboVisibility();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2565,8 +2565,7 @@ namespace Ink_Canvas
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void inkCanvas_MouseUp(object sender, MouseButtonEventArgs e)
|
private void inkCanvas_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
EndInkPredictionStroke();
|
HandleEraserOperationEnded();
|
||||||
HandleEraserOperationEnded(); // 橡皮擦自动切换回批注模式:松手后启动/重置计时
|
|
||||||
inkCanvas.ReleaseMouseCapture();
|
inkCanvas.ReleaseMouseCapture();
|
||||||
ViewboxFloatingBar.IsHitTestVisible = true;
|
ViewboxFloatingBar.IsHitTestVisible = true;
|
||||||
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
|
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
|
||||||
|
|||||||
@@ -632,7 +632,6 @@ namespace Ink_Canvas
|
|||||||
else if (result.ShapeName.Contains("Triangle") &&
|
else if (result.ShapeName.Contains("Triangle") &&
|
||||||
Settings.InkToShape.IsInkToShapeTriangle)
|
Settings.InkToShape.IsInkToShapeTriangle)
|
||||||
{
|
{
|
||||||
var shape = result.InkDrawingNode.GetShape();
|
|
||||||
var p = result.HotPoints;
|
var p = result.HotPoints;
|
||||||
if ((Math.Max(Math.Max(p[0].X, p[1].X), p[2].X) -
|
if ((Math.Max(Math.Max(p[0].X, p[1].X), p[2].X) -
|
||||||
Math.Min(Math.Min(p[0].X, p[1].X), p[2].X) >= 100 ||
|
Math.Min(Math.Min(p[0].X, p[1].X), p[2].X) >= 100 ||
|
||||||
@@ -671,10 +670,10 @@ namespace Ink_Canvas
|
|||||||
result.ShapeName.Contains("Diamond") ||
|
result.ShapeName.Contains("Diamond") ||
|
||||||
result.ShapeName.Contains("Parallelogram") ||
|
result.ShapeName.Contains("Parallelogram") ||
|
||||||
result.ShapeName.Contains("Square") ||
|
result.ShapeName.Contains("Square") ||
|
||||||
result.ShapeName.Contains("Trapezoid")) &&
|
result.ShapeName.Contains("Trapezoid") ||
|
||||||
|
result.ShapeName.Contains("Quadrilateral")) &&
|
||||||
Settings.InkToShape.IsInkToShapeRectangle)
|
Settings.InkToShape.IsInkToShapeRectangle)
|
||||||
{
|
{
|
||||||
var shape = result.InkDrawingNode.GetShape();
|
|
||||||
var p = result.HotPoints;
|
var p = result.HotPoints;
|
||||||
if ((Math.Max(Math.Max(Math.Max(p[0].X, p[1].X), p[2].X), p[3].X) -
|
if ((Math.Max(Math.Max(Math.Max(p[0].X, p[1].X), p[2].X), p[3].X) -
|
||||||
Math.Min(Math.Min(Math.Min(p[0].X, p[1].X), p[2].X), p[3].X) >= 100 ||
|
Math.Min(Math.Min(Math.Min(p[0].X, p[1].X), p[2].X), p[3].X) >= 100 ||
|
||||||
|
|||||||
@@ -229,8 +229,6 @@
|
|||||||
<data name="InkRecog_ShapeEngineAuto" xml:space="preserve"><value>Auto</value></data>
|
<data name="InkRecog_ShapeEngineAuto" xml:space="preserve"><value>Auto</value></data>
|
||||||
<data name="InkRecog_ShapeEngineIACore" xml:space="preserve"><value>IACore</value></data>
|
<data name="InkRecog_ShapeEngineIACore" xml:space="preserve"><value>IACore</value></data>
|
||||||
<data name="InkRecog_ShapeEngineWinRT" xml:space="preserve"><value>WinRT</value></data>
|
<data name="InkRecog_ShapeEngineWinRT" xml:space="preserve"><value>WinRT</value></data>
|
||||||
<data name="InkRecog_InkStrokePrediction" xml:space="preserve"><value>Ink stroke prediction</value></data>
|
|
||||||
<data name="InkRecog_InkStrokePredictionHint" xml:space="preserve"><value># When on, shows a short ahead-of-stroke hint while inking. Choose Auto (speed-based), 25 ms, or 50 ms lead.</value></data>
|
|
||||||
<data name="InkRecog_BlockRectFakePressure" xml:space="preserve"><value>Block fake pressure on corrected rectangles</value></data>
|
<data name="InkRecog_BlockRectFakePressure" xml:space="preserve"><value>Block fake pressure on corrected rectangles</value></data>
|
||||||
<data name="InkRecog_BlockTriFakePressure" xml:space="preserve"><value>Block fake pressure on corrected triangles</value></data>
|
<data name="InkRecog_BlockTriFakePressure" xml:space="preserve"><value>Block fake pressure on corrected triangles</value></data>
|
||||||
<data name="InkRecog_FixTriangle" xml:space="preserve"><value>Correct freehand triangles</value></data>
|
<data name="InkRecog_FixTriangle" xml:space="preserve"><value>Correct freehand triangles</value></data>
|
||||||
|
|||||||
@@ -244,8 +244,6 @@
|
|||||||
<data name="InkRecog_ShapeEngineAuto" xml:space="preserve"><value>自动</value></data>
|
<data name="InkRecog_ShapeEngineAuto" xml:space="preserve"><value>自动</value></data>
|
||||||
<data name="InkRecog_ShapeEngineIACore" xml:space="preserve"><value>IACore</value></data>
|
<data name="InkRecog_ShapeEngineIACore" xml:space="preserve"><value>IACore</value></data>
|
||||||
<data name="InkRecog_ShapeEngineWinRT" xml:space="preserve"><value>WinRT</value></data>
|
<data name="InkRecog_ShapeEngineWinRT" xml:space="preserve"><value>WinRT</value></data>
|
||||||
<data name="InkRecog_InkStrokePrediction" xml:space="preserve"><value>墨迹预测</value></data>
|
|
||||||
<data name="InkRecog_InkStrokePredictionHint" xml:space="preserve"><value># 开启后可在书写时显示短暂外推预览线。打开开关后可选择:自动(随速度调整)、固定 25ms 或 50ms 提前量。</value></data>
|
|
||||||
<data name="InkRecog_BlockRectFakePressure" xml:space="preserve"><value>阻止矫正后的矩形带有模拟压感值</value></data>
|
<data name="InkRecog_BlockRectFakePressure" xml:space="preserve"><value>阻止矫正后的矩形带有模拟压感值</value></data>
|
||||||
<data name="InkRecog_BlockTriFakePressure" xml:space="preserve"><value>阻止矫正后的三角形带有模拟压感值</value></data>
|
<data name="InkRecog_BlockTriFakePressure" xml:space="preserve"><value>阻止矫正后的三角形带有模拟压感值</value></data>
|
||||||
<data name="InkRecog_FixTriangle" xml:space="preserve"><value>矫正手绘三角形</value></data>
|
<data name="InkRecog_FixTriangle" xml:space="preserve"><value>矫正手绘三角形</value></data>
|
||||||
|
|||||||
@@ -146,34 +146,8 @@ namespace Ink_Canvas
|
|||||||
public bool EnableEraserAutoSwitchBack { get; set; } = false;
|
public bool EnableEraserAutoSwitchBack { get; set; } = false;
|
||||||
[JsonProperty("eraserAutoSwitchBackDelaySeconds")]
|
[JsonProperty("eraserAutoSwitchBackDelaySeconds")]
|
||||||
public int EraserAutoSwitchBackDelaySeconds { get; set; } = 10; // 默认10秒
|
public int EraserAutoSwitchBackDelaySeconds { get; set; } = 10; // 默认10秒
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否在笔工具中启用墨迹预测预览线(由笔属性面板「墨迹预测」开关控制)。
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("enableInkStrokePrediction")]
|
|
||||||
public bool EnableInkStrokePrediction { get; set; } = false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 墨迹预测提前量模式:0 自动(随书写速度调整),1 固定 25ms,2 固定 50ms。
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("inkStrokePredictionLeadMode")]
|
|
||||||
public int InkStrokePredictionLeadMode { get; set; } = 0;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 预测线段基准最大长度(逻辑像素/DIP);「自动」模式下会随速度在此值基础上略增。
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("inkStrokePredictionMaxDistance")]
|
|
||||||
public double InkStrokePredictionMaxDistance { get; set; } = 18.0;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 「实时」笔锋(<see cref="InkStyle"/> = 3)下,速度项与硬件压感的混合比例 0–1。
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("velocityBrushTipMix")]
|
[JsonProperty("velocityBrushTipMix")]
|
||||||
public double VelocityBrushTipMix { get; set; } = 0.22;
|
public double VelocityBrushTipMix { get; set; } = 0.22;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 已弃用:请使用 <see cref="InkStyle"/> = 3(笔锋下拉选「实时」)。仅用于反序列化旧版配置。
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("enableVelocityBrushTip")]
|
[JsonProperty("enableVelocityBrushTip")]
|
||||||
public bool EnableVelocityBrushTip { get; set; }
|
public bool EnableVelocityBrushTip { get; set; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user