[update] lastBorderMouseDown在FloatingBar上的充分利用

This commit is contained in:
Dubi906w 2024-06-12 21:47:36 +08:00
parent 0b9ef5ae00
commit b5dd53ea22
5 changed files with 108 additions and 9 deletions

View File

@ -4469,6 +4469,8 @@
<ui:SimpleStackPanel Margin="2,0" Name="StackPanelFloatingBar" Orientation="Horizontal">
<!--<ui:SimpleStackPanel Name="Cursor_Icon" MouseDown="Border_MouseDown" MouseUp="CursorIcon_Click"-->
<ui:SimpleStackPanel Name="Cursor_Icon"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="CursorIcon_Click"
Background="Transparent" Orientation="Vertical"
HorizontalAlignment="Center" Width="28" Margin="0,-2">
@ -4489,6 +4491,8 @@
Margin="0,1,0,0" TextAlignment="Center" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Name="Pen_Icon"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="PenIcon_Click"
Background="Transparent" Orientation="Vertical"
HorizontalAlignment="Center" Width="28" Margin="0,-2">
@ -4509,6 +4513,8 @@
Margin="0,1,0,0" TextAlignment="Center" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Name="SymbolIconDelete"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="SymbolIconDelete_MouseUp"
Background="Transparent" Orientation="Vertical"
HorizontalAlignment="Center" Width="28" Margin="0,-2">
@ -5310,6 +5316,8 @@
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Name="Eraser_Icon"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="EraserIcon_Click"
Background="Transparent" Orientation="Vertical"
HorizontalAlignment="Center" Margin="0,-2" Width="28">
@ -5331,6 +5339,8 @@
FontSize="8" Margin="0,1,0,0" TextAlignment="Center" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Name="EraserByStrokes_Icon"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="EraserIconByStrokes_Click"
Background="Transparent" Orientation="Vertical" Width="28"
Margin="0,-2" HorizontalAlignment="Center">
@ -5352,6 +5362,8 @@
FontSize="8" Margin="0,1,0,0" TextAlignment="Center" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Name="SymbolIconSelect"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="SymbolIconSelect_MouseUp" Background="Transparent"
Orientation="Vertical" Margin="0,-2" Width="28"
HorizontalAlignment="Center">
@ -5372,7 +5384,9 @@
FontSize="8" Margin="0,1,0,0" TextAlignment="Center" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel
Name="ShapeDrawFloatingBarBtn"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="ImageDrawShape_MouseUp" Background="Transparent"
Orientation="Vertical" HorizontalAlignment="Center" Margin="0,-2"
Width="28">
@ -5634,7 +5648,10 @@
</Border>
</Grid>
<ui:SimpleStackPanel
Name="SymbolIconUndo"
MouseUp="SymbolIconUndo_MouseUp"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
Background="Transparent" Orientation="Vertical"
HorizontalAlignment="Center" Margin="0,-2"
IsEnabled="{Binding ElementName=BtnUndo, Path=IsEnabled}"
@ -5659,7 +5676,10 @@
TextAlignment="Center" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel
Name="SymbolIconRedo"
MouseUp="SymbolIconRedo_MouseUp"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
Background="Transparent" Orientation="Vertical"
HorizontalAlignment="Center"
IsEnabled="{Binding ElementName=BtnRedo, Path=IsEnabled}"
@ -5684,7 +5704,9 @@
TextAlignment="Center" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel
Name="CursorWithDelFloatingBarBtn"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="CursorWithDelIcon_Click"
Background="Transparent" Orientation="Vertical"
HorizontalAlignment="Center" Width="28" Margin="0,-2">
@ -5791,7 +5813,9 @@
Orientation="{Binding ElementName=StackPanelFloatingBar, Path=Orientation}">
<Border Margin="2,0,2,0" BorderBrush="#71717a" BorderThickness="1,0,0,0" />
<ui:SimpleStackPanel
Name="WhiteboardFloatingBarBtn"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="ImageBlackboard_MouseUp" Background="Transparent"
Orientation="Vertical" HorizontalAlignment="Center" Width="28"
Margin="0,-2">
@ -5802,7 +5826,9 @@
FontSize="8" Margin="0,1,0,0" TextAlignment="Center" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel
Name="ToolsFloatingBarBtn"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="SymbolIconTools_MouseUp" Background="Transparent"
Orientation="Vertical" HorizontalAlignment="Center" Width="28"
Margin="0,-2">
@ -5815,6 +5841,8 @@
</ui:SimpleStackPanel>
<ui:SimpleStackPanel
x:Name="Fold_Icon"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="FoldFloatingBar_MouseUp" Background="Transparent"
Orientation="Vertical" HorizontalAlignment="Center" Width="28"
Margin="0,-2">

View File

@ -36,6 +36,11 @@ namespace Ink_Canvas {
}
private async void FoldFloatingBar_MouseUp(object sender, MouseButtonEventArgs e) {
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == Fold_Icon && lastBorderMouseDownObject != Fold_Icon) return;
// FloatingBarIcons_MouseUp_New(sender);
if (sender == null)
foldFloatingBarByUser = false;

View File

@ -433,6 +433,10 @@ namespace Ink_Canvas {
private void SymbolIconUndo_MouseUp(object sender, MouseButtonEventArgs e) {
//if (lastBorderMouseDownObject != sender) return;
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == SymbolIconUndo && lastBorderMouseDownObject != SymbolIconUndo) return;
if (!BtnUndo.IsEnabled) return;
BtnUndo_Click(BtnUndo, null);
HideSubPanels();
@ -441,6 +445,10 @@ namespace Ink_Canvas {
private void SymbolIconRedo_MouseUp(object sender, MouseButtonEventArgs e) {
//if (lastBorderMouseDownObject != sender) return;
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == SymbolIconRedo && lastBorderMouseDownObject != SymbolIconRedo) return;
if (!BtnRedo.IsEnabled) return;
BtnRedo_Click(BtnRedo, null);
HideSubPanels();
@ -455,6 +463,11 @@ namespace Ink_Canvas {
private void ImageBlackboard_MouseUp(object sender, MouseButtonEventArgs e)
{
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == WhiteboardFloatingBarBtn && lastBorderMouseDownObject != WhiteboardFloatingBarBtn) return;
LeftUnFoldButtonQuickPanel.Visibility = Visibility.Collapsed;
RightUnFoldButtonQuickPanel.Visibility = Visibility.Collapsed;
if (isDisplayingOrHidingBlackboard) return;
@ -622,6 +635,11 @@ namespace Ink_Canvas {
#region
private void SymbolIconDelete_MouseUp(object sender, MouseButtonEventArgs e) {
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == SymbolIconDelete && lastBorderMouseDownObject != SymbolIconDelete) return;
if (inkCanvas.GetSelectedStrokes().Count > 0) {
inkCanvas.Strokes.Remove(inkCanvas.GetSelectedStrokes());
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
@ -650,6 +668,11 @@ namespace Ink_Canvas {
/// <param name="e">MouseButtonEventArgs</param>
private void SymbolIconSelect_MouseUp(object sender, MouseButtonEventArgs e)
{
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == SymbolIconSelect && lastBorderMouseDownObject != SymbolIconSelect) return;
FloatingbarSelectionBG.Visibility = Visibility.Visible;
System.Windows.Controls.Canvas.SetLeft(FloatingbarSelectionBG, 140);
BtnSelect_Click(null, null);
@ -657,7 +680,19 @@ namespace Ink_Canvas {
}
#endregion
private void FloatingBarToolBtnMouseDownFeedback_Panel(object sender, MouseButtonEventArgs e) {
var s = (Panel)sender;
lastBorderMouseDownObject = sender;
if (s == SymbolIconDelete) s.Background = new SolidColorBrush(Color.FromArgb(28, 127, 29, 29));
else s.Background = new SolidColorBrush(Color.FromArgb(28, 24, 24, 27));
}
private void FloatingBarToolBtnMouseLeaveFeedback_Panel(object sender, MouseEventArgs e) {
var s = (Panel)sender;
lastBorderMouseDownObject = null;
s.Background = new SolidColorBrush(Colors.Transparent);
}
private void SymbolIconSettings_Click(object sender, RoutedEventArgs e) {
if (isOpeningOrHidingSettingsPane != false) return;
@ -665,8 +700,6 @@ namespace Ink_Canvas {
BtnSettings_Click(null, null);
}
private async void SymbolIconScreenshot_MouseUp(object sender, MouseButtonEventArgs e) {
HideSubPanelsImmediately();
await Task.Delay(50);
@ -969,6 +1002,11 @@ namespace Ink_Canvas {
}
private void SymbolIconTools_MouseUp(object sender, MouseButtonEventArgs e) {
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == ToolsFloatingBarBtn && lastBorderMouseDownObject != ToolsFloatingBarBtn) return;
if (BorderTools.Visibility == Visibility.Visible) {
AnimationsHelper.HideWithSlideAndFade(EraserSizePanel);
AnimationsHelper.HideWithSlideAndFade(BorderTools);
@ -1068,6 +1106,9 @@ namespace Ink_Canvas {
}
private async void CursorIcon_Click(object sender, RoutedEventArgs e) {
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender==Cursor_Icon && lastBorderMouseDownObject != Cursor_Icon) return;
// 隱藏高亮
FloatingbarSelectionBG.Visibility = Visibility.Hidden;
System.Windows.Controls.Canvas.SetLeft(FloatingbarSelectionBG, 0);
@ -1141,6 +1182,11 @@ namespace Ink_Canvas {
}
private void PenIcon_Click(object sender, RoutedEventArgs e) {
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == Pen_Icon && lastBorderMouseDownObject != Pen_Icon) return;
FloatingbarSelectionBG.Visibility = Visibility.Visible;
System.Windows.Controls.Canvas.SetLeft(FloatingbarSelectionBG, 28);
@ -1226,6 +1272,11 @@ namespace Ink_Canvas {
}
private void EraserIcon_Click(object sender, RoutedEventArgs e) {
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == Eraser_Icon && lastBorderMouseDownObject != Eraser_Icon) return;
FloatingbarSelectionBG.Visibility = Visibility.Visible;
System.Windows.Controls.Canvas.SetLeft(FloatingbarSelectionBG, 84);
@ -1309,6 +1360,11 @@ namespace Ink_Canvas {
}
private void EraserIconByStrokes_Click(object sender, RoutedEventArgs e) {
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == EraserByStrokes_Icon && lastBorderMouseDownObject != EraserByStrokes_Icon) return;
FloatingbarSelectionBG.Visibility = Visibility.Visible;
System.Windows.Controls.Canvas.SetLeft(FloatingbarSelectionBG, 112);
@ -1326,6 +1382,11 @@ namespace Ink_Canvas {
}
private void CursorWithDelIcon_Click(object sender, RoutedEventArgs e) {
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == CursorWithDelFloatingBarBtn && lastBorderMouseDownObject != CursorWithDelFloatingBarBtn) return;
SymbolIconDelete_MouseUp(sender, null);
CursorIcon_Click(null, null);
}

View File

@ -17,6 +17,11 @@ namespace Ink_Canvas {
#region Floating Bar Control
private void ImageDrawShape_MouseUp(object sender, MouseButtonEventArgs e) {
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == ShapeDrawFloatingBarBtn && lastBorderMouseDownObject != ShapeDrawFloatingBarBtn) return;
// FloatingBarIcons_MouseUp_New(sender);
if (BorderDrawShape.Visibility == Visibility.Visible) {
AnimationsHelper.HideWithSlideAndFade(EraserSizePanel);

View File

@ -49,5 +49,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.0.4.1")]
[assembly: AssemblyFileVersion("5.0.4.1")]
[assembly: AssemblyVersion("5.0.5.0")]
[assembly: AssemblyFileVersion("5.0.5.0")]