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
+141
View File
@@ -0,0 +1,141 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
namespace Ink_Canvas.Controls
{
[TemplatePart(Name = PartCloseImage, Type = typeof(UIElement))]
[TemplatePart(Name = PartAnimationRoot, Type = typeof(UIElement))]
public class BoardMenuFrame : ContentControl
{
private const string PartCloseImage = "PART_CloseImage";
private const string PartAnimationRoot = "PART_AnimationRoot";
public static readonly DependencyProperty TitleProperty =
DependencyProperty.Register(nameof(Title), typeof(object), typeof(BoardMenuFrame), new PropertyMetadata(null));
public static readonly DependencyProperty TitleFontSizeProperty =
DependencyProperty.Register(nameof(TitleFontSize), typeof(double), typeof(BoardMenuFrame), new PropertyMetadata(11d));
public static readonly DependencyProperty HeaderHeightProperty =
DependencyProperty.Register(nameof(HeaderHeight), typeof(double), typeof(BoardMenuFrame), new PropertyMetadata(48d));
public static readonly DependencyProperty PanelCornerRadiusProperty =
DependencyProperty.Register(nameof(PanelCornerRadius), typeof(CornerRadius), typeof(BoardMenuFrame), new PropertyMetadata(new CornerRadius(5)));
public static readonly DependencyProperty HeaderCornerRadiusProperty =
DependencyProperty.Register(nameof(HeaderCornerRadius), typeof(CornerRadius), typeof(BoardMenuFrame), new PropertyMetadata(new CornerRadius(6, 6, 0, 0)));
public static readonly DependencyProperty PanelBackgroundProperty =
DependencyProperty.Register(nameof(PanelBackground), typeof(Brush), typeof(BoardMenuFrame), new PropertyMetadata(null));
public static readonly DependencyProperty HeaderBackgroundProperty =
DependencyProperty.Register(nameof(HeaderBackground), typeof(Brush), typeof(BoardMenuFrame),
new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#2563eb"))));
public static readonly DependencyProperty HeaderBorderBrushProperty =
DependencyProperty.Register(nameof(HeaderBorderBrush), typeof(Brush), typeof(BoardMenuFrame),
new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1e3a8a"))));
public static readonly DependencyProperty IsOpenProperty =
DependencyProperty.Register(nameof(IsOpen), typeof(bool), typeof(BoardMenuFrame), new PropertyMetadata(false));
public static readonly DependencyProperty PlacementTargetProperty =
DependencyProperty.Register(nameof(PlacementTarget), typeof(UIElement), typeof(BoardMenuFrame), new PropertyMetadata(null));
public static readonly DependencyProperty PlacementProperty =
DependencyProperty.Register(nameof(Placement), typeof(PlacementMode), typeof(BoardMenuFrame), new PropertyMetadata(PlacementMode.Custom));
public static readonly DependencyProperty CustomPopupPlacementCallbackProperty =
DependencyProperty.Register(nameof(CustomPopupPlacementCallback), typeof(CustomPopupPlacementCallback), typeof(BoardMenuFrame),
new PropertyMetadata((CustomPopupPlacementCallback)PlaceCenteredAbove));
private static CustomPopupPlacement[] PlaceCenteredAbove(Size popupSize, Size targetSize, Point offset)
{
return new[]
{
new CustomPopupPlacement(
new Point((targetSize.Width - popupSize.Width) / 2 + offset.X,
-popupSize.Height + offset.Y),
PopupPrimaryAxis.Horizontal),
new CustomPopupPlacement(
new Point((targetSize.Width - popupSize.Width) / 2 + offset.X,
targetSize.Height - offset.Y),
PopupPrimaryAxis.Horizontal)
};
}
public static readonly DependencyProperty PopupHorizontalOffsetProperty =
DependencyProperty.Register(nameof(PopupHorizontalOffset), typeof(double), typeof(BoardMenuFrame), new PropertyMetadata(0d));
public static readonly DependencyProperty PopupVerticalOffsetProperty =
DependencyProperty.Register(nameof(PopupVerticalOffset), typeof(double), typeof(BoardMenuFrame), new PropertyMetadata(-4d));
public object Title { get => GetValue(TitleProperty); set => SetValue(TitleProperty, value); }
public double TitleFontSize { get => (double)GetValue(TitleFontSizeProperty); set => SetValue(TitleFontSizeProperty, value); }
public double HeaderHeight { get => (double)GetValue(HeaderHeightProperty); set => SetValue(HeaderHeightProperty, value); }
public CornerRadius PanelCornerRadius { get => (CornerRadius)GetValue(PanelCornerRadiusProperty); set => SetValue(PanelCornerRadiusProperty, value); }
public CornerRadius HeaderCornerRadius { get => (CornerRadius)GetValue(HeaderCornerRadiusProperty); set => SetValue(HeaderCornerRadiusProperty, value); }
public Brush PanelBackground { get => (Brush)GetValue(PanelBackgroundProperty); set => SetValue(PanelBackgroundProperty, value); }
public Brush HeaderBackground { get => (Brush)GetValue(HeaderBackgroundProperty); set => SetValue(HeaderBackgroundProperty, value); }
public Brush HeaderBorderBrush { get => (Brush)GetValue(HeaderBorderBrushProperty); set => SetValue(HeaderBorderBrushProperty, value); }
public bool IsOpen { get => (bool)GetValue(IsOpenProperty); set => SetValue(IsOpenProperty, value); }
public UIElement PlacementTarget { get => (UIElement)GetValue(PlacementTargetProperty); set => SetValue(PlacementTargetProperty, value); }
public PlacementMode Placement { get => (PlacementMode)GetValue(PlacementProperty); set => SetValue(PlacementProperty, value); }
public CustomPopupPlacementCallback CustomPopupPlacementCallback
{
get => (CustomPopupPlacementCallback)GetValue(CustomPopupPlacementCallbackProperty);
set => SetValue(CustomPopupPlacementCallbackProperty, value);
}
public double PopupHorizontalOffset { get => (double)GetValue(PopupHorizontalOffsetProperty); set => SetValue(PopupHorizontalOffsetProperty, value); }
public double PopupVerticalOffset { get => (double)GetValue(PopupVerticalOffsetProperty); set => SetValue(PopupVerticalOffsetProperty, value); }
public event MouseButtonEventHandler CloseMouseDown;
public event MouseButtonEventHandler CloseMouseUp;
public UIElement AnimationTarget { get; private set; }
private UIElement _closeImage;
static BoardMenuFrame()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(BoardMenuFrame), new FrameworkPropertyMetadata(typeof(BoardMenuFrame)));
VisibilityProperty.OverrideMetadata(typeof(BoardMenuFrame),
new FrameworkPropertyMetadata(Visibility.Collapsed, OnVisibilityChanged));
}
private static void OnVisibilityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((BoardMenuFrame)d).IsOpen = (Visibility)e.NewValue == Visibility.Visible;
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
if (_closeImage != null)
{
_closeImage.MouseDown -= CloseImage_MouseDown;
_closeImage.MouseUp -= CloseImage_MouseUp;
}
_closeImage = GetTemplateChild(PartCloseImage) as UIElement;
if (_closeImage != null)
{
_closeImage.MouseDown += CloseImage_MouseDown;
_closeImage.MouseUp += CloseImage_MouseUp;
}
AnimationTarget = GetTemplateChild(PartAnimationRoot) as UIElement;
}
private void CloseImage_MouseDown(object sender, MouseButtonEventArgs e)
{
CloseMouseDown?.Invoke(sender, e);
}
private void CloseImage_MouseUp(object sender, MouseButtonEventArgs e)
{
CloseMouseUp?.Invoke(sender, e);
}
}
}
+27 -15
View File
@@ -2,11 +2,22 @@ using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Animation;
using Ink_Canvas.Controls;
namespace Ink_Canvas.Helpers
{
internal class AnimationsHelper
{
private static UIElement ResolveAnimationTarget(UIElement element)
{
if (element is BoardMenuFrame frame)
{
frame.ApplyTemplate();
return frame.AnimationTarget ?? element;
}
return element;
}
public static void ShowWithFadeIn(UIElement element, double duration = 0.15)
{
if (element.Visibility == Visibility.Visible) return;
@@ -36,14 +47,17 @@ namespace Ink_Canvas.Helpers
{
try
{
if (element.Visibility == Visibility.Visible) return;
if (element == null)
throw new ArgumentNullException(nameof(element));
if (element.Visibility == Visibility.Visible) return;
element.Visibility = Visibility.Visible;
var target = ResolveAnimationTarget(element);
var sb = new Storyboard();
// 渐变动画
var fadeInAnimation = new DoubleAnimation
{
From = 0.5,
@@ -54,10 +68,9 @@ namespace Ink_Canvas.Helpers
Storyboard.SetTargetProperty(fadeInAnimation, new PropertyPath(UIElement.OpacityProperty));
// 滑动动画
var slideAnimation = new DoubleAnimation
{
From = element.RenderTransform.Value.OffsetY + 10, // 滑动距离
From = 10,
To = 0,
Duration = TimeSpan.FromSeconds(duration)
};
@@ -68,10 +81,9 @@ namespace Ink_Canvas.Helpers
sb.Children.Add(fadeInAnimation);
sb.Children.Add(slideAnimation);
element.Visibility = Visibility.Visible;
element.RenderTransform = new TranslateTransform();
target.RenderTransform = new TranslateTransform();
sb.Begin((FrameworkElement)element);
sb.Begin((FrameworkElement)target);
}
catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); }
}
@@ -207,14 +219,15 @@ namespace Ink_Canvas.Helpers
{
try
{
if (element.Visibility == Visibility.Collapsed) return;
if (element == null)
throw new ArgumentNullException(nameof(element));
if (element.Visibility == Visibility.Collapsed) return;
var target = ResolveAnimationTarget(element);
var sb = new Storyboard();
// 渐变动画
var fadeOutAnimation = new DoubleAnimation
{
From = 1,
@@ -224,11 +237,10 @@ namespace Ink_Canvas.Helpers
fadeOutAnimation.EasingFunction = new CubicEase();
Storyboard.SetTargetProperty(fadeOutAnimation, new PropertyPath(UIElement.OpacityProperty));
// 滑动动画
var slideAnimation = new DoubleAnimation
{
From = 0,
To = element.RenderTransform.Value.OffsetY + 10, // 滑动距离
To = 10,
Duration = TimeSpan.FromSeconds(duration)
};
slideAnimation.EasingFunction = new CubicEase();
@@ -243,8 +255,8 @@ namespace Ink_Canvas.Helpers
element.Visibility = Visibility.Collapsed;
};
element.RenderTransform = new TranslateTransform();
sb.Begin((FrameworkElement)element);
target.RenderTransform = new TranslateTransform();
sb.Begin((FrameworkElement)target);
}
catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); }
}
+124 -288
View File
@@ -927,31 +927,17 @@
Label="{i18n:I18n Key=Board_Gesture}"
IconGeometry="F0 M24,24z M0,0z M7.82154,10.0753L7.82154,3.74613C7.82154,3.06603 8.08946,2.40655 8.57377,1.92224 9.05808,1.43793 9.70726,1.17001 10.3977,1.17001 11.0881,1.17001 11.7372,1.43793 12.2216,1.92224 12.7059,2.40655 12.9738,3.05573 12.9738,3.74613L12.9738,6.37308C13.1415,6.33947 13.3139,6.32225 13.489,6.32225 14.1794,6.32225 14.8286,6.59016 15.3129,7.07447 15.4484,7.21001 15.567,7.35845 15.6675,7.5171 15.9551,7.40916 16.2634,7.35269 16.5803,7.35269 17.2707,7.35269 17.9199,7.62061 18.4042,8.10492 18.5461,8.24683 18.6695,8.4029 18.7729,8.57001 19.6856,8.26338 20.7674,8.45871 21.4647,9.15599 21.949,9.6403 22.2169,10.2998 22.2169,10.9799L22.2169,15.6169C22.2169,17.5438 21.4647,19.3574 20.1045,20.7176 18.7443,22.0778 16.9307,22.83 15.0038,22.83L13.149,22.83 13.1799,22.8094 12.8398,22.8094C11.7682,22.7579 10.7068,22.4694 9.75878,21.9541 8.70773,21.3874 7.81124,20.563 7.15175,19.5738L6.94566,19.2647C6.60562,18.7494 5.49273,16.8019 3.52458,13.3087 3.19484,12.7213 3.1021,12.0412 3.27727,11.3818 3.45245,10.7326 3.86463,10.1761 4.44168,9.83608 5.00842,9.49604 5.66791,9.35177 6.31709,9.43421 6.86548,9.50385 7.39181,9.7279 7.82154,10.0753z M10.037,3.38547C10.1297,3.28243 10.2637,3.23091 10.3977,3.23091 10.5316,3.23091 10.6656,3.29273 10.7583,3.38547 10.8614,3.47821 10.9129,3.61217 10.9129,3.74613L10.9129,11.4745C10.9129,12.0412 11.3766,12.5049 11.9433,12.5049 12.5101,12.5049 12.9738,12.0412 12.9738,11.4745L12.9738,8.89836C12.9738,8.7644 13.0356,8.63045 13.1283,8.53771 13.2211,8.43466 13.355,8.38314 13.489,8.38314 13.623,8.38314 13.7569,8.44497 13.8497,8.53771 13.9527,8.63045 14.0042,8.7644 14.0042,8.89836L14.0042,11.4745C14.0042,12.0412 14.4679,12.5049 15.0347,12.5049 15.6014,12.5049 16.0651,12.0412 16.0651,11.4745L16.0651,9.92881C16.0651,9.79485 16.1269,9.66089 16.2197,9.56815 16.3124,9.46511 16.4464,9.41359 16.5803,9.41359 16.7143,9.41359 16.8483,9.47541 16.941,9.56815 17.044,9.66089 17.0956,9.79485 17.0956,9.92881L17.0956,10.5869C17.0752,10.7163 17.0646,10.8477 17.0646,10.9799 17.0646,11.0661 17.0754,11.1499 17.0956,11.2301L17.0956,11.4745C17.0956,12.0412 17.5593,12.5049 18.126,12.5049 18.6928,12.5049 19.1565,12.0412 19.1565,11.4745L19.1565,10.8128C19.1834,10.7399 19.2266,10.6727 19.2801,10.6192 19.4759,10.4234 19.8159,10.4234 20.0117,10.6192 20.1148,10.712 20.1663,10.8459 20.1663,10.9799L20.1663,15.6169C20.1663,16.9977 19.6408,18.296 18.6618,19.2647 17.6829,20.2333 16.3949,20.7691 15.0141,20.7691L13.1593,20.7691C12.3143,20.7691 11.4796,20.5527 10.7274,20.1509 9.98548,19.749 9.3363,19.1616 8.8726,18.4506L8.66651,18.1415C8.35737,17.6675 7.23419,15.7096 5.31756,12.2988 5.24543,12.1752 5.23512,12.0412 5.26604,11.9073 5.30725,11.7733 5.38969,11.6703 5.50304,11.5981 5.66791,11.4951 5.874,11.4539 6.06978,11.4745 6.26557,11.5054 6.45105,11.5878 6.59531,11.7321L8.11007,13.2469C8.49419,13.631 9.10425,13.648 9.50833,13.2978 9.73651,13.1084 9.88244,12.8229 9.88244,12.5049L9.88244,3.74613C9.88244,3.61217,9.94426,3.47821,10.037,3.38547z M2.99905,6.31195L1.78313,4.65293 2.61779,4.04497C3.46275,3.4267,4.37985,2.89087,5.33817,2.46838L6.27587,2.0459 7.12084,3.93162 6.18313,4.3541C5.35878,4.72506,4.56533,5.17846,3.83372,5.71429L2.99905,6.32225 2.99905,6.31195z M18.2806,5.20935L19.1565,5.75549 20.259,4.01404 19.3831,3.4679C18.1157,2.67446,16.7452,2.0768,15.3026,1.68523L14.303,1.41731 13.7672,3.40607 14.7667,3.67399C16.0033,4.00373,17.1883,4.51895,18.2806,5.20935z"
ButtonMouseUp="TwoFingerGestureBorder_MouseUp" />
<Border>
<Grid Width="0" Margin="0,0,0,5" RenderTransformOrigin="0,1">
<Border ClipToBounds="True" x:Name="BoardTwoFingerGestureBorder"
Margin="-115,-161,-55,50"
CornerRadius="8"
Background="{DynamicResource FloatBarBackground}" Opacity="1" BorderBrush="#2563eb"
BorderThickness="1">
<ikw:SimpleStackPanel Margin="0">
<Border BorderBrush="#1e3a8a" BorderThickness="0,0,0,1"
CornerRadius="8,8,0,0"
Background="#2563eb" Margin="-1,-1,-1,1">
<Canvas Height="38" ClipToBounds="True">
<TextBlock Text="{i18n:I18n Key=Board_GestureOptions}" Canvas.Left="12" Foreground="White"
Padding="0,7"
FontSize="17" FontWeight="Bold"
TextAlignment="Center" />
<Image Margin="144,10,0,0"
Source="/Resources/new-icons/close-white.png"
RenderOptions.BitmapScalingMode="HighQuality"
Height="16"
Width="16" MouseDown="Border_MouseDown"
MouseUp="CloseBordertools_MouseUp" />
</Canvas>
</Border>
<Viewbox Margin="8,0,8,0">
<localControls:BoardMenuFrame x:Name="BoardTwoFingerGestureBorder"
ClipToBounds="True"
PlacementTarget="{Binding ElementName=BoardGesture}"
Title="{i18n:I18n Key=Board_GestureOptions}"
PanelCornerRadius="8"
HeaderCornerRadius="8,8,0,0"
PanelBackground="{DynamicResource FloatBarBackground}"
Opacity="1"
CloseMouseDown="Border_MouseDown"
CloseMouseUp="CloseBordertools_MouseUp">
<Viewbox Margin="8,0,8,0">
<ikw:SimpleStackPanel Margin="0">
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="2"
VerticalAlignment="Center"
@@ -967,7 +953,7 @@
<Viewbox Width="36" Height="20" Margin="2,0,0,0">
<ui:ToggleSwitch MinWidth="0" Margin="0,-6,0,-6"
x:Name="BoardToggleSwitchEnableMultiTouchMode"
IsOn="False"
OnContent=""
OffContent=""
@@ -999,7 +985,7 @@
<Viewbox Width="36" Height="20" Margin="2,0,0,0">
<ui:ToggleSwitch MinWidth="0" Margin="0,-6,0,-6"
x:Name="BoardToggleSwitchEnableTwoFingerTranslate"
IsOn="False"
OnContent=""
OffContent=""
@@ -1030,7 +1016,7 @@
Style="{StaticResource AutoFitBoardGestureOptionLabel10}" />
<Viewbox Width="36" Height="20" Margin="2,0,0,0">
<ui:ToggleSwitch MinWidth="0" Margin="0,-6,0,-6"
IsOn="False" OnContent="" OffContent=""
x:Name="BoardToggleSwitchEnableTwoFingerZoom"
Toggled="ToggleSwitchEnableTwoFingerZoom_Toggled"
@@ -1060,7 +1046,7 @@
Style="{StaticResource AutoFitBoardGestureOptionLabel10}" />
<Viewbox Width="36" Height="20" Margin="2,0,0,0">
<ui:ToggleSwitch MinWidth="0" Margin="0,-6,0,-6"
IsOn="False" OnContent="" OffContent=""
x:Name="BoardToggleSwitchEnableTwoFingerRotation"
Toggled="ToggleSwitchEnableTwoFingerRotation_Toggled"
@@ -1079,52 +1065,22 @@
</ikw:SimpleStackPanel>
</ikw:SimpleStackPanel>
</Viewbox>
</ikw:SimpleStackPanel>
</Border>
</Grid>
</Border>
</localControls:BoardMenuFrame>
<controls:BoardToolbarButton x:Name="BoardChangeBackgroundColorBtn"
Position="Last"
Label="{i18n:I18n Key=Board_Background}"
IconGeometry="F0 M24,24z M0,0z M4.71815,3.98345C6.64142,2.23541 9.19629,1.17001 12,1.17001 17.9812,1.17001 22.83,6.01877 22.83,12 22.83,17.9813 17.9812,22.83 12,22.83 11.6262,22.83 11.2568,22.8111 10.8927,22.7741 5.8167,22.2586 1.77699,18.2377 1.2325,13.1703 1.22536,13.1039 1.21882,13.0373 1.21289,12.9705 1.20871,12.9234 1.20483,12.8762 1.20125,12.8289 1.18054,12.5553 1.17,12.2789 1.17,12 1.17,9.41057 2.07878,7.03339 3.59479,5.17001 3.9391,4.74681 4.31473,4.35011 4.71815,3.98345z M12,20.83C16.8767,20.83 20.83,16.8767 20.83,12 20.83,7.12334 16.8767,3.17001 12,3.17001L12,20.83z"
ButtonMouseUp="BoardChangeBackgroundColorBtn_MouseUp" />
<Border Height="50">
<Grid Margin="-30,5,30,5" Width="0">
<Grid x:Name="BoardBackgroundPaletteGrid" Margin="-150,-200" RenderTransformOrigin="0.5,0">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1" />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</Grid.RenderTransform>
<Border x:Name="BackgroundPalette" Visibility="Collapsed"
Background="{DynamicResource SettingsPageBackground}"
Opacity="1" BorderBrush="#2563eb"
BorderThickness="1" CornerRadius="8"
Width="300">
<localControls:BoardMenuFrame x:Name="BackgroundPalette" Visibility="Collapsed"
PlacementTarget="{Binding ElementName=BoardChangeBackgroundColorBtn}"
PanelBackground="{DynamicResource SettingsPageBackground}"
Opacity="1"
PanelCornerRadius="8"
HeaderCornerRadius="8,8,0,0"
TitleFontSize="11"
Title="背景设置"
CloseMouseUp="CloseBordertools_MouseUp">
<StackPanel>
<Border BorderBrush="#1e3a8a" Height="32"
BorderThickness="0,0,0,1"
CornerRadius="8,8,0,0" Background="#2563eb"
Margin="-1,-1,-1,0"
Padding="1,1,1,0">
<Canvas Height="24" ClipToBounds="true">
<TextBlock Text="背景设置"
Foreground="{DynamicResource FloatBarForeground}"
Padding="0,5,0,0" FontSize="11"
FontWeight="Bold"
TextAlignment="Center"
Canvas.Left="8" />
<Image x:Name="BackgroundPaletteCloseBtn"
Source="/Resources/new-icons/close-white.png"
Height="16" Width="16"
RenderOptions.BitmapScalingMode="HighQuality"
MouseUp="CloseBordertools_MouseUp"
Canvas.Right="8" Canvas.Top="4" />
</Canvas>
</Border>
<StackPanel Margin="8">
<TextBlock Text="白板模式"
Foreground="{DynamicResource TextForeground}"
@@ -1226,10 +1182,7 @@
Click="ApplyBackgroundColorBtn_Click" />
</StackPanel>
</StackPanel>
</Border>
</Grid>
</Grid>
</Border>
</localControls:BoardMenuFrame>
</ikw:SimpleStackPanel>
</Border>
@@ -1244,119 +1197,74 @@
Label="{i18n:I18n Key=Board_Pen}"
IconGeometry="F1 M24,24z M0,0z M20.4786,1.42438C19.9985,1.23743 19.4847,1.15194 18.9698,1.17319 18.4549,1.19444 17.9499,1.32197 17.4869,1.54789 17.0368,1.76752 16.6358,2.07554 16.3083,2.45361L3.85516,14.9067 9.08243,20.134 21.5311,7.68529C21.9113,7.36382 22.223,6.96912 22.447,6.52438 22.6786,6.06462 22.8113,5.56167 22.8365,5.04763 22.8616,4.5336 22.7787,4.02012 22.593,3.54002 22.4073,3.05994 22.1232,2.62403 21.759,2.25988 21.3949,1.89574 20.9587,1.61132 20.4786,1.42438z M7.28056,21.1605L2.8286,16.7086 1.15912,22.83 7.28056,21.1605z"
ButtonMouseUp="PenIcon_Click" />
<Border Height="50">
<Grid Margin="-30,5,30,5" Width="0">
<Grid Name="BoardPenPaletteGrid" Margin="-96.5,-84" RenderTransformOrigin="0.5,1">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</Grid.RenderTransform>
<Border x:Name="BoardPenPalette" Visibility="Visible"
Background="{DynamicResource FloatBarBackground}"
Opacity="1" BorderBrush="#2563eb"
BorderThickness="1" CornerRadius="8">
<ikw:SimpleStackPanel Margin="0,-20,0,0">
<Border BorderBrush="#1e3a8a" Height="32"
BorderThickness="0,0,0,1"
CornerRadius="8,8,0,0" Background="#2563eb"
Margin="-1,-1,-1,0"
Padding="1,1,1,0">
<ikw:SimpleStackPanel Orientation="Vertical"
VerticalAlignment="Center">
<ikw:SimpleStackPanel Orientation="Horizontal"
HorizontalAlignment="Stretch"
Margin="8,0,0,0" Spacing="2">
<Border x:Name="BoardDefaultPenTabButton"
MouseDown="SwitchToDefaultPen"
Background="#48dbeafe" Height="20"
Width="36"
CornerRadius="3">
<Canvas>
<ikw:SimpleStackPanel
x:Name="BoardDefaultPenTabButtonIndicator"
Visibility="Visible"
Orientation="Horizontal"
Canvas.Left="9" Canvas.Right="9"
Canvas.Bottom="0">
<Border Width="18" Height="2"
Background="{DynamicResource FloatBarBackground}"
CornerRadius="1" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Orientation="Vertical"
Height="20" Width="36">
<ikw:SimpleStackPanel
VerticalAlignment="Center"
Orientation="Horizontal"
HorizontalAlignment="Center"
Margin="0,3">
<Image
Source="/Resources/new-icons/pen-white.png"
RenderOptions.BitmapScalingMode="HighQuality"
Height="13" Width="13" />
<TextBlock
x:Name="BoardDefaultPenTabButtonText"
Foreground="White"
FontWeight="Medium"
FontSize="9"
TextAlignment="Center"
Text="{i18n:I18n Key=Board_Pen}" Margin="2,1,0,0" />
</ikw:SimpleStackPanel>
</ikw:SimpleStackPanel>
</Canvas>
</Border>
<Border x:Name="BoardHighlightPenTabButton"
MouseDown="SwitchToHighlighterPen"
Background="Transparent" Height="20"
Width="52"
CornerRadius="3">
<Canvas>
<ikw:SimpleStackPanel Visibility="Collapsed"
x:Name="BoardHighlightPenTabButtonIndicator"
Orientation="Horizontal"
Canvas.Left="14"
Canvas.Right="14" Canvas.Bottom="0">
<Border Width="24" Height="2"
Background="{DynamicResource FloatBarBackground}"
CornerRadius="1" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Orientation="Vertical"
Height="20" Width="52">
<ikw:SimpleStackPanel
VerticalAlignment="Center"
Orientation="Horizontal"
HorizontalAlignment="Center"
Margin="0,3">
<Image
Source="/Resources/new-icons/highlighter-white.png"
RenderOptions.BitmapScalingMode="HighQuality"
Height="13" Width="13" />
<TextBlock
x:Name="BoardHighlightPenTabButtonText"
Foreground="White"
FontWeight="Medium"
FontSize="9"
TextAlignment="Center"
Text="{i18n:I18n Key=Board_Highlighter}" Margin="2,1,0,0"
Width="35"
Style="{StaticResource AutoFitPenTabLabel9}" />
</ikw:SimpleStackPanel>
</ikw:SimpleStackPanel>
</Canvas>
</Border>
<Image Margin="66,0,0,0"
Source="/Resources/new-icons/close-white.png"
RenderOptions.BitmapScalingMode="HighQuality"
Height="16" Width="16"
MouseDown="Border_MouseDown"
MouseUp="CloseBordertools_MouseUp" />
</ikw:SimpleStackPanel>
<localControls:BoardMenuFrame x:Name="BoardPenPalette" Visibility="Collapsed"
PlacementTarget="{Binding ElementName=BoardPen}"
PanelCornerRadius="8"
HeaderCornerRadius="8,8,0,0"
PanelBackground="{DynamicResource FloatBarBackground}"
CloseMouseDown="Border_MouseDown"
CloseMouseUp="CloseBordertools_MouseUp">
<localControls:BoardMenuFrame.Title>
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Stretch"
Spacing="2" VerticalAlignment="Center">
<Border x:Name="BoardDefaultPenTabButton"
MouseDown="SwitchToDefaultPen"
Background="#48dbeafe" Height="20" Width="36" CornerRadius="3">
<Canvas>
<ikw:SimpleStackPanel x:Name="BoardDefaultPenTabButtonIndicator"
Visibility="Visible" Orientation="Horizontal"
Canvas.Left="9" Canvas.Right="9" Canvas.Bottom="0">
<Border Width="18" Height="2"
Background="{DynamicResource FloatBarBackground}"
CornerRadius="1" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Orientation="Vertical" Height="20" Width="36">
<ikw:SimpleStackPanel VerticalAlignment="Center"
Orientation="Horizontal"
HorizontalAlignment="Center" Margin="0,3">
<Image Source="/Resources/new-icons/pen-white.png"
RenderOptions.BitmapScalingMode="HighQuality"
Height="13" Width="13" />
<TextBlock x:Name="BoardDefaultPenTabButtonText"
Foreground="White" FontWeight="Medium"
FontSize="9" TextAlignment="Center"
Text="{i18n:I18n Key=Board_Pen}" Margin="2,1,0,0" />
</ikw:SimpleStackPanel>
</Border>
</ikw:SimpleStackPanel>
</Canvas>
</Border>
<Border x:Name="BoardHighlightPenTabButton"
MouseDown="SwitchToHighlighterPen"
Background="Transparent" Height="20" Width="52" CornerRadius="3">
<Canvas>
<ikw:SimpleStackPanel Visibility="Collapsed"
x:Name="BoardHighlightPenTabButtonIndicator"
Orientation="Horizontal"
Canvas.Left="14" Canvas.Right="14" Canvas.Bottom="0">
<Border Width="24" Height="2"
Background="{DynamicResource FloatBarBackground}"
CornerRadius="1" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Orientation="Vertical" Height="20" Width="52">
<ikw:SimpleStackPanel VerticalAlignment="Center"
Orientation="Horizontal"
HorizontalAlignment="Center" Margin="0,3">
<Image Source="/Resources/new-icons/highlighter-white.png"
RenderOptions.BitmapScalingMode="HighQuality"
Height="13" Width="13" />
<TextBlock x:Name="BoardHighlightPenTabButtonText"
Foreground="White" FontWeight="Medium"
FontSize="9" TextAlignment="Center"
Text="{i18n:I18n Key=Board_Highlighter}" Margin="2,1,0,0"
Width="35"
Style="{StaticResource AutoFitPenTabLabel9}" />
</ikw:SimpleStackPanel>
</ikw:SimpleStackPanel>
</Canvas>
</Border>
</ikw:SimpleStackPanel>
</localControls:BoardMenuFrame.Title>
<ikw:SimpleStackPanel>
<Viewbox Name="BoardDefaultPenPropsPanel"
Visibility="Collapsed"
Margin="12,8,12,0" HorizontalAlignment="Center"
@@ -1585,47 +1493,23 @@
</ikw:SimpleStackPanel>
</Viewbox>
</ikw:SimpleStackPanel>
</Border>
</Grid>
</Grid>
</Border>
</localControls:BoardMenuFrame>
<controls:BoardToolbarButton x:Name="BoardEraser"
Label="{i18n:I18n Key=Board_Eraser}"
IconGeometry="F1 M24,24z M0,0z M15.6314,20.7262L22.7921,13.5655C24.3494,12.141,24.2819,9.81776,22.8105,8.34633L16.7793,2.31508C15.3547,0.757753,13.0315,0.825236,11.5601,2.29666L4.38099,9.47574 15.6314,20.7262z M14.2172,22.1404L2.96677,10.89 1.20761,12.6491C-0.34971,14.0737,-0.281711,16.3974,1.18971,17.8688L6.15089,22.83 13.5276,22.83 14.2172,22.1404z"
ButtonMouseUp="BoardEraserIcon_Click" />
<Border>
<Grid RenderTransformOrigin="0,1" Margin="-133,-172,13,55">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</Grid.RenderTransform>
<Border Visibility="Visible" ClipToBounds="True"
Name="BoardEraserSizePanel"
CornerRadius="5" Background="{DynamicResource FloatBarBackground}"
<localControls:BoardMenuFrame ClipToBounds="True"
x:Name="BoardEraserSizePanel"
PlacementTarget="{Binding ElementName=BoardEraser}"
Title="{i18n:I18n Key=FloatingBar_GesturePanelTitle}"
PanelCornerRadius="5"
HeaderCornerRadius="6,6,0,0"
TitleFontSize="11"
PanelBackground="{DynamicResource FloatBarBackground}"
Opacity="1"
BorderBrush="#2563eb" BorderThickness="1">
CloseMouseDown="Border_MouseDown"
CloseMouseUp="CloseBordertools_MouseUp">
<ikw:SimpleStackPanel Margin="0">
<Border BorderBrush="#1e3a8a" BorderThickness="0,0,0,1"
CornerRadius="6,6,0,0"
Background="#2563eb" Margin="-1,-1,-1,1">
<Canvas Height="24" ClipToBounds="True">
<TextBlock Text="{i18n:I18n Key=FloatingBar_GesturePanelTitle}" Canvas.Left="8" Foreground="White"
Padding="0,5"
FontSize="11" FontWeight="Bold"
TextAlignment="Center" />
<Image Margin="100,4,0,0"
Source="/Resources/new-icons/close-white.png"
RenderOptions.BitmapScalingMode="HighQuality"
Height="16"
Width="16" MouseDown="Border_MouseDown"
MouseUp="CloseBordertools_MouseUp" />
</Canvas>
</Border>
<ikw:SimpleStackPanel Orientation="Horizontal" Margin="0,6,0,0"
Spacing="-2"
VerticalAlignment="Center"
@@ -1786,9 +1670,7 @@
</Button.Content>
</Button>
</ikw:SimpleStackPanel>
</Border>
</Grid>
</Border>
</localControls:BoardMenuFrame>
<controls:BoardToolbarButton x:Name="BoardGeometry"
Label="{i18n:I18n Key=Board_Shape}"
IconGeometry="F1 M24,24z M0,0z M17.8604,10.7597L12.0068,1.17001 6.13961,10.7597 17.8604,10.7597z M10.9345,13.2403L1.34476,13.2403 1.34476,22.83 10.9345,22.83 10.9345,13.2403z M17.8604,13.2403C15.2122,13.2403 13.0655,15.387 13.0655,18.0352 13.0655,20.6833 15.2122,22.83 17.8604,22.83 20.5085,22.83 22.6552,20.6833 22.6552,18.0352 22.6552,15.387 20.5085,13.2403 17.8604,13.2403z"
@@ -1945,26 +1827,14 @@
Label="{i18n:I18n Key=Board_InsertImage}"
IconGeometry="F1 M24,24z M0,0z M19,3H5C3.9,3 3,3.9 3,5v14c0,1.1 0.9,2 2,2h14c1.1,0 2-0.9 2-2V5C21,3.9 20.1,3 19,3zM19,19H5V5h14V19z M17,7c-1.1,0-2,0.9-2,2s0.9,2 2,2 2-0.9 2-2S18.1,7 17,7zM7,17l2.5-3.01 1.96,2.36 2.54-3.21L17,17H7z"
ButtonMouseUp="InsertImageOptions_MouseUp" />
<Border>
<!-- Image Insertion Options Panel -->
<Grid RenderTransformOrigin="0,1" Margin="-110,-92,13,55">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</Grid.RenderTransform>
<Border Name="BoardImageOptionsPanel" Visibility="Visible" ClipToBounds="True" CornerRadius="5" Background="{DynamicResource FloatBarBackground}" Opacity="1" BorderThickness="1" BorderBrush="#2563eb">
<ikw:SimpleStackPanel Margin="0">
<Border BorderBrush="#1e3a8a" BorderThickness="0,0,0,1" Margin="-1,-1,-1,1" CornerRadius="6,6,0,0" Background="#2563eb">
<Canvas Height="24" ClipToBounds="True">
<TextBlock Text="{i18n:I18n Key=Board_SelectImage}" Foreground="White" Padding="0,5" FontSize="11" FontWeight="Bold" Canvas.Left="8" TextAlignment="Center" />
<Image Margin="77,4,0,0" Source="/Resources/new-icons/close-white.png" RenderOptions.BitmapScalingMode="HighQuality" Height="16" Width="16" MouseDown="Border_MouseDown" MouseUp="CloseImageOptionsPanel_MouseUp" />
</Canvas>
</Border>
<ikw:SimpleStackPanel Margin="6,4,6,4" Spacing="2">
<localControls:BoardMenuFrame x:Name="BoardImageOptionsPanel" Visibility="Visible" ClipToBounds="True"
PlacementTarget="{Binding ElementName=BoardInsertImage}"
PanelCornerRadius="5" HeaderCornerRadius="6,6,0,0" TitleFontSize="11"
PanelBackground="{DynamicResource FloatBarBackground}" Opacity="1"
Title="{i18n:I18n Key=Board_SelectImage}"
CloseMouseDown="Border_MouseDown"
CloseMouseUp="CloseImageOptionsPanel_MouseUp">
<ikw:SimpleStackPanel Margin="6,4,6,4" Spacing="2">
<!-- Screenshot Option -->
<Border MouseDown="Border_MouseDown" MouseUp="ImageOptionScreenshot_MouseUp"
Background="Transparent" CornerRadius="3" Padding="6,4">
@@ -1991,7 +1861,7 @@
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Text="{i18n:I18n Key=Board_Screenshot}" FontSize="10"
<TextBlock Text="{i18n:I18n Key=Board_Screenshot}" FontSize="10"
Foreground="{DynamicResource TextForeground}" VerticalAlignment="Center"/>
</ikw:SimpleStackPanel>
</Border>
@@ -2026,10 +1896,7 @@
</ikw:SimpleStackPanel>
</Border>
</ikw:SimpleStackPanel>
</ikw:SimpleStackPanel>
</Border>
</Grid>
</Border>
</localControls:BoardMenuFrame>
<controls:BoardToolbarButton x:Name="BoardUndo"
Label="{i18n:I18n Key=Board_Undo}"
IconGeometry="F1 M24,24z M0,0z M8.71408,16.8493L0.874451,9.00964 8.71408,1.17001 8.71408,7.42358 15.7239,7.42358C16.7074,7.42358 17.6791,7.62744 18.583,8.02124 19.4866,8.41493 20.3023,8.98966 20.9857,9.70849 21.6689,10.4271 22.2069,11.276 22.5726,12.2047 22.9383,13.1333 23.1256,14.126 23.1256,15.1268 23.1256,16.1276 22.9383,17.1203 22.5726,18.0489 22.2069,18.9776 21.6689,19.8264 20.9857,20.5451 20.3023,21.2639 19.4866,21.8387 18.583,22.2324 17.6791,22.6262 16.7074,22.83 15.7239,22.83L10.437,22.83 10.437,19.6579 15.7239,19.6579C16.2679,19.6579 16.8086,19.5453 17.3159,19.3243 17.8235,19.1031 18.29,18.7767 18.6867,18.3594 19.0835,17.942 19.4023,17.4422 19.6211,16.8866 19.8399,16.3308 19.9534,15.7326 19.9534,15.1268 19.9534,14.5209 19.8399,13.9227 19.6211,13.367 19.4023,12.8114 19.0835,12.3115 18.6867,11.8941 18.29,11.4769 17.8235,11.1505 17.3159,10.9293 16.8086,10.7083 16.2679,10.5957 15.7239,10.5957L8.71408,10.5957 8.71408,16.8493z"
@@ -2051,42 +1918,14 @@
Label="{i18n:I18n Key=Board_Tools}"
IconGeometry="F1 M24,24z M0,0z M3.336,1.17001C2.13975,1.17001,1.17,2.13976,1.17,3.33601L1.17,8.75101C1.17,9.94726,2.13975,10.917,3.336,10.917L8.751,10.917C9.94725,10.917,10.917,9.94726,10.917,8.75101L10.917,3.33601C10.917,2.13976,9.94725,1.17001,8.751,1.17001L3.336,1.17001z M15.249,1.17001C14.0527,1.17001,13.083,2.13976,13.083,3.33601L13.083,8.75101C13.083,9.94726,14.0527,10.917,15.249,10.917L20.664,10.917C21.8602,10.917,22.83,9.94726,22.83,8.75101L22.83,3.33601C22.83,2.13976,21.8602,1.17001,20.664,1.17001L15.249,1.17001z M3.336,13.083C2.13975,13.083,1.17,14.0528,1.17,15.249L1.17,20.664C1.17,21.8603,2.13975,22.83,3.336,22.83L8.751,22.83C9.94725,22.83,10.917,21.8603,10.917,20.664L10.917,15.249C10.917,14.0528,9.94725,13.083,8.751,13.083L3.336,13.083z M15.249,13.083C14.0527,13.083,13.083,14.0528,13.083,15.249L13.083,20.664C13.083,21.8603,14.0527,22.83,15.249,22.83L20.664,22.83C21.8602,22.83,22.83,21.8603,22.83,20.664L22.83,15.249C22.83,14.0528,21.8602,13.083,20.664,13.083L15.249,13.083z"
ButtonMouseUp="SymbolIconTools_MouseUp" />
<Border>
<Grid Width="0" Margin="0,0,0,5" RenderTransformOrigin="0,1">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</Grid.RenderTransform>
<Border ClipToBounds="True" Name="BoardBorderTools"
Margin="-80,-138.5,-39,33.5"
CornerRadius="5" Background="{DynamicResource SettingsPageBackground}" Opacity="1"
BorderThickness="1"
BorderBrush="#2563eb">
<ikw:SimpleStackPanel Margin="-1,0,0,0">
<Border BorderBrush="#1e3a8a" BorderThickness="0,0,0,1"
CornerRadius="6,6,0,0" Background="#2563eb"
Margin="-1,-1,-1,0"
Padding="1,1,1,0">
<ikw:SimpleStackPanel Orientation="Horizontal"
HorizontalAlignment="Stretch">
<TextBlock Text="{i18n:I18n Key=Tools_MoreFeaturesTitle}" Foreground="White"
Padding="8,5,44,5"
FontSize="11" FontWeight="Bold"
TextAlignment="Center" />
<Image Margin="0,0,0,0"
Source="/Resources/new-icons/close-white.png"
RenderOptions.BitmapScalingMode="HighQuality"
Height="16"
Width="16" MouseDown="Border_MouseDown"
MouseUp="CloseBordertools_MouseUp" />
</ikw:SimpleStackPanel>
</Border>
<!---->
<ikw:SimpleStackPanel Margin="10,3,10,2" Spacing="-2">
<localControls:BoardMenuFrame ClipToBounds="True" x:Name="BoardBorderTools"
PlacementTarget="{Binding ElementName=BoardTools}"
PanelCornerRadius="5" HeaderCornerRadius="6,6,0,0" TitleFontSize="11"
PanelBackground="{DynamicResource SettingsPageBackground}" Opacity="1"
Title="{i18n:I18n Key=Tools_MoreFeaturesTitle}"
CloseMouseDown="Border_MouseDown"
CloseMouseUp="CloseBordertools_MouseUp">
<ikw:SimpleStackPanel Margin="10,3,10,2" Spacing="-2">
<ikw:SimpleStackPanel.Resources>
<Style TargetType="Label" BasedOn="{StaticResource AutoFitToolPopupLabel8}" />
</ikw:SimpleStackPanel.Resources>
@@ -2109,10 +1948,7 @@
<controls:ToolMenuButton x:Name="BoardSettingsToolBtn" ButtonMouseUp="SymbolIconSettings_Click" Label="{i18n:I18n Key=Tools_Settings}" />
</ikw:SimpleStackPanel>
</ikw:SimpleStackPanel>
</ikw:SimpleStackPanel>
</Border>
</Grid>
</Border>
</localControls:BoardMenuFrame>
<controls:BoardToolbarButton x:Name="BoardExit"
Position="Last"
Label="{i18n:I18n Key=Board_Exit}"
+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;
}
}
}
-14
View File
@@ -563,13 +563,6 @@ namespace Ink_Canvas
PenPalette.Margin = new Thickness(currentMargin.Left, -200, currentMargin.Right, 32);
UpdatePenPalettePosition();
});
await Dispatcher.InvokeAsync(() =>
{
BoardPenPaletteGrid.BeginAnimation(MarginProperty, null);
var currentMargin = BoardPenPaletteGrid.Margin;
BoardPenPaletteGrid.Margin = new Thickness(currentMargin.Left, -200, currentMargin.Right, 50);
});
}
else if (penType == 1)
{
@@ -616,13 +609,6 @@ namespace Ink_Canvas
PenPalette.Margin = new Thickness(currentMargin.Left, -157, currentMargin.Right, 32);
UpdatePenPalettePosition();
});
await Dispatcher.InvokeAsync(() =>
{
BoardPenPaletteGrid.BeginAnimation(MarginProperty, null);
var currentMargin = BoardPenPaletteGrid.Margin;
BoardPenPaletteGrid.Margin = new Thickness(currentMargin.Left, -154, currentMargin.Right, 50);
});
}
}
@@ -309,7 +309,7 @@ namespace Ink_Canvas
BorderDrawShape.Visibility = Visibility.Collapsed;
BoardBorderDrawShape.Visibility = Visibility.Collapsed;
if (LogicalTreeHelper.FindLogicalNode(this, "BackgroundPalette") is Border bgPalette)
if (LogicalTreeHelper.FindLogicalNode(this, "BackgroundPalette") is UIElement bgPalette)
{
bgPalette.Visibility = Visibility.Collapsed;
}
@@ -390,7 +390,7 @@ namespace Ink_Canvas
AnimationsHelper.HideWithSlideAndFade(BoardTwoFingerGestureBorder);
// 隐藏背景设置面板
if (LogicalTreeHelper.FindLogicalNode(this, "BackgroundPalette") is Border bgPalette)
if (LogicalTreeHelper.FindLogicalNode(this, "BackgroundPalette") is UIElement bgPalette)
{
AnimationsHelper.HideWithSlideAndFade(bgPalette);
}
@@ -1687,7 +1687,7 @@ namespace Ink_Canvas
/// <param name="e">鼠标按钮事件参数</param>
private void SymbolIconTools_MouseUp(object sender, MouseButtonEventArgs e)
{
if (BorderTools.Visibility == Visibility.Visible)
if (BorderTools.Visibility == Visibility.Visible || BoardBorderTools.Visibility == Visibility.Visible)
{
AnimationsHelper.HideWithSlideAndFade(BorderTools);
AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
@@ -1695,9 +1695,15 @@ namespace Ink_Canvas
else
{
HideSubPanels();
UpdateBorderToolsPosition();
AnimationsHelper.ShowWithSlideFromBottomAndFade(BorderTools);
AnimationsHelper.ShowWithSlideFromBottomAndFade(BoardBorderTools);
if (currentMode == 0)
{
UpdateBorderToolsPosition();
AnimationsHelper.ShowWithSlideFromBottomAndFade(BorderTools);
}
else
{
AnimationsHelper.ShowWithSlideFromBottomAndFade(BoardBorderTools);
}
}
}
+61
View File
@@ -0,0 +1,61 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Ink_Canvas.Controls">
<Style TargetType="{x:Type controls:BoardMenuFrame}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:BoardMenuFrame}">
<Popup IsOpen="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}}"
PlacementTarget="{TemplateBinding PlacementTarget}"
Placement="{TemplateBinding Placement}"
CustomPopupPlacementCallback="{TemplateBinding CustomPopupPlacementCallback}"
HorizontalOffset="{TemplateBinding PopupHorizontalOffset}"
VerticalOffset="{TemplateBinding PopupVerticalOffset}"
AllowsTransparency="True"
StaysOpen="True"
PopupAnimation="None">
<Border x:Name="PART_AnimationRoot"
BorderBrush="{TemplateBinding HeaderBackground}"
BorderThickness="1"
CornerRadius="{TemplateBinding PanelCornerRadius}"
Background="{TemplateBinding PanelBackground}">
<DockPanel LastChildFill="True">
<Border DockPanel.Dock="Top"
Background="{TemplateBinding HeaderBackground}"
BorderBrush="{TemplateBinding HeaderBorderBrush}"
BorderThickness="0,0,0,1"
CornerRadius="{TemplateBinding HeaderCornerRadius}"
Height="{TemplateBinding HeaderHeight}"
Margin="-1,-1,-1,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter Grid.Column="0"
Content="{TemplateBinding Title}"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="8,0,0,0"
TextElement.FontSize="{TemplateBinding TitleFontSize}"
TextElement.FontWeight="Bold"
TextElement.Foreground="White" />
<Image Grid.Column="2"
x:Name="PART_CloseImage"
Source="/Resources/new-icons/close-white.png"
Width="16" Height="16"
RenderOptions.BitmapScalingMode="HighQuality"
VerticalAlignment="Center"
Margin="0,0,8,0" />
</Grid>
</Border>
<ContentPresenter Margin="12" />
</DockPanel>
</Border>
</Popup>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>