add:板刷模式
This commit is contained in:
@@ -8443,7 +8443,7 @@
|
||||
FontSize="17" VerticalAlignment="Center" />
|
||||
<Slider x:Name="InkWidthSlider" Minimum="1"
|
||||
Maximum="20"
|
||||
Width="208" FontFamily="Microsoft YaHei UI"
|
||||
Width="180" FontFamily="Microsoft YaHei UI"
|
||||
FontSize="20" IsSnapToTickEnabled="True"
|
||||
Value="5"
|
||||
TickFrequency="0.1" TickPlacement="None"
|
||||
@@ -8452,13 +8452,29 @@
|
||||
Text="{Binding Value, ElementName=InkWidthSlider, Mode=OneWay}"
|
||||
FontFamily="Consolas" VerticalAlignment="Bottom"
|
||||
Margin="10,0,0,4.5" FontSize="15" />
|
||||
<Border x:Name="BoardBrushModeButton" Width="24" Height="24" Margin="8,0,0,0"
|
||||
Background="{DynamicResource FloatBarBackground}"
|
||||
BorderBrush="{DynamicResource FloatBarBorderBrush}"
|
||||
BorderThickness="1" CornerRadius="2"
|
||||
VerticalAlignment="Center"
|
||||
MouseDown="Border_MouseDown"
|
||||
MouseUp="BoardBrushModeButton_MouseUp"
|
||||
ToolTip="板刷模式">
|
||||
<Viewbox Margin="4" Stretch="Uniform">
|
||||
<Path x:Name="BoardBrushModeIcon" Fill="{DynamicResource FloatBarForeground}" Stretch="Fill">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M6.7812 6.9375C6.81411 7.06468 6.87172 7.18413 6.95081 7.28903C7.0299 7.39392 7.12891 7.4822 7.24213 7.54882C7.47058 7.68347 7.74313 7.72187 7.99989 7.65557C8.25664 7.58928 8.47657 7.42372 8.61128 7.19531L11.9238 1.57031C12.0584 1.34186 12.0968 1.06928 12.0305 0.812526C11.9642 0.555772 11.7987 0.335869 11.5703 0.201167C11.3418 0.0665197 11.0693 0.028121 10.8125 0.0944166C10.5558 0.160712 10.3358 0.326268 10.2011 0.554683L6.88862 6.17968C6.82183 6.29276 6.77796 6.41788 6.75953 6.54791C6.7411 6.67793 6.74847 6.81031 6.7812 6.9375Z M5.21875 5.09375L10.1662 8.14759C10.7697 8.46231 10.9861 9.26072 10.3308 9.74464L9.70892 9.96117L3.6897 6.43971L3.7074 5.53239C3.99623 4.94715 4.46209 4.71653 5.21875 5.09375Z M3.05377 7.48846L9.04364 10.9631L7.99908 12.5052C7.77811 12.7482 7.86648 13.0797 8.08746 13.2123L9.03766 14.0298H3.66809C1.47755 14.0298 0.471255 11.9653 1.52466 10.1408L3.05377 7.48846Z" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Height="30">
|
||||
<Label Margin="0,0,10,0" Content="透明" FontWeight="Bold"
|
||||
Foreground="{DynamicResource FloatBarForeground}"
|
||||
FontSize="17" VerticalAlignment="Center" />
|
||||
<Slider x:Name="InkAlphaSlider" Margin="0,0,0,0"
|
||||
Minimum="1" Maximum="255" Width="208"
|
||||
Minimum="1" Maximum="255" Width="180"
|
||||
FontFamily="Microsoft YaHei UI" FontSize="20"
|
||||
IsSnapToTickEnabled="True" Value="255"
|
||||
TickFrequency="1"
|
||||
|
||||
@@ -412,6 +412,9 @@ namespace Ink_Canvas
|
||||
|
||||
private DispatcherTimer _brushAutoRestoreTimer;
|
||||
|
||||
private bool _isBoardBrushMode;
|
||||
private double _savedInkWidthBeforeBoardBrush = 5;
|
||||
|
||||
private void loadPenCanvas()
|
||||
{
|
||||
try
|
||||
@@ -567,6 +570,62 @@ namespace Ink_Canvas
|
||||
}
|
||||
}
|
||||
|
||||
private const double BoardBrushInkWidth = 300;
|
||||
|
||||
private void BoardBrushModeButton_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (sender != BoardBrushModeButton) return;
|
||||
if (lastBorderMouseDownObject != BoardBrushModeButton) return;
|
||||
|
||||
_isBoardBrushMode = !_isBoardBrushMode;
|
||||
|
||||
try
|
||||
{
|
||||
if (drawingAttributes == null)
|
||||
drawingAttributes = inkCanvas.DefaultDrawingAttributes;
|
||||
|
||||
if (penType == 1) return;
|
||||
|
||||
if (_isBoardBrushMode)
|
||||
{
|
||||
_savedInkWidthBeforeBoardBrush = InkWidthSlider != null ? InkWidthSlider.Value / 2.0 : drawingAttributes.Width;
|
||||
if (_savedInkWidthBeforeBoardBrush < 0.5) _savedInkWidthBeforeBoardBrush = 2.5;
|
||||
|
||||
drawingAttributes.Width = BoardBrushInkWidth;
|
||||
drawingAttributes.Height = BoardBrushInkWidth;
|
||||
inkCanvas.DefaultDrawingAttributes.Width = BoardBrushInkWidth;
|
||||
inkCanvas.DefaultDrawingAttributes.Height = BoardBrushInkWidth;
|
||||
drawingAttributes.IgnorePressure = true;
|
||||
inkCanvas.DefaultDrawingAttributes.IgnorePressure = true;
|
||||
|
||||
if (BoardBrushModeButton != null)
|
||||
BoardBrushModeButton.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235));
|
||||
}
|
||||
else
|
||||
{
|
||||
double w = InkWidthSlider != null ? InkWidthSlider.Value / 2.0 : _savedInkWidthBeforeBoardBrush;
|
||||
if (w < 0.5) w = 2.5;
|
||||
|
||||
drawingAttributes.Width = w;
|
||||
drawingAttributes.Height = w;
|
||||
inkCanvas.DefaultDrawingAttributes.Width = w;
|
||||
inkCanvas.DefaultDrawingAttributes.Height = w;
|
||||
drawingAttributes.IgnorePressure = Settings.Canvas.DisablePressure;
|
||||
inkCanvas.DefaultDrawingAttributes.IgnorePressure = Settings.Canvas.DisablePressure;
|
||||
|
||||
if (BoardInkWidthSlider != null) BoardInkWidthSlider.Value = w * 2;
|
||||
if (Settings?.Canvas != null) Settings.Canvas.InkWidth = w;
|
||||
|
||||
if (BoardBrushModeButton != null)
|
||||
BoardBrushModeButton.ClearValue(BackgroundProperty);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"BoardBrushModeButton_MouseUp: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void InitBrushAutoRestoreTimer()
|
||||
{
|
||||
if (_brushAutoRestoreTimer == null)
|
||||
|
||||
Reference in New Issue
Block a user