Skip to content

Commit

Permalink
[BugFix] 修复导致墨迹颜色切换错误的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Raspberry-Monster committed Jun 2, 2024
1 parent be77ddd commit af6da08
Showing 1 changed file with 26 additions and 40 deletions.
66 changes: 26 additions & 40 deletions Ink Canvas/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1483,26 +1483,7 @@ private void BtnSwitchTheme_Click(object sender, RoutedEventArgs e)
GridBackgroundCover.Background = new SolidColorBrush(StringToColor("#FFF2F2F2"));
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Dark;
if (currentMode %2 == 0) SetDarkColors(); //在浅色背景上使用深色墨迹
if (inkColor == 0)
{
inkCanvas.DefaultDrawingAttributes.Color = Colors.White;
}
else if (inkColor == 1)
{
BtnColorRed_Click(null, null);
}
else if (inkColor == 2)
{
BtnColorGreen_Click(null, null);
}
else if (inkColor == 3)
{
BtnColorBlue_Click(null, null);
}
else if (inkColor == 4)
{
BtnColorYellow_Click(null, null);
}
SetColorByIndex();
}
else
{
Expand All @@ -1515,32 +1496,36 @@ private void BtnSwitchTheme_Click(object sender, RoutedEventArgs e)
GridBackgroundCover.Background = new SolidColorBrush(StringToColor("#FF1A1A1A"));
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light;
if (currentMode % 2 == 0) SetLightColors(); //在深色背景上使用浅色墨迹
if (inkColor == 0)
{
inkCanvas.DefaultDrawingAttributes.Color = Colors.White;
}
else if (inkColor == 1)
{
BtnColorRed_Click(null, null);
}
else if (inkColor == 2)
{
BtnColorGreen_Click(null, null);
}
else if (inkColor == 3)
{
BtnColorBlue_Click(null, null);
}
else if (inkColor == 4)
{
BtnColorYellow_Click(null, null);
}
SetColorByIndex();
}
if (!Settings.Appearance.IsTransparentButtonBackground)
{
ToggleSwitchTransparentButtonBackground_Toggled(ToggleSwitchTransparentButtonBackground, null);
}
}
private void SetColorByIndex()
{
if (inkColor == 0)
{
inkCanvas.DefaultDrawingAttributes.Color = Colors.White;
}
else if (inkColor == 1)
{
BtnColorRed_Click(null, null);
}
else if (inkColor == 2)
{
BtnColorGreen_Click(null, null);
}
else if (inkColor == 3)
{
BtnColorBlue_Click(null, null);
}
else if (inkColor == 4)
{
BtnColorYellow_Click(null, null);
}
}

int BoundsWidth = 5;
private void ToggleSwitchModeFinger_Toggled(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -7024,6 +7009,7 @@ private void ImageBlackboard_MouseUp(object sender, MouseButtonEventArgs e)

BtnExit.Foreground = Brushes.White;
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Dark;
SetColorByIndex();
}

private void ImageEraser_MouseUp(object sender, MouseButtonEventArgs e)
Expand Down

0 comments on commit af6da08

Please sign in to comment.