add:实时笔锋及墨迹预测

This commit is contained in:
2026-03-28 17:11:30 +08:00
parent 56a65af9a7
commit 55eb811193
4 changed files with 44 additions and 18 deletions
+7 -7
View File
@@ -1128,7 +1128,7 @@
</ComboBox> </ComboBox>
</ikw:SimpleStackPanel> </ikw:SimpleStackPanel>
<TextBlock Text="{i18n:I18n Key=InkRecog_InkStrokePredictionHint}" TextWrapping="Wrap" <TextBlock Text="{i18n:I18n Key=InkRecog_InkStrokePredictionHint}" TextWrapping="Wrap"
Foreground="#a1a1aa" Width="520" /> Foreground="#a1a1aa" HorizontalAlignment="Stretch" />
<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">
@@ -5634,16 +5634,16 @@
VerticalAlignment="Center" VerticalAlignment="Center"
Name="BoardComboBoxPenStyle" Name="BoardComboBoxPenStyle"
FontFamily="Microsoft YaHei UI" FontFamily="Microsoft YaHei UI"
SelectedIndex="0" SelectedIndex="1"
SelectionChanged="ComboBoxPenStyle_SelectionChanged"> SelectionChanged="ComboBoxPenStyle_SelectionChanged">
<ComboBoxItem Content="实时笔锋"
FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="基于点集" <ComboBoxItem Content="基于点集"
FontFamily="Microsoft YaHei UI" /> FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="基于速率" <ComboBoxItem Content="基于速率"
FontFamily="Microsoft YaHei UI" /> FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="关闭笔锋" <ComboBoxItem Content="关闭笔锋"
FontFamily="Microsoft YaHei UI" /> FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="实时"
FontFamily="Microsoft YaHei UI" />
</ComboBox> </ComboBox>
</ikw:SimpleStackPanel> </ikw:SimpleStackPanel>
<Controls:UniformGrid Columns="3" Width="300" <Controls:UniformGrid Columns="3" Width="300"
@@ -8683,16 +8683,16 @@
<ComboBox Height="30" VerticalAlignment="Center" <ComboBox Height="30" VerticalAlignment="Center"
Name="ComboBoxPenStyle" Name="ComboBoxPenStyle"
FontFamily="Microsoft YaHei UI" FontFamily="Microsoft YaHei UI"
SelectedIndex="0" SelectedIndex="1"
SelectionChanged="ComboBoxPenStyle_SelectionChanged"> SelectionChanged="ComboBoxPenStyle_SelectionChanged">
<ComboBoxItem Content="实时笔锋"
FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="基于点集" <ComboBoxItem Content="基于点集"
FontFamily="Microsoft YaHei UI" /> FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="基于速率" <ComboBoxItem Content="基于速率"
FontFamily="Microsoft YaHei UI" /> FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="关闭笔锋" <ComboBoxItem Content="关闭笔锋"
FontFamily="Microsoft YaHei UI" /> FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="实时"
FontFamily="Microsoft YaHei UI" />
</ComboBox> </ComboBox>
</ikw:SimpleStackPanel> </ikw:SimpleStackPanel>
<Controls:UniformGrid Columns="3" Width="300" Height="55"> <Controls:UniformGrid Columns="3" Width="300" Height="55">
+33 -8
View File
@@ -2784,19 +2784,44 @@ namespace Ink_Canvas
#region Canvas #region Canvas
/// <summary>笔锋下拉 UI 顺序:0 实时笔锋,1 基于点集,2 基于速率,3 关闭。与存储值 InkStyle3,0,1,2 对应。</summary>
private static int PenStyleUiIndexFromInkStyle(int inkStyle)
{
switch (inkStyle)
{
case 3: return 0;
case 0: return 1;
case 1: return 2;
case 2: return 3;
default: return 1;
}
}
private static int InkStyleFromPenStyleUiIndex(int uiIndex)
{
switch (uiIndex)
{
case 0: return 3;
case 1: return 0;
case 2: return 1;
case 3: return 2;
default: return 0;
}
}
private void ComboBoxPenStyle_SelectionChanged(object sender, SelectionChangedEventArgs e) private void ComboBoxPenStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
if (!isLoaded) return; if (!isLoaded) return;
int uiIndex = sender == ComboBoxPenStyle
? ComboBoxPenStyle.SelectedIndex
: BoardComboBoxPenStyle.SelectedIndex;
if (uiIndex < 0) return;
Settings.Canvas.InkStyle = InkStyleFromPenStyleUiIndex(uiIndex);
if (sender == ComboBoxPenStyle) if (sender == ComboBoxPenStyle)
{ BoardComboBoxPenStyle.SelectedIndex = uiIndex;
Settings.Canvas.InkStyle = ComboBoxPenStyle.SelectedIndex;
BoardComboBoxPenStyle.SelectedIndex = ComboBoxPenStyle.SelectedIndex;
}
else else
{ ComboBoxPenStyle.SelectedIndex = uiIndex;
Settings.Canvas.InkStyle = BoardComboBoxPenStyle.SelectedIndex;
ComboBoxPenStyle.SelectedIndex = BoardComboBoxPenStyle.SelectedIndex;
}
SaveSettingsToFile(); SaveSettingsToFile();
} }
@@ -833,8 +833,9 @@ namespace Ink_Canvas
if (Settings.Canvas.InkStyle < 0 || Settings.Canvas.InkStyle > 3) if (Settings.Canvas.InkStyle < 0 || Settings.Canvas.InkStyle > 3)
Settings.Canvas.InkStyle = 0; Settings.Canvas.InkStyle = 0;
ComboBoxPenStyle.SelectedIndex = Settings.Canvas.InkStyle; int penStyleUi = PenStyleUiIndexFromInkStyle(Settings.Canvas.InkStyle);
BoardComboBoxPenStyle.SelectedIndex = Settings.Canvas.InkStyle; ComboBoxPenStyle.SelectedIndex = penStyleUi;
BoardComboBoxPenStyle.SelectedIndex = penStyleUi;
ComboBoxEraserSize.SelectedIndex = Settings.Canvas.EraserSize; ComboBoxEraserSize.SelectedIndex = Settings.Canvas.EraserSize;
ComboBoxEraserSizeFloatingBar.SelectedIndex = Settings.Canvas.EraserSize; ComboBoxEraserSizeFloatingBar.SelectedIndex = Settings.Canvas.EraserSize;
+1 -1
View File
@@ -69,7 +69,7 @@ namespace Ink_Canvas
public double InkAlpha { get; set; } = 255; public double InkAlpha { get; set; } = 255;
[JsonProperty("isShowCursor")] [JsonProperty("isShowCursor")]
public bool IsShowCursor { get; set; } public bool IsShowCursor { get; set; }
/// <summary>笔锋:0 基于点集,1 基于速率,2 关闭,3 实时(速度与压感混合)。</summary> /// <summary>笔锋存储值:0 基于点集,1 基于速率,2 关闭,3 实时笔锋(速度与压感混合)。界面下拉顺序为实时笔锋、点集、速率、关闭。</summary>
[JsonProperty("inkStyle")] [JsonProperty("inkStyle")]
public int InkStyle { get; set; } public int InkStyle { get; set; }
[JsonProperty("eraserSize")] [JsonProperty("eraserSize")]