add:实时笔锋及墨迹预测

This commit is contained in:
2026-03-28 17:06:16 +08:00
parent de3f5d16a2
commit 56a65af9a7
6 changed files with 31 additions and 81 deletions
+17 -50
View File
@@ -1112,6 +1112,23 @@
IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold"
Toggled="ToggleSwitchEnableInkToShape_Toggled" />
</ikw:SimpleStackPanel>
<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" Width="520" />
<ikw:SimpleStackPanel Spacing="6"
Visibility="{Binding ElementName=ToggleSwitchEnableInkToShape, Path=IsOn, Converter={StaticResource BooleanToVisibilityConverter}}">
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
@@ -5674,31 +5691,6 @@
IsOn="False" />
</ikw:SimpleStackPanel>
</Controls:UniformGrid>
<ikw:SimpleStackPanel Orientation="Horizontal"
Margin="0,10,0,0" VerticalAlignment="Center">
<Label Content="墨迹预测" FontSize="12"
VerticalAlignment="Center"
Foreground="{DynamicResource FloatBarForeground}"
Margin="0,0,10,0" />
<ui:ToggleSwitch
x:Name="BoardToggleSwitchInkStrokePredictionPanel"
MinWidth="0" Width="80"
FontFamily="Microsoft YaHei UI"
Toggled="ToggleSwitchInkStrokePredictionPanel_Toggled" />
<ComboBox x:Name="BoardComboBoxInkStrokePredictionLead"
Width="130" Height="30" Margin="12,0,0,0"
FontFamily="Microsoft YaHei UI"
VerticalAlignment="Center"
Visibility="Collapsed"
SelectionChanged="ComboBoxInkStrokePredictionLead_SelectionChanged">
<ComboBoxItem Content="自动"
FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="25ms"
FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="50ms"
FontFamily="Microsoft YaHei UI" />
</ComboBox>
</ikw:SimpleStackPanel>
<StackPanel Orientation="Horizontal" Height="30">
<Label Margin="0,0,10,0" Content="粗细"
@@ -8743,31 +8735,6 @@
IsOn="{Binding ElementName=ToggleSwitchInkFadeInPanel, Path=IsOn}" />
</ikw:SimpleStackPanel>
</Controls:UniformGrid>
<ikw:SimpleStackPanel Orientation="Horizontal"
Margin="0,10,0,0" VerticalAlignment="Center">
<Label Content="墨迹预测" FontSize="12"
VerticalAlignment="Center"
Foreground="{DynamicResource FloatBarForeground}"
Margin="0,0,10,0" />
<ui:ToggleSwitch
x:Name="ToggleSwitchInkStrokePredictionPanel"
MinWidth="0" Width="80"
FontFamily="Microsoft YaHei UI"
Toggled="ToggleSwitchInkStrokePredictionPanel_Toggled" />
<ComboBox x:Name="ComboBoxInkStrokePredictionLead"
Width="130" Height="30" Margin="12,0,0,0"
FontFamily="Microsoft YaHei UI"
VerticalAlignment="Center"
Visibility="Collapsed"
SelectionChanged="ComboBoxInkStrokePredictionLead_SelectionChanged">
<ComboBoxItem Content="自动"
FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="25ms"
FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="50ms"
FontFamily="Microsoft YaHei UI" />
</ComboBox>
</ikw:SimpleStackPanel>
<StackPanel Orientation="Horizontal" Height="30">
<Label Margin="0,0,10,0" Content="粗细" FontWeight="Bold"
+2 -4
View File
@@ -26,10 +26,8 @@ namespace Ink_Canvas
{
bool on = Settings?.Canvas != null && Settings.Canvas.EnableInkStrokePrediction;
var v = on ? Visibility.Visible : Visibility.Collapsed;
if (ComboBoxInkStrokePredictionLead != null)
ComboBoxInkStrokePredictionLead.Visibility = v;
if (BoardComboBoxInkStrokePredictionLead != null)
BoardComboBoxInkStrokePredictionLead.Visibility = v;
if (ComboBoxInkStrokePredictionLeadSettings != null)
ComboBoxInkStrokePredictionLeadSettings.Visibility = v;
}
catch
{
+4 -19
View File
@@ -2700,19 +2700,11 @@ namespace Ink_Canvas
SaveSettingsToFile();
}
private void ToggleSwitchInkStrokePredictionPanel_Toggled(object sender, RoutedEventArgs e)
private void ToggleSwitchInkStrokePredictionSettings_Toggled(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
bool on = ReferenceEquals(sender, BoardToggleSwitchInkStrokePredictionPanel)
? BoardToggleSwitchInkStrokePredictionPanel.IsOn
: ToggleSwitchInkStrokePredictionPanel.IsOn;
if (ReferenceEquals(sender, ToggleSwitchInkStrokePredictionPanel) && BoardToggleSwitchInkStrokePredictionPanel != null)
BoardToggleSwitchInkStrokePredictionPanel.IsOn = on;
else if (ReferenceEquals(sender, BoardToggleSwitchInkStrokePredictionPanel) && ToggleSwitchInkStrokePredictionPanel != null)
ToggleSwitchInkStrokePredictionPanel.IsOn = on;
bool on = ToggleSwitchInkStrokePredictionSettings != null && ToggleSwitchInkStrokePredictionSettings.IsOn;
Settings.Canvas.EnableInkStrokePrediction = on;
SyncInkStrokePredictionLeadComboVisibility();
if (!on)
@@ -2720,20 +2712,13 @@ namespace Ink_Canvas
SaveSettingsToFile();
}
private void ComboBoxInkStrokePredictionLead_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void ComboBoxInkStrokePredictionLeadSettings_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!isLoaded) return;
var cb = sender as ComboBox;
if (cb?.SelectedIndex < 0) return;
int idx = cb.SelectedIndex;
Settings.Canvas.InkStrokePredictionLeadMode = idx;
if (ReferenceEquals(cb, ComboBoxInkStrokePredictionLead) && BoardComboBoxInkStrokePredictionLead != null)
BoardComboBoxInkStrokePredictionLead.SelectedIndex = idx;
else if (ReferenceEquals(cb, BoardComboBoxInkStrokePredictionLead) && ComboBoxInkStrokePredictionLead != null)
ComboBoxInkStrokePredictionLead.SelectedIndex = idx;
Settings.Canvas.InkStrokePredictionLeadMode = cb.SelectedIndex;
SaveSettingsToFile();
}
@@ -955,14 +955,10 @@ namespace Ink_Canvas
if (leadMode < 0 || leadMode > 2) leadMode = 0;
Settings.Canvas.InkStrokePredictionLeadMode = leadMode;
if (ToggleSwitchInkStrokePredictionPanel != null)
ToggleSwitchInkStrokePredictionPanel.IsOn = Settings.Canvas.EnableInkStrokePrediction;
if (BoardToggleSwitchInkStrokePredictionPanel != null)
BoardToggleSwitchInkStrokePredictionPanel.IsOn = Settings.Canvas.EnableInkStrokePrediction;
if (ComboBoxInkStrokePredictionLead != null)
ComboBoxInkStrokePredictionLead.SelectedIndex = leadMode;
if (BoardComboBoxInkStrokePredictionLead != null)
BoardComboBoxInkStrokePredictionLead.SelectedIndex = leadMode;
if (ToggleSwitchInkStrokePredictionSettings != null)
ToggleSwitchInkStrokePredictionSettings.IsOn = Settings.Canvas.EnableInkStrokePrediction;
if (ComboBoxInkStrokePredictionLeadSettings != null)
ComboBoxInkStrokePredictionLeadSettings.SelectedIndex = leadMode;
SyncInkStrokePredictionLeadComboVisibility();
}
else
+2
View File
@@ -224,6 +224,8 @@
<data name="Gesture_PalmHint" xml:space="preserve"><value># Low: larger area/more touches required (less false positive); High: easier to trigger but may mis-detect fingers.</value></data>
<data name="InkRecog_Title" xml:space="preserve"><value>Ink correction</value></data>
<data name="InkRecog_EnableInkRecognition" xml:space="preserve"><value>Enable ink recognition</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_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>
+2
View File
@@ -239,6 +239,8 @@
<data name="Gesture_PalmHint" xml:space="preserve"><value># 低敏感度:需要更大的触摸面积和更多触摸点,减少误判;高敏感度:更容易触发手掌擦,但可能误判手指。</value></data>
<data name="InkRecog_Title" xml:space="preserve"><value>墨迹纠正</value></data>
<data name="InkRecog_EnableInkRecognition" xml:space="preserve"><value>启用墨迹识别</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_BlockTriFakePressure" xml:space="preserve"><value>阻止矫正后的三角形带有模拟压感值</value></data>
<data name="InkRecog_FixTriangle" xml:space="preserve"><value>矫正手绘三角形</value></data>