Files
community/Ink Canvas/Windows/SettingsViews/SettingsViews/InkRecognitionPanel.xaml
T
2026-01-10 17:32:14 +08:00

195 lines
16 KiB
XML

<UserControl x:Class="Ink_Canvas.Windows.SettingsViews.InkRecognitionPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
mc:Ignorable="d"
d:DesignHeight="950" d:DesignWidth="640">
<UserControl.Resources>
<!-- 开关样式模板 -->
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
<Setter Property="Width" Value="48"/>
<Setter Property="Height" Value="25"/>
<Setter Property="CornerRadius" Value="12"/>
<Setter Property="Padding" Value="3,0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Margin" Value="0,0,15,0"/>
</Style>
</UserControl.Resources>
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
<StackPanel Margin="60,12,60,24">
<!-- 墨迹识别主开关 -->
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
<StackPanel Orientation="Vertical">
<Grid Height="54">
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用墨迹识别" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="自动将手绘图形识别并转换为标准形状" HorizontalAlignment="Left"/>
</StackPanel>
<Border x:Name="ToggleSwitchEnableInkToShape" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
<Border.Effect>
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
</Border.Effect>
</Border>
</Border>
</Grid>
</StackPanel>
</Border>
<!-- 形状识别选项 -->
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8" x:Name="InkRecognitionOptionsPanel">
<StackPanel Orientation="Vertical">
<Grid Height="54">
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="阻止矫正后的矩形带有模拟压感值" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="矫正后的矩形不包含模拟压感信息" HorizontalAlignment="Left"/>
</StackPanel>
<Border x:Name="ToggleSwitchEnableInkToShapeNoFakePressureRectangle" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
<Border.Effect>
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
</Border.Effect>
</Border>
</Border>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="阻止矫正后的三角形带有模拟压感值" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="矫正后的三角形不包含模拟压感信息" HorizontalAlignment="Left"/>
</StackPanel>
<Border x:Name="ToggleSwitchEnableInkToShapeNoFakePressureTriangle" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
<Border.Effect>
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
</Border.Effect>
</Border>
</Border>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<StackPanel Orientation="Horizontal" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<CheckBox x:Name="ToggleCheckboxEnableInkToShapeTriangle" IsChecked="True">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="矫正手绘三角形" VerticalAlignment="Center"/>
</CheckBox>
</StackPanel>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<StackPanel Orientation="Horizontal" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<CheckBox x:Name="ToggleCheckboxEnableInkToShapeRectangle" IsChecked="True">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="矫正手绘矩形" VerticalAlignment="Center"/>
</CheckBox>
</StackPanel>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<StackPanel Orientation="Horizontal" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<CheckBox x:Name="ToggleCheckboxEnableInkToShapeRounded" IsChecked="True">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="矫正手绘圆形与椭圆" VerticalAlignment="Center"/>
</CheckBox>
</StackPanel>
</Grid>
</StackPanel>
</Border>
<!-- 直线识别设置 -->
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
<StackPanel Orientation="Vertical">
<Grid Height="54">
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="直线自动拉直" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="当绘制的直线超过设定长度阈值时,将自动调整为完美直线" HorizontalAlignment="Left"/>
</StackPanel>
<Border x:Name="ToggleSwitchAutoStraightenLine" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
<Border.Effect>
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
</Border.Effect>
</Border>
</Border>
</Grid>
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
<Grid MinHeight="54" x:Name="AutoStraightenLineSettingsPanel">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="18,8,0,8">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="长度阈值" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="设置直线自动拉直的最小长度" HorizontalAlignment="Left"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
<Slider x:Name="AutoStraightenLineThresholdSlider" Width="150" Minimum="30" Maximum="300" Value="80" TickFrequency="30" IsSnapToTickEnabled="True"/>
<TextBlock x:Name="AutoStraightenLineThresholdText" Text="80" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
</StackPanel>
</Grid>
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
<Grid MinHeight="54" x:Name="LineStraightenSensitivityPanel">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="18,8,0,8">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="灵敏度" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="越小要求越严格,越弯曲的线条越不容易被拉直;值越大越容易识别为直线" HorizontalAlignment="Left"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
<Slider x:Name="LineStraightenSensitivitySlider" Width="150" Minimum="0.05" Maximum="2.0" Value="0.20" TickFrequency="0.05" IsSnapToTickEnabled="True"/>
<TextBlock x:Name="LineStraightenSensitivityText" Text="0.20" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
</StackPanel>
</Grid>
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
<Grid Height="54" x:Name="HighPrecisionLineStraightenPanel">
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="高精度直线拉直" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="高精度模式下,每隔10像素取一个计数点,获取更准确的平均值用于判断" HorizontalAlignment="Left"/>
</StackPanel>
<Border x:Name="ToggleSwitchHighPrecisionLineStraighten" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
<Border.Effect>
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
</Border.Effect>
</Border>
</Border>
</Grid>
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
<Grid Height="54">
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="直线端点吸附" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="当绘制的直线端点靠近其他直线端点时,将自动吸附连接" HorizontalAlignment="Left"/>
</StackPanel>
<Border x:Name="ToggleSwitchLineEndpointSnapping" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
<Border.Effect>
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
</Border.Effect>
</Border>
</Border>
</Grid>
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
<Grid MinHeight="54" x:Name="LineEndpointSnappingThresholdPanel">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="18,8,0,8">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="吸附距离" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="设置直线端点自动吸附的最大距离" HorizontalAlignment="Left"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
<Slider x:Name="LineEndpointSnappingThresholdSlider" Width="150" Minimum="5" Maximum="50" Value="15" TickFrequency="5" IsSnapToTickEnabled="True"/>
<TextBlock x:Name="LineEndpointSnappingThresholdText" Text="15" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
</StackPanel>
</Grid>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
</UserControl>