优化代码
This commit is contained in:
@@ -130,6 +130,13 @@ namespace Ink_Canvas
|
||||
{
|
||||
try
|
||||
{
|
||||
// 隐藏图片选择工具栏
|
||||
if (currentSelectedElement != null)
|
||||
{
|
||||
UnselectElement(currentSelectedElement);
|
||||
currentSelectedElement = null;
|
||||
}
|
||||
|
||||
var targetIndex = isBackupMain ? 0 : CurrentWhiteboardIndex;
|
||||
|
||||
// 先清空当前画布的墨迹
|
||||
@@ -209,7 +216,12 @@ namespace Ink_Canvas
|
||||
{
|
||||
if (CurrentWhiteboardIndex <= 1) return;
|
||||
|
||||
|
||||
// 隐藏图片选择工具栏
|
||||
if (currentSelectedElement != null)
|
||||
{
|
||||
UnselectElement(currentSelectedElement);
|
||||
currentSelectedElement = null;
|
||||
}
|
||||
|
||||
SaveStrokes();
|
||||
|
||||
@@ -229,11 +241,17 @@ namespace Ink_Canvas
|
||||
inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber) SaveScreenShot(true);
|
||||
if (CurrentWhiteboardIndex >= WhiteboardTotalCount)
|
||||
{
|
||||
// 在最后一页时,点击“新页面”按钮直接新增一页
|
||||
// 在最后一页时,点击"新页面"按钮直接新增一页
|
||||
BtnWhiteBoardAdd_Click(sender, e);
|
||||
return;
|
||||
}
|
||||
|
||||
// 隐藏图片选择工具栏
|
||||
if (currentSelectedElement != null)
|
||||
{
|
||||
UnselectElement(currentSelectedElement);
|
||||
currentSelectedElement = null;
|
||||
}
|
||||
|
||||
SaveStrokes();
|
||||
|
||||
@@ -251,6 +269,13 @@ namespace Ink_Canvas
|
||||
if (Settings.Automation.IsAutoSaveStrokesAtClear &&
|
||||
inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber) SaveScreenShot(true);
|
||||
|
||||
// 隐藏图片选择工具栏
|
||||
if (currentSelectedElement != null)
|
||||
{
|
||||
UnselectElement(currentSelectedElement);
|
||||
currentSelectedElement = null;
|
||||
}
|
||||
|
||||
SaveStrokes();
|
||||
ClearStrokes(true);
|
||||
|
||||
@@ -279,6 +304,13 @@ namespace Ink_Canvas
|
||||
|
||||
private void BtnWhiteBoardDelete_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 隐藏图片选择工具栏
|
||||
if (currentSelectedElement != null)
|
||||
{
|
||||
UnselectElement(currentSelectedElement);
|
||||
currentSelectedElement = null;
|
||||
}
|
||||
|
||||
ClearStrokes(true);
|
||||
|
||||
if (CurrentWhiteboardIndex != WhiteboardTotalCount)
|
||||
|
||||
@@ -3096,19 +3096,16 @@ namespace Ink_Canvas
|
||||
// 检查快捷调色盘是否显示及其实际宽度
|
||||
bool isQuickColorPaletteVisible = false;
|
||||
double quickColorPaletteWidth = 0;
|
||||
string quickColorPaletteMode = "none";
|
||||
|
||||
|
||||
if (QuickColorPalettePanel != null && QuickColorPalettePanel.Visibility == Visibility.Visible)
|
||||
{
|
||||
isQuickColorPaletteVisible = true;
|
||||
quickColorPaletteWidth = QuickColorPalettePanel.ActualWidth > 0 ? QuickColorPalettePanel.ActualWidth : 60;
|
||||
quickColorPaletteMode = "double";
|
||||
}
|
||||
else if (QuickColorPaletteSingleRowPanel != null && QuickColorPaletteSingleRowPanel.Visibility == Visibility.Visible)
|
||||
{
|
||||
isQuickColorPaletteVisible = true;
|
||||
quickColorPaletteWidth = QuickColorPaletteSingleRowPanel.ActualWidth > 0 ? QuickColorPaletteSingleRowPanel.ActualWidth : 120;
|
||||
quickColorPaletteMode = "single";
|
||||
}
|
||||
|
||||
// 获取实际按钮宽度,如果获取不到则使用默认值,同时考虑按钮的可见性
|
||||
|
||||
@@ -86,6 +86,13 @@ namespace Ink_Canvas
|
||||
// 只有当选择的页面与当前页面不同时才进行切换
|
||||
if (index + 1 != CurrentWhiteboardIndex)
|
||||
{
|
||||
// 隐藏图片选择工具栏
|
||||
if (currentSelectedElement != null)
|
||||
{
|
||||
UnselectElement(currentSelectedElement);
|
||||
currentSelectedElement = null;
|
||||
}
|
||||
|
||||
SaveStrokes();
|
||||
ClearStrokes(true);
|
||||
CurrentWhiteboardIndex = index + 1;
|
||||
@@ -108,6 +115,13 @@ namespace Ink_Canvas
|
||||
// 只有当选择的页面与当前页面不同时才进行切换
|
||||
if (index + 1 != CurrentWhiteboardIndex)
|
||||
{
|
||||
// 隐藏图片选择工具栏
|
||||
if (currentSelectedElement != null)
|
||||
{
|
||||
UnselectElement(currentSelectedElement);
|
||||
currentSelectedElement = null;
|
||||
}
|
||||
|
||||
SaveStrokes();
|
||||
ClearStrokes(true);
|
||||
CurrentWhiteboardIndex = index + 1;
|
||||
|
||||
@@ -74,9 +74,9 @@ namespace Ink_Canvas
|
||||
ToggleSwitchDrawShapeBorderAutoHide.IsOn = !ToggleSwitchDrawShapeBorderAutoHide.IsOn;
|
||||
|
||||
if (ToggleSwitchDrawShapeBorderAutoHide.IsOn)
|
||||
((SymbolIcon)sender).Symbol = Symbol.Pin;
|
||||
((FontIcon)sender).Glyph = "";
|
||||
else
|
||||
((SymbolIcon)sender).Symbol = Symbol.UnPin;
|
||||
((FontIcon)sender).Glyph = "";
|
||||
}
|
||||
|
||||
private object lastMouseDownSender;
|
||||
|
||||
Reference in New Issue
Block a user