change SidePannelMarginAnimation from vertical to horizontal
This commit is contained in:
parent
1aea793aba
commit
29d3efcd77
@ -159,6 +159,7 @@
|
||||
<Compile Include="Helpers\AutoUpdateHelper.cs" />
|
||||
<Compile Include="Helpers\DelAutoSavedFiles.cs" />
|
||||
<Compile Include="Helpers\ForegroundWindowInfo.cs" />
|
||||
<Compile Include="MainWindow_cs\MainWindow_AutoFold.cs" />
|
||||
<Compile Include="MainWindow_cs\MainWindow_BoardIcons.cs" />
|
||||
<Compile Include="MainWindow_cs\MainWindow_FloatingBarIcons.cs" />
|
||||
<Compile Include="MainWindow_cs\MainWindow_AutoTheme.cs" />
|
||||
|
@ -271,8 +271,8 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
<Grid Margin="0,0,0,5" Width="0">
|
||||
<Border Name="BoardTwoFingerGestureBorder" Margin="-115,-160,-55,54" CornerRadius="5" Background="LightGray" Opacity="0.85" BorderBrush="Black" BorderThickness="1">
|
||||
<ui:SimpleStackPanel Margin="13">
|
||||
<Border Name="BoardTwoFingerGestureBorder" Margin="-115,-152,-55,54" CornerRadius="5" Background="LightGray" Opacity="0.85" BorderBrush="Black" BorderThickness="1">
|
||||
<ui:SimpleStackPanel Margin="10">
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="8" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Image Source="/Resources/Icons-Fluent/ic_fluent_people_24_regular.png" RenderOptions.BitmapScalingMode="HighQuality" Height="20" Width="20"/>
|
||||
<Label Content="多指书写" FontSize="15" VerticalAlignment="Center"/>
|
||||
@ -442,7 +442,7 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Width="0">
|
||||
<Border x:Name="BoardBorderDrawShape" Visibility="Visible" Background="LightGray" Opacity="0.85" BorderBrush="Black" BorderThickness="1" CornerRadius="8" Margin="-147,-286,-89,59">
|
||||
<Border x:Name="BoardBorderDrawShape" Visibility="Visible" Background="LightGray" Opacity="0.85" BorderBrush="Black" BorderThickness="1" CornerRadius="5" Margin="-147,-286,-89,59">
|
||||
<Viewbox>
|
||||
<ui:SimpleStackPanel Spacing="-8" Orientation="Vertical">
|
||||
<TextBlock FontSize="16" Foreground="{DynamicResource FloatBarForeground}" HorizontalAlignment="Left" Margin="10,8">
|
||||
@ -1491,7 +1491,7 @@
|
||||
|
||||
<Grid Width="0">
|
||||
<Border x:Name="BorderDrawShape" Visibility="Visible" Background="White" Opacity="0.9" BorderBrush="{DynamicResource FloatBarBorderBrush}" BorderThickness="1"
|
||||
CornerRadius="8" Margin="-112,-262,-88,27" Height="240">
|
||||
CornerRadius="5" Margin="-112,-262,-88,27" Height="240">
|
||||
<Viewbox>
|
||||
<ui:SimpleStackPanel Spacing="-8" Orientation="Vertical">
|
||||
<TextBlock FontSize="16" Foreground="{DynamicResource FloatBarForeground}" HorizontalAlignment="Left" Margin="10,8">
|
||||
@ -1615,8 +1615,8 @@
|
||||
<Image x:Name="EnableTwoFingerGestureBtn" Source="/Resources/Icons-png/twoFingelMove.png" RenderOptions.BitmapScalingMode="HighQuality" Height="20" Width="30"/>
|
||||
</Border>
|
||||
<Grid Width="0">
|
||||
<Border Name="TwoFingerGestureBorder" Visibility="Visible" Margin="-105,-165,-67,44" CornerRadius="5" Background="white" Opacity="0.9" BorderBrush="Black" BorderThickness="1">
|
||||
<ui:SimpleStackPanel Margin="13">
|
||||
<Border Name="TwoFingerGestureBorder" Visibility="Visible" Margin="-105,-158,-67,44" CornerRadius="5" Background="white" Opacity="0.9" BorderBrush="Black" BorderThickness="1">
|
||||
<ui:SimpleStackPanel Margin="10">
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="8" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Image Source="/Resources/Icons-Fluent/ic_fluent_people_24_regular.png" RenderOptions.BitmapScalingMode="HighQuality" Height="20" Width="20"/>
|
||||
<Label Content="多指书写" FontSize="15" VerticalAlignment="Center"/>
|
||||
@ -1657,14 +1657,14 @@
|
||||
<InkCanvas Name="InkCanvasForInkReplay" MouseDown="InkCanvasForInkReplay_MouseDown" Visibility="Collapsed" EditingMode="None" Background="Transparent"/>
|
||||
|
||||
<!--// 侧边栏 //-->
|
||||
<Viewbox x:Name="LeftSidePanel" MouseUp="UnFoldFloatingBar_MouseUp" Visibility="Visible" Height="50" Width="30" Margin="-17,0,0,-1500" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Viewbox x:Name="LeftSidePanel" MouseUp="UnFoldFloatingBar_MouseUp" Visibility="Visible" Height="50" Width="30" Margin="-40,0,0,-150" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<ui:SimpleStackPanel>
|
||||
<Border Background="LightGray" Opacity="0.4" CornerRadius="0,5,5,0" Height="50" Width="30">
|
||||
<Image Margin="0,0,-15,0" Source="/Resources/Icons-png/penUpright.png" RenderOptions.BitmapScalingMode="HighQuality" Height="50" Width="30"/>
|
||||
</Border>
|
||||
</ui:SimpleStackPanel>
|
||||
</Viewbox>
|
||||
<Viewbox x:Name="RightSidePanel" MouseUp="UnFoldFloatingBar_MouseUp" Visibility="{Binding ElementName=LeftSidePanel, Path=Visibility}" Height="50" Width="30" Margin="0,0,-17,-1500" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Viewbox x:Name="RightSidePanel" MouseUp="UnFoldFloatingBar_MouseUp" Visibility="{Binding ElementName=LeftSidePanel, Path=Visibility}" Height="50" Width="30" Margin="0,0,-40,-150" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<ui:SimpleStackPanel>
|
||||
<Border Background="LightGray" Opacity="0.4" CornerRadius="5,0,0,5" Height="50" Width="30">
|
||||
<Image Margin="-15,0,0,0" Source="/Resources/Icons-png/penUpright.png" RenderOptions.BitmapScalingMode="HighQuality" Height="50" Width="30"/>
|
||||
|
118
Ink Canvas/MainWindow_cs/MainWindow_AutoFold.cs
Normal file
118
Ink Canvas/MainWindow_cs/MainWindow_AutoFold.cs
Normal file
@ -0,0 +1,118 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
bool isFloatingBarFolded = false, isFloatingBarChangingHideMode = false;
|
||||
|
||||
private async void FoldFloatingBar_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (sender == null) {
|
||||
foldFloatingBarByUser = false;
|
||||
} else {
|
||||
foldFloatingBarByUser = true;
|
||||
}
|
||||
unfoldFloatingBarByUser = false;
|
||||
|
||||
if (isFloatingBarChangingHideMode) return;
|
||||
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
isFloatingBarChangingHideMode = true;
|
||||
isFloatingBarFolded = true;
|
||||
if (currentMode != 0) ImageBlackboard_MouseUp(null, null);
|
||||
if (StackPanelCanvasControls.Visibility == Visibility.Visible) {
|
||||
if (foldFloatingBarByUser && inkCanvas.Strokes.Count > 2) {
|
||||
ShowNotification("正在清空墨迹并收纳至侧边栏,可进入批注模式后通过【撤销】功能来恢复原先墨迹。");
|
||||
}
|
||||
}
|
||||
lastBorderMouseDownObject = sender;
|
||||
CursorWithDelIcon_Click(sender, null);
|
||||
SidePannelMarginAnimation(-16);
|
||||
});
|
||||
|
||||
await Task.Delay(500);
|
||||
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
BottomViewboxPPTSidesControl.Visibility = Visibility.Collapsed;
|
||||
LeftSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
RightSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
ViewboxFloatingBarMarginAnimation(-60);
|
||||
HideSubPanels("cursor");
|
||||
SidePannelMarginAnimation(-16);
|
||||
});
|
||||
isFloatingBarChangingHideMode = false;
|
||||
}
|
||||
|
||||
private async void UnFoldFloatingBar_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (sender == null || StackPanelPPTControls.Visibility == Visibility.Visible) {
|
||||
unfoldFloatingBarByUser = false;
|
||||
} else {
|
||||
unfoldFloatingBarByUser = true;
|
||||
}
|
||||
foldFloatingBarByUser = false;
|
||||
|
||||
if (isFloatingBarChangingHideMode) return;
|
||||
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
isFloatingBarChangingHideMode = true;
|
||||
isFloatingBarFolded = false;
|
||||
});
|
||||
|
||||
await Task.Delay(500);
|
||||
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
if (StackPanelPPTControls.Visibility == Visibility.Visible) {
|
||||
if (Settings.PowerPointSettings.IsShowBottomPPTNavigationPanel) {
|
||||
AnimationsHelper.ShowWithSlideFromBottomAndFade(BottomViewboxPPTSidesControl);
|
||||
}
|
||||
if (Settings.PowerPointSettings.IsShowSidePPTNavigationPanel) {
|
||||
AnimationsHelper.ShowWithScaleFromLeft(LeftSidePanelForPPTNavigation);
|
||||
AnimationsHelper.ShowWithScaleFromRight(RightSidePanelForPPTNavigation);
|
||||
}
|
||||
}
|
||||
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) {
|
||||
ViewboxFloatingBarMarginAnimation(60);
|
||||
} else {
|
||||
ViewboxFloatingBarMarginAnimation(100);
|
||||
}
|
||||
SidePannelMarginAnimation(-40);
|
||||
});
|
||||
|
||||
isFloatingBarChangingHideMode = false;
|
||||
}
|
||||
|
||||
private async void SidePannelMarginAnimation(int MarginFromEdge) // Possible value: -40, -16
|
||||
{
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
if (MarginFromEdge == -16) LeftSidePanel.Visibility = Visibility.Visible;
|
||||
|
||||
ThicknessAnimation LeftSidePanelmarginAnimation = new ThicknessAnimation {
|
||||
Duration = TimeSpan.FromSeconds(0.3),
|
||||
From = LeftSidePanel.Margin,
|
||||
To = new Thickness(MarginFromEdge, 0, 0, -150)
|
||||
};
|
||||
ThicknessAnimation RightSidePanelmarginAnimation = new ThicknessAnimation {
|
||||
Duration = TimeSpan.FromSeconds(0.3),
|
||||
From = RightSidePanel.Margin,
|
||||
To = new Thickness(0, 0, MarginFromEdge, -150)
|
||||
};
|
||||
|
||||
LeftSidePanel.BeginAnimation(FrameworkElement.MarginProperty, LeftSidePanelmarginAnimation);
|
||||
RightSidePanel.BeginAnimation(FrameworkElement.MarginProperty, RightSidePanelmarginAnimation);
|
||||
});
|
||||
|
||||
await Task.Delay(600);
|
||||
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
LeftSidePanel.Margin = new Thickness(MarginFromEdge, 0, 0, -150);
|
||||
RightSidePanel.Margin = new Thickness(0, 0, MarginFromEdge, -150);
|
||||
|
||||
if (MarginFromEdge == -40) LeftSidePanel.Visibility = Visibility.Collapsed;
|
||||
});
|
||||
isFloatingBarChangingHideMode = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -18,118 +18,6 @@ using System.Diagnostics;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
#region Auto Fold
|
||||
|
||||
bool isFloatingBarFolded = false, isFloatingBarChangingHideMode = false;
|
||||
|
||||
private async void FoldFloatingBar_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (sender == null) {
|
||||
foldFloatingBarByUser = false;
|
||||
} else {
|
||||
foldFloatingBarByUser = true;
|
||||
}
|
||||
unfoldFloatingBarByUser = false;
|
||||
|
||||
if (isFloatingBarChangingHideMode) return;
|
||||
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
isFloatingBarChangingHideMode = true;
|
||||
isFloatingBarFolded = true;
|
||||
if (currentMode != 0) ImageBlackboard_MouseUp(null, null);
|
||||
if (StackPanelCanvasControls.Visibility == Visibility.Visible) {
|
||||
if (foldFloatingBarByUser && inkCanvas.Strokes.Count > 2) {
|
||||
ShowNotification("正在清空墨迹并收纳至侧边栏,可进入批注模式后通过【撤销】功能来恢复原先墨迹。");
|
||||
}
|
||||
}
|
||||
lastBorderMouseDownObject = sender;
|
||||
CursorWithDelIcon_Click(sender, null);
|
||||
SidePannelMarginAnimation(-200);
|
||||
});
|
||||
|
||||
await Task.Delay(500);
|
||||
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
BottomViewboxPPTSidesControl.Visibility = Visibility.Collapsed;
|
||||
LeftSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
RightSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
ViewboxFloatingBarMarginAnimation(-60);
|
||||
HideSubPanels("cursor");
|
||||
SidePannelMarginAnimation(-200);
|
||||
});
|
||||
isFloatingBarChangingHideMode = false;
|
||||
}
|
||||
|
||||
private async void UnFoldFloatingBar_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (sender == null || StackPanelPPTControls.Visibility == Visibility.Visible) {
|
||||
unfoldFloatingBarByUser = false;
|
||||
} else {
|
||||
unfoldFloatingBarByUser = true;
|
||||
}
|
||||
foldFloatingBarByUser = false;
|
||||
|
||||
if (isFloatingBarChangingHideMode) return;
|
||||
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
isFloatingBarChangingHideMode = true;
|
||||
isFloatingBarFolded = false;
|
||||
});
|
||||
|
||||
await Task.Delay(500);
|
||||
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
if (StackPanelPPTControls.Visibility == Visibility.Visible) {
|
||||
if (Settings.PowerPointSettings.IsShowBottomPPTNavigationPanel) {
|
||||
AnimationsHelper.ShowWithSlideFromBottomAndFade(BottomViewboxPPTSidesControl);
|
||||
}
|
||||
if (Settings.PowerPointSettings.IsShowSidePPTNavigationPanel) {
|
||||
AnimationsHelper.ShowWithScaleFromLeft(LeftSidePanelForPPTNavigation);
|
||||
AnimationsHelper.ShowWithScaleFromRight(RightSidePanelForPPTNavigation);
|
||||
}
|
||||
}
|
||||
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) {
|
||||
ViewboxFloatingBarMarginAnimation(60);
|
||||
} else {
|
||||
ViewboxFloatingBarMarginAnimation(100);
|
||||
}
|
||||
SidePannelMarginAnimation(-1500);
|
||||
});
|
||||
|
||||
isFloatingBarChangingHideMode = false;
|
||||
}
|
||||
|
||||
private async void SidePannelMarginAnimation(int heightFromBottom) // Possible value: -1500, -200
|
||||
{
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
if (heightFromBottom == -200) LeftSidePanel.Visibility = Visibility.Visible;
|
||||
|
||||
ThicknessAnimation LeftSidePanelmarginAnimation = new ThicknessAnimation {
|
||||
Duration = TimeSpan.FromSeconds(0.3),
|
||||
From = LeftSidePanel.Margin,
|
||||
To = new Thickness(-17, 0, 0, heightFromBottom)
|
||||
};
|
||||
ThicknessAnimation RightSidePanelmarginAnimation = new ThicknessAnimation {
|
||||
Duration = TimeSpan.FromSeconds(0.3),
|
||||
From = RightSidePanel.Margin,
|
||||
To = new Thickness(0, 0, -17, heightFromBottom)
|
||||
};
|
||||
|
||||
LeftSidePanel.BeginAnimation(FrameworkElement.MarginProperty, LeftSidePanelmarginAnimation);
|
||||
RightSidePanel.BeginAnimation(FrameworkElement.MarginProperty, RightSidePanelmarginAnimation);
|
||||
});
|
||||
|
||||
await Task.Delay(600);
|
||||
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
LeftSidePanel.Margin = new Thickness(-17, 0, 0, heightFromBottom);
|
||||
RightSidePanel.Margin = new Thickness(0, 0, -17, heightFromBottom);
|
||||
|
||||
if (heightFromBottom == -1500) LeftSidePanel.Visibility = Visibility.Collapsed;
|
||||
});
|
||||
isFloatingBarChangingHideMode = false;
|
||||
}
|
||||
|
||||
#endregion Auto Fold
|
||||
|
||||
#region TwoFingZoomBtn
|
||||
|
||||
private void TwoFingerGestureBorder_MouseUp(object sender, RoutedEventArgs e) {
|
||||
@ -613,13 +501,13 @@ namespace Ink_Canvas {
|
||||
|
||||
bool isViewboxFloatingBarMarginAnimationRunning = false;
|
||||
|
||||
private async void ViewboxFloatingBarMarginAnimation(int heightFromBottom) {
|
||||
if (heightFromBottom == 60) {
|
||||
heightFromBottom = 55;
|
||||
private async void ViewboxFloatingBarMarginAnimation(int MarginFromEdge) {
|
||||
if (MarginFromEdge == 60) {
|
||||
MarginFromEdge = 55;
|
||||
}
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
if (Topmost == false) {
|
||||
heightFromBottom = -60;
|
||||
MarginFromEdge = -60;
|
||||
} else {
|
||||
ViewboxFloatingBar.Visibility = Visibility.Visible;
|
||||
}
|
||||
@ -635,9 +523,9 @@ namespace Ink_Canvas {
|
||||
System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.FromHandle(windowHandle);
|
||||
double screenWidth = screen.Bounds.Width / dpiScaleX, screenHeight = screen.Bounds.Height / dpiScaleY;
|
||||
pos.X = (screenWidth - ViewboxFloatingBar.ActualWidth * ViewboxFloatingBarScaleTransform.ScaleX) / 2;
|
||||
pos.Y = screenHeight - heightFromBottom * ((ViewboxFloatingBarScaleTransform.ScaleY == 1) ? 1 : 0.9);
|
||||
pos.Y = screenHeight - MarginFromEdge * ((ViewboxFloatingBarScaleTransform.ScaleY == 1) ? 1 : 0.9);
|
||||
|
||||
if (heightFromBottom != -60) {
|
||||
if (MarginFromEdge != -60) {
|
||||
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) {
|
||||
if (pointPPT.X != -1 || pointPPT.Y != -1) {
|
||||
if (Math.Abs(pointPPT.Y - pos.Y) > 50) {
|
||||
|
Loading…
Reference in New Issue
Block a user