[update] 白板的橡皮擦面板现在可以工作了

This commit is contained in:
Dubi906w 2024-06-10 22:06:58 +08:00
parent 4d41e6ae34
commit e0b2ce7e48
7 changed files with 163 additions and 46 deletions

View File

@ -49,9 +49,6 @@
<RoutedUICommand x:Key="HotKey_ChangeToPen5" Text=" " />
<RoutedUICommand x:Key="HotKey_DrawLine" Text=" " />
</Window.Resources>
<WindowChrome.WindowChrome>
<WindowChrome GlassFrameThickness="-1" />
</WindowChrome.WindowChrome>
<!--输入命令绑定-->
<Window.InputBindings>
<KeyBinding Gesture="Shift+Esc" Command="{StaticResource KeyExit}" />
@ -296,11 +293,11 @@
<ComboBox Name="ComboBoxEraserSize" FontFamily="Microsoft YaHei UI"
SelectedIndex="2"
SelectionChanged="ComboBoxEraserSize_SelectionChanged">
<ComboBoxItem Content="小" FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="小" FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="较小" FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="中(默认)" FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="中" FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="较大" FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="大" FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="大" FontFamily="Microsoft YaHei UI" />
</ComboBox>
</ui:SimpleStackPanel>
<TextBlock Text="# 非实时切换,下一次使用面积擦时生效。" TextWrapping="Wrap" Foreground="#a1a1aa" />
@ -2922,7 +2919,7 @@
</Grid>
</Border>
<Border>
<Grid RenderTransformOrigin="0,1" Margin="-133,-134,13,55">
<Grid RenderTransformOrigin="0,1" Margin="-133,-172,13,55">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
@ -2946,7 +2943,7 @@
TextAlignment="Center" />
</Canvas>
</Border>
<ui:SimpleStackPanel Orientation="Horizontal" Margin="0,8,0,0"
<ui:SimpleStackPanel Orientation="Horizontal" Margin="0,6,0,0"
Spacing="-2"
VerticalAlignment="Center"
HorizontalAlignment="Center">
@ -2955,7 +2952,7 @@
FontSize="10"
VerticalAlignment="Center" />
<Viewbox Margin="8,0,0,0" Height="20" Width="52">
<ComboBox Name="BoardComboBoxEraserSizeFloatingBar"
<ComboBox Name="BoardComboBoxEraserSize"
FontFamily="Microsoft YaHei UI" SelectedIndex="2"
SelectionChanged="ComboBoxEraserSizeFloatingBar_SelectionChanged">
<ComboBoxItem Content="很小" FontFamily="Microsoft YaHei UI" />
@ -2966,7 +2963,7 @@
</ComboBox>
</Viewbox>
</ui:SimpleStackPanel>
<TextBlock HorizontalAlignment="Center" Margin="0,12,0,6" Text="橡皮形状"
<TextBlock HorizontalAlignment="Center" Margin="0,8,0,6" Text="橡皮形状"
FontWeight="Bold"
Foreground="{DynamicResource FloatBarForeground}"
FontSize="10" VerticalAlignment="Center" />
@ -3028,6 +3025,52 @@
</Canvas>
</Border>
</ui:SimpleStackPanel>
<Button Click="BoardSymbolIconDelete_MouseUp" Foreground="White" HorizontalAlignment="Center" Margin="0,6,0,0">
<Button.Resources>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundKey}" Color="#b91c1c"/>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundPointerOverKey}" Color="#b91c1c"/>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundPressedKey}" Color="#991b1b"/>
</Button.Resources>
<Button.Content>
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Image RenderOptions.BitmapScalingMode="HighQuality" Height="15">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="White" Geometry="F0 M24,24z M0,0z M10.1573,10.0421C10.7298,10.0421,11.1938,10.5062,11.1938,11.0787L11.1938,16.6067C11.1938,17.1792 10.7298,17.6433 10.1573,17.6433 9.58485,17.6433 9.12079,17.1792 9.12079,16.6067L9.12079,11.0787C9.12079,10.5062,9.58485,10.0421,10.1573,10.0421z M13.8427,10.0421C14.4151,10.0421,14.8792,10.5062,14.8792,11.0787L14.8792,16.6067C14.8792,17.1792 14.4151,17.6433 13.8427,17.6433 13.2702,17.6433 12.8062,17.1792 12.8062,16.6067L12.8062,11.0787C12.8062,10.5062,13.2702,10.0421,13.8427,10.0421z M3.70787,5.43539C3.13541,5.43539 2.67135,5.89946 2.67135,6.47191 2.67135,7.04436 3.13541,7.50843 3.70787,7.50843L4.51405,7.50843 4.51405,19.3708C4.51405,20.1686 4.9025,20.8796 5.39348,21.3706 5.88445,21.8615 6.59548,22.25 7.39326,22.25L16.6067,22.25C17.4045,22.25 18.1155,21.8615 18.6065,21.3706 19.0975,20.8796 19.486,20.1686 19.486,19.3708L19.486,7.50843 20.2921,7.50843C20.8646,7.50843 21.3287,7.04436 21.3287,6.47191 21.3287,5.89946 20.8646,5.43539 20.2921,5.43539L16.7219,5.43539 16.7219,4.62921C16.7219,3.83143 16.3335,3.12041 15.8425,2.62943 15.3515,2.13845 14.6405,1.75 13.8427,1.75L10.1573,1.75C9.35952,1.75 8.6485,2.13845 8.15752,2.62943 7.66654,3.12041 7.27809,3.83143 7.27809,4.62921L7.27809,5.43539 3.70787,5.43539z M6.58708,19.3708C6.58708,19.4944 6.6593,19.7047 6.85933,19.9047 7.05937,20.1047 7.26969,20.177 7.39326,20.177L16.6067,20.177C16.7303,20.177 16.9406,20.1047 17.1407,19.9047 17.3407,19.7047 17.4129,19.4944 17.4129,19.3708L17.4129,7.50843 6.58708,7.50843 6.58708,19.3708z M9.62338,4.09529C9.42334,4.29532,9.35112,4.50565,9.35112,4.62921L9.35112,5.43539 14.6489,5.43539 14.6489,4.62921C14.6489,4.50565 14.5767,4.29532 14.3766,4.09529 14.1766,3.89525 13.9663,3.82303 13.8427,3.82303L10.1573,3.82303C10.0337,3.82303,9.82341,3.89525,9.62338,4.09529z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock FontSize="11" VerticalAlignment="Center" Foreground="White" FontWeight="Bold">清空墨迹</TextBlock>
</ui:SimpleStackPanel>
</Button.Content>
</Button>
<Button Click="BoardSymbolIconDeleteInkAndHistories_MouseUp" Foreground="White" HorizontalAlignment="Center" Margin="0,4,0,0">
<Button.Resources>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundKey}" Color="#b91c1c"/>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundPointerOverKey}" Color="#b91c1c"/>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundPressedKey}" Color="#991b1b"/>
</Button.Resources>
<Button.Content>
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="4" Margin="-4,-1">
<Image RenderOptions.BitmapScalingMode="HighQuality" Height="12">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="White" Geometry="F0 M24,24z M0,0z M10.1573,10.0421C10.7298,10.0421,11.1938,10.5062,11.1938,11.0787L11.1938,16.6067C11.1938,17.1792 10.7298,17.6433 10.1573,17.6433 9.58485,17.6433 9.12079,17.1792 9.12079,16.6067L9.12079,11.0787C9.12079,10.5062,9.58485,10.0421,10.1573,10.0421z M13.8427,10.0421C14.4151,10.0421,14.8792,10.5062,14.8792,11.0787L14.8792,16.6067C14.8792,17.1792 14.4151,17.6433 13.8427,17.6433 13.2702,17.6433 12.8062,17.1792 12.8062,16.6067L12.8062,11.0787C12.8062,10.5062,13.2702,10.0421,13.8427,10.0421z M3.70787,5.43539C3.13541,5.43539 2.67135,5.89946 2.67135,6.47191 2.67135,7.04436 3.13541,7.50843 3.70787,7.50843L4.51405,7.50843 4.51405,19.3708C4.51405,20.1686 4.9025,20.8796 5.39348,21.3706 5.88445,21.8615 6.59548,22.25 7.39326,22.25L16.6067,22.25C17.4045,22.25 18.1155,21.8615 18.6065,21.3706 19.0975,20.8796 19.486,20.1686 19.486,19.3708L19.486,7.50843 20.2921,7.50843C20.8646,7.50843 21.3287,7.04436 21.3287,6.47191 21.3287,5.89946 20.8646,5.43539 20.2921,5.43539L16.7219,5.43539 16.7219,4.62921C16.7219,3.83143 16.3335,3.12041 15.8425,2.62943 15.3515,2.13845 14.6405,1.75 13.8427,1.75L10.1573,1.75C9.35952,1.75 8.6485,2.13845 8.15752,2.62943 7.66654,3.12041 7.27809,3.83143 7.27809,4.62921L7.27809,5.43539 3.70787,5.43539z M6.58708,19.3708C6.58708,19.4944 6.6593,19.7047 6.85933,19.9047 7.05937,20.1047 7.26969,20.177 7.39326,20.177L16.6067,20.177C16.7303,20.177 16.9406,20.1047 17.1407,19.9047 17.3407,19.7047 17.4129,19.4944 17.4129,19.3708L17.4129,7.50843 6.58708,7.50843 6.58708,19.3708z M9.62338,4.09529C9.42334,4.29532,9.35112,4.50565,9.35112,4.62921L9.35112,5.43539 14.6489,5.43539 14.6489,4.62921C14.6489,4.50565 14.5767,4.29532 14.3766,4.09529 14.1766,3.89525 13.9663,3.82303 13.8427,3.82303L10.1573,3.82303C10.0337,3.82303,9.82341,3.89525,9.62338,4.09529z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock FontSize="9" VerticalAlignment="Center" Foreground="White">清空墨迹和历史</TextBlock>
</ui:SimpleStackPanel>
</Button.Content>
</Button>
</ui:SimpleStackPanel>
</Border>
</Grid>
@ -3572,7 +3615,7 @@
Foreground="{Binding ElementName=BtnExit, Path=Foreground}"
Background="{Binding ElementName=BtnExit, Path=Background}"
VerticalContentAlignment="Center"
IsEnabled="False" IsEnabledChanged="Btn_IsEnabledChanged">
IsEnabled="True" IsEnabledChanged="Btn_IsEnabledChanged">
<Image RenderTransformOrigin="0.5,0.5" Opacity="0.25">
<Image.RenderTransform>
<TransformGroup>

View File

@ -179,6 +179,9 @@ namespace Ink_Canvas {
isLoaded = true;
BlackBoardLeftSidePageListView.ItemsSource = blackBoardLeftSidePageListViewObservableCollection;
BtnLeftWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27));
BtnLeftWhiteBoardSwitchPreviousLabel.Opacity = 0.5;
BtnWhiteBoardSwitchPrevious.IsEnabled = CurrentWhiteboardIndex != 1;
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) {

View File

@ -120,6 +120,8 @@ namespace Ink_Canvas {
}
private void BtnWhiteBoardSwitchNext_Click(object sender, EventArgs e) {
Trace.WriteLine("113223234");
if (Settings.Automation.IsAutoSaveStrokesAtClear &&
inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber) SaveScreenShot(true);
if (CurrentWhiteboardIndex >= WhiteboardTotalCount) {
@ -205,23 +207,28 @@ namespace Ink_Canvas {
//BoardLeftPannelNextPageTextBlock.Text = "下一页";
}
BtnWhiteBoardSwitchPrevious.IsEnabled = CurrentWhiteboardIndex != 1;
BtnWhiteBoardSwitchPrevious.IsEnabled = true;
BtnWhiteBoardSwitchNext.IsEnabled = true;
if (CurrentWhiteboardIndex == 1) {
BtnWhiteBoardSwitchPrevious.IsEnabled = false;
BtnLeftWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27));
BtnLeftWhiteBoardSwitchPreviousLabel.Opacity = 0.5;
BtnLeftWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
BtnLeftWhiteBoardSwitchNextLabel.Opacity = 1;
} else {
BtnLeftWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
BtnLeftWhiteBoardSwitchPreviousLabel.Opacity = 1;
}
BtnWhiteBoardSwitchNext.IsEnabled = CurrentWhiteboardIndex != WhiteboardTotalCount;
if (CurrentWhiteboardIndex == WhiteboardTotalCount) {
BtnLeftWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27));
BtnLeftWhiteBoardSwitchNextLabel.Opacity = 0.5;
BtnWhiteBoardSwitchNext.IsEnabled = false;
} else {
BtnLeftWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
BtnLeftWhiteBoardSwitchNextLabel.Opacity = 1;
}
}
BtnWhiteBoardDelete.IsEnabled = WhiteboardTotalCount != 1;
}

View File

@ -26,14 +26,20 @@ namespace Ink_Canvas {
}
private void BoardEraserIcon_Click(object sender, RoutedEventArgs e) {
//if (BoardEraser.Background.ToString() == "#FF679CF4") {
// AnimationsHelper.ShowWithSlideFromBottomAndFade(BoardDeleteIcon);
//}
//else {
if (inkCanvas.EditingMode == InkCanvasEditingMode.EraseByPoint ||
inkCanvas.EditingMode == InkCanvasEditingMode.EraseByStroke) {
if (BoardEraserSizePanel.Visibility == Visibility.Collapsed) {
AnimationsHelper.ShowWithSlideFromBottomAndFade(BoardEraserSizePanel);
} else {
AnimationsHelper.HideWithSlideAndFade(BoardEraserSizePanel);
}
} else {
forceEraser = true;
forcePointEraser = true;
double k = 1;
switch (Settings.Canvas.EraserSize) {
if (Settings.Canvas.EraserShapeType == 0) {
switch (BoardComboBoxEraserSize.SelectedIndex)
{
case 0:
k = 0.5;
break;
@ -47,8 +53,25 @@ namespace Ink_Canvas {
k = 1.8;
break;
}
inkCanvas.EraserShape = new EllipseStylusShape(k * 90, k * 90);
} else if (Settings.Canvas.EraserShapeType == 1) {
switch (BoardComboBoxEraserSize.SelectedIndex)
{
case 0:
k = 0.7;
break;
case 1:
k = 0.9;
break;
case 3:
k = 1.2;
break;
case 4:
k = 1.6;
break;
}
inkCanvas.EraserShape = new RectangleStylusShape(k * 90 * 0.6, k * 90);
}
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
drawingShapeMode = 0;
@ -56,7 +79,7 @@ namespace Ink_Canvas {
CancelSingleFingerDragMode();
HideSubPanels("eraser");
//}
}
}
private void BoardEraserIconByStrokes_Click(object sender, RoutedEventArgs e) {
@ -78,9 +101,15 @@ namespace Ink_Canvas {
//}
}
private void BoardSymbolIconDelete_MouseUp(object sender, MouseButtonEventArgs e) {
private void BoardSymbolIconDelete_MouseUp(object sender, RoutedEventArgs e) {
PenIcon_Click(null, null);
SymbolIconDelete_MouseUp(sender, e);
SymbolIconDelete_MouseUp(null, null);
}
private void BoardSymbolIconDeleteInkAndHistories_MouseUp(object sender, RoutedEventArgs e)
{
PenIcon_Click(null, null);
SymbolIconDelete_MouseUp(null, null);
if (Settings.Canvas.ClearCanvasAndClearTimeMachine == false) timeMachine.ClearStrokeHistory();
}
private void BoardLaunchEasiCamera_MouseUp(object sender, MouseButtonEventArgs e) {

View File

@ -716,6 +716,19 @@ namespace Ink_Canvas {
RectangleEraserTabButtonText.FontSize = 9;
RectangleEraserTabButtonText.Margin = new Thickness(2, 1, 0, 0);
RectangleEraserTabButtonIndicator.Visibility = Visibility.Collapsed;
BoardCircleEraserTabButton.Background = new SolidColorBrush(Color.FromArgb(85, 59, 130, 246));
BoardCircleEraserTabButton.Opacity = 1;
BoardCircleEraserTabButtonText.FontWeight = FontWeights.Bold;
BoardCircleEraserTabButtonText.Margin = new Thickness(2, 0.5, 0, 0);
BoardCircleEraserTabButtonText.FontSize = 9.5;
BoardCircleEraserTabButtonIndicator.Visibility = Visibility.Visible;
BoardRectangleEraserTabButton.Background = new SolidColorBrush(Colors.Transparent);
BoardRectangleEraserTabButton.Opacity = 0.75;
BoardRectangleEraserTabButtonText.FontWeight = FontWeights.Normal;
BoardRectangleEraserTabButtonText.FontSize = 9;
BoardRectangleEraserTabButtonText.Margin = new Thickness(2, 1, 0, 0);
BoardRectangleEraserTabButtonIndicator.Visibility = Visibility.Collapsed;
}
else {
RectangleEraserTabButton.Background = new SolidColorBrush(Color.FromArgb(85, 59, 130, 246));
@ -730,6 +743,19 @@ namespace Ink_Canvas {
CircleEraserTabButtonText.FontSize = 9;
CircleEraserTabButtonText.Margin = new Thickness(2, 1, 0, 0);
CircleEraserTabButtonIndicator.Visibility = Visibility.Collapsed;
BoardRectangleEraserTabButton.Background = new SolidColorBrush(Color.FromArgb(85, 59, 130, 246));
BoardRectangleEraserTabButton.Opacity = 1;
BoardRectangleEraserTabButtonText.FontWeight = FontWeights.Bold;
BoardRectangleEraserTabButtonText.Margin = new Thickness(2, 0.5, 0, 0);
BoardRectangleEraserTabButtonText.FontSize = 9.5;
BoardRectangleEraserTabButtonIndicator.Visibility = Visibility.Visible;
BoardCircleEraserTabButton.Background = new SolidColorBrush(Colors.Transparent);
BoardCircleEraserTabButton.Opacity = 0.75;
BoardCircleEraserTabButtonText.FontWeight = FontWeights.Normal;
BoardCircleEraserTabButtonText.FontSize = 9;
BoardCircleEraserTabButtonText.Margin = new Thickness(2, 1, 0, 0);
BoardCircleEraserTabButtonIndicator.Visibility = Visibility.Collapsed;
}
}

View File

@ -351,11 +351,19 @@ namespace Ink_Canvas {
private void ComboBoxEraserSizeFloatingBar_SelectionChanged(object sender, SelectionChangedEventArgs e) {
if (!isLoaded) return;
Settings.Canvas.EraserSize = ComboBoxEraserSizeFloatingBar.SelectedIndex;
ComboBoxEraserSize.SelectedIndex = ComboBoxEraserSizeFloatingBar.SelectedIndex;
ComboBox s = (ComboBox)sender;
Settings.Canvas.EraserSize = s.SelectedIndex;
if (s == ComboBoxEraserSizeFloatingBar) {
BoardComboBoxEraserSize.SelectedIndex = s.SelectedIndex;
ComboBoxEraserSize.SelectedIndex = s.SelectedIndex;
} else if (s == BoardComboBoxEraserSize) {
ComboBoxEraserSizeFloatingBar.SelectedIndex = s.SelectedIndex;
ComboBoxEraserSize.SelectedIndex = s.SelectedIndex;
}
if (Settings.Canvas.EraserShapeType == 0) {
double k = 1;
switch (ComboBoxEraserSizeFloatingBar.SelectedIndex) {
switch (s.SelectedIndex) {
case 0:
k = 0.5;
break;
@ -373,7 +381,7 @@ namespace Ink_Canvas {
inkCanvas.EraserShape = new EllipseStylusShape(k * 90, k * 90);
} else if (Settings.Canvas.EraserShapeType == 1) {
double k = 1;
switch (ComboBoxEraserSizeFloatingBar.SelectedIndex) {
switch (s.SelectedIndex) {
case 0:
k = 0.7;
break;

View File

@ -378,6 +378,7 @@ namespace Ink_Canvas {
ComboBoxEraserSize.SelectedIndex = Settings.Canvas.EraserSize;
ComboBoxEraserSizeFloatingBar.SelectedIndex = Settings.Canvas.EraserSize;
BoardComboBoxEraserSize.SelectedIndex = Settings.Canvas.EraserSize;
ToggleSwitchClearCanvasAndClearTimeMachine.IsOn =
Settings.Canvas.ClearCanvasAndClearTimeMachine == true;