refactor: 优化动画逻辑和UI组件结构

重构动画帮助类以支持自定义动画目标
简化颜色滑块更新逻辑
调整浮动工具栏显示逻辑
新增BoardMenuFrame自定义控件
This commit is contained in:
PrefacedCorg
2026-05-01 12:34:16 +08:00
parent 21d5ee25ea
commit 90ba3f7fa6
7 changed files with 368 additions and 370 deletions
+3 -47
View File
@@ -442,53 +442,9 @@ namespace Ink_Canvas
/// </summary>
private void UpdateRGBSliders(Color color)
{
if (BackgroundPalette != null && BackgroundPalette.Child is StackPanel stackPanel)
{
if (stackPanel.Children.Count > 1 && stackPanel.Children[1] is StackPanel contentPanel)
{
// 查找RGB滑块
Slider rSlider = null;
Slider gSlider = null;
Slider bSlider = null;
// 遍历面板查找RGB滑块
foreach (var child in contentPanel.Children)
{
if (child is StackPanel panel && panel.Orientation == Orientation.Horizontal)
{
foreach (var panelChild in panel.Children)
{
if (panelChild is Slider slider)
{
if (panel.Children.Count > 0 && panel.Children[0] is TextBlock label)
{
if (label.Text == "R:")
{
rSlider = slider;
}
else if (label.Text == "G:")
{
gSlider = slider;
}
else if (label.Text == "B:")
{
bSlider = slider;
}
}
}
}
}
}
// 更新滑块值
if (rSlider != null && gSlider != null && bSlider != null)
{
rSlider.Value = color.R;
gSlider.Value = color.G;
bSlider.Value = color.B;
}
}
}
if (BackgroundRSlider != null) BackgroundRSlider.Value = color.R;
if (BackgroundGSlider != null) BackgroundGSlider.Value = color.G;
if (BackgroundBSlider != null) BackgroundBSlider.Value = color.B;
}
}
}