From 41bdee1dc73a492382ec076e63d12517c9f27c4a Mon Sep 17 00:00:00 2001 From: Raspberry-Monster Date: Tue, 18 Jun 2024 10:18:34 +0800 Subject: [PATCH 1/9] =?UTF-8?q?[BugFix]=20=E5=B0=9D=E8=AF=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=8C=89=E9=92=AE=E9=94=99=E8=AF=AF=E6=89=93=E5=BC=80?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/MainWindow.xaml.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs index 08b12989..2219efb0 100644 --- a/Ink Canvas/MainWindow.xaml.cs +++ b/Ink Canvas/MainWindow.xaml.cs @@ -1503,6 +1503,7 @@ private void BtnSwitchTheme_Click(object sender, RoutedEventArgs e) } private void SetColorByIndex() { + if(currentMode != 0 || GridInkCanvasSelectionCover.Visibility != Visibility.Collapsed) if (inkColor == 0) { BtnColorBlack_Click(null,null); @@ -5728,7 +5729,7 @@ private void UpdateIndexInfoDisplay() private void SetColors() { - if (currentMode % 2 != 0 && !Settings.Canvas.UsingWhiteboard) + if (currentMode != 0 && !Settings.Canvas.UsingWhiteboard) { if (File.Exists(App.RootPath + "Colors\\Light.ini")) { From 587e94bd085dde5f10bf3842fdbdc287017c4688 Mon Sep 17 00:00:00 2001 From: XY Wang Date: Sat, 13 Jul 2024 17:23:48 +0800 Subject: [PATCH 2/9] [Fix] Optimize layout --- Ink Canvas/MainWindow.xaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml index 1759a40d..010f3c14 100644 --- a/Ink Canvas/MainWindow.xaml +++ b/Ink Canvas/MainWindow.xaml @@ -1205,15 +1205,16 @@ HorizontalAlignment="Left" Margin="8,8"/> - From 618a3ef32bc252edc59aea1b21cc25bd7ca8dc97 Mon Sep 17 00:00:00 2001 From: XY Wang Date: Sat, 13 Jul 2024 17:24:13 +0800 Subject: [PATCH 3/9] Code cleanup --- Ink Canvas/Helpers/TimeMachine.cs | 6 +- Ink Canvas/MainWindow.xaml.cs | 116 ++++++++++++++++-------------- Ink Canvas/RandWindow.xaml.cs | 4 +- Ink Canvas/Settings.cs | 4 +- 4 files changed, 71 insertions(+), 59 deletions(-) diff --git a/Ink Canvas/Helpers/TimeMachine.cs b/Ink Canvas/Helpers/TimeMachine.cs index 6aef6953..4660a069 100644 --- a/Ink Canvas/Helpers/TimeMachine.cs +++ b/Ink Canvas/Helpers/TimeMachine.cs @@ -151,12 +151,12 @@ public TimeMachineHistory(StrokeCollection currentStroke, TimeMachineHistoryType StrokeHasBeenCleared = strokeHasBeenCleared; ReplacedStroke = replacedStroke; } - public TimeMachineHistory(Dictionary> stylusPointDictionary, TimeMachineHistoryType commitType) + public TimeMachineHistory(Dictionary> stylusPointDictionary, TimeMachineHistoryType commitType) { - CommitType=commitType; + CommitType = commitType; StylusPointDictionary = stylusPointDictionary; } - public TimeMachineHistory(Dictionary> drawingAttributes, TimeMachineHistoryType commitType) + public TimeMachineHistory(Dictionary> drawingAttributes, TimeMachineHistoryType commitType) { CommitType = commitType; DrawingAttributes = drawingAttributes; diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs index b7b8e5ae..90c37851 100644 --- a/Ink Canvas/MainWindow.xaml.cs +++ b/Ink Canvas/MainWindow.xaml.cs @@ -1,10 +1,10 @@ using Ink_Canvas.Helpers; +using iNKORE.UI.WPF.Modern; +using iNKORE.UI.WPF.Modern.Helpers; using IWshRuntimeLibrary; using Microsoft.Office.Interop.PowerPoint; using Microsoft.VisualBasic; using Microsoft.Win32; -using iNKORE.UI.WPF.Modern; -using iNKORE.UI.WPF.Modern.Helpers; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -350,7 +350,7 @@ private enum CommitReason private StrokeCollection ReplacedStroke; private StrokeCollection AddedStroke; private StrokeCollection CuboidStrokeCollection; - private Dictionary> StrokeManipulationHistory; + private Dictionary> StrokeManipulationHistory; private Dictionary StrokeInitialHistory = new Dictionary(); private Dictionary> DrawingAttributesHistory = new Dictionary>(); private Dictionary> DrawingAttributesHistoryFlag = new Dictionary>() @@ -586,14 +586,14 @@ private void Stroke_DrawingAttributesChanged(object sender, PropertyDataChangedE DrawingAttributesHistoryFlag[e.PropertyGuid].Add(key); Debug.Write(e.PreviousValue.ToString()); } - if(e.PropertyGuid == DrawingAttributeIds.Color && needUpdateValue) + if (e.PropertyGuid == DrawingAttributeIds.Color && needUpdateValue) { previousValue.Color = (Color)e.PreviousValue; } if (e.PropertyGuid == DrawingAttributeIds.IsHighlighter && needUpdateValue) { previousValue.IsHighlighter = (bool)e.PreviousValue; - + } if (e.PropertyGuid == DrawingAttributeIds.StylusHeight && needUpdateValue) { @@ -617,7 +617,7 @@ private void Stroke_DrawingAttributesChanged(object sender, PropertyDataChangedE } DrawingAttributesHistory[key] = new Tuple(previousValue, currentValue); } - + private void Stroke_StylusPointsReplaced(object sender, StylusPointsReplacedEventArgs e) { StrokeInitialHistory[sender as Stroke] = e.NewStylusPoints.Clone(); @@ -628,16 +628,16 @@ private void Stroke_StylusPointsChanged(object sender, EventArgs e) var selectedStrokes = inkCanvas.GetSelectedStrokes(); var count = selectedStrokes.Count; if (count == 0) count = inkCanvas.Strokes.Count; - if(StrokeManipulationHistory == null) + if (StrokeManipulationHistory == null) { StrokeManipulationHistory = new Dictionary>(); } - StrokeManipulationHistory[sender as Stroke] = - new Tuple(StrokeInitialHistory[sender as Stroke], (sender as Stroke).StylusPoints.Clone()); - if ((StrokeManipulationHistory.Count == count || sender == null) && dec.Count == 0 ) + StrokeManipulationHistory[sender as Stroke] = + new Tuple(StrokeInitialHistory[sender as Stroke], (sender as Stroke).StylusPoints.Clone()); + if ((StrokeManipulationHistory.Count == count || sender == null) && dec.Count == 0) { timeMachine.CommitStrokeManipulationHistory(StrokeManipulationHistory); - foreach (var item in StrokeManipulationHistory) + foreach (var item in StrokeManipulationHistory) { StrokeInitialHistory[item.Key] = item.Value.Item2; } @@ -1304,12 +1304,18 @@ private void BtnClear_Click(object sender, RoutedEventArgs e) forceEraser = false; BorderClearInDelete.Visibility = Visibility.Collapsed; - if (currentMode == 0) { + if (currentMode == 0) + { BorderPenColorRed_MouseUp(BorderPenColorRed, null); - } else { - if (Settings.Canvas.UsingWhiteboard) { + } + else + { + if (Settings.Canvas.UsingWhiteboard) + { BorderPenColorBlack_MouseUp(BorderPenColorBlack, null); - } else { + } + else + { BorderPenColorWhite_MouseUp(BorderPenColorWhite, null); } } @@ -1503,31 +1509,31 @@ private void BtnSwitchTheme_Click(object sender, RoutedEventArgs e) } private void SetColorByIndex() { - if(currentMode != 0 || GridInkCanvasSelectionCover.Visibility != Visibility.Collapsed) - if (inkColor == 0) - { - BtnColorBlack_Click(null,null); - } - else if (inkColor == 1) - { - BtnColorRed_Click(null, null); - } - else if (inkColor == 2) - { - BtnColorGreen_Click(null, null); - } - else if (inkColor == 3) - { - BtnColorBlue_Click(null, null); - } - else if (inkColor == 4) - { - BtnColorYellow_Click(null, null); - } - else if (inkColor == 5) - { - BorderPenColorWhite_MouseUp(null, null); - } + if (currentMode != 0 || GridInkCanvasSelectionCover.Visibility != Visibility.Collapsed) + if (inkColor == 0) + { + BtnColorBlack_Click(null, null); + } + else if (inkColor == 1) + { + BtnColorRed_Click(null, null); + } + else if (inkColor == 2) + { + BtnColorGreen_Click(null, null); + } + else if (inkColor == 3) + { + BtnColorBlue_Click(null, null); + } + else if (inkColor == 4) + { + BtnColorYellow_Click(null, null); + } + else if (inkColor == 5) + { + BorderPenColorWhite_MouseUp(null, null); + } } int BoundsWidth = 5; @@ -1854,7 +1860,7 @@ private static byte toByte(char c) byte b = (byte)"0123456789ABCDEF".IndexOf(c); return b; } - + #endregion #region Touch Events @@ -2477,7 +2483,8 @@ private void PptApplication_SlideShowBegin(SlideShowWindow Wn) LogHelper.WriteLogToFile("PowerPoint Application Slide Show Begin", LogHelper.LogType.Event); Application.Current.Dispatcher.Invoke(() => { - if (currentMode == 1) { + if (currentMode == 1) + { // 退出画板模式 BtnSwitch_Click(null, null); } @@ -3102,7 +3109,7 @@ private void ToggleSwitchShowCursor_Toggled(object sender, RoutedEventArgs e) #endregion #region Canvas - + private void ComboBoxPenStyle_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (!isLoaded) return; @@ -3635,7 +3642,7 @@ private void ChangeStrokeThickness(double multipler) var newWidth = stroke.DrawingAttributes.Width * multipler; var newHeight = stroke.DrawingAttributes.Height * multipler; - if(newWidth >= DrawingAttributes.MinWidth && newWidth <= DrawingAttributes.MaxWidth + if (newWidth >= DrawingAttributes.MinWidth && newWidth <= DrawingAttributes.MaxWidth && newHeight >= DrawingAttributes.MinHeight && newHeight <= DrawingAttributes.MaxHeight) { stroke.DrawingAttributes.Width = newWidth; @@ -3841,8 +3848,10 @@ private void BtnSelect_Click(object sender, RoutedEventArgs e) //inkCanvas.Select(inkCanvas.Strokes); // Fixed bug: 当通过如鼠标点击等某些方式创建没有高度或长度的笔画时,全选功能不能使用克隆、旋转、翻转、调整笔画粗细、删除功能 StrokeCollection selectedStrokes = new StrokeCollection(); - foreach (Stroke stroke in inkCanvas.Strokes) { - if (stroke.GetBounds().Width > 0 && stroke.GetBounds().Height > 0) { + foreach (Stroke stroke in inkCanvas.Strokes) + { + if (stroke.GetBounds().Width > 0 && stroke.GetBounds().Height > 0) + { selectedStrokes.Add(stroke); } } @@ -3872,7 +3881,7 @@ private void inkCanvas_SelectionChanged(object sender, EventArgs e) GridInkCanvasSelectionCover.Visibility = Visibility.Visible; BorderStrokeSelectionClone.Background = Brushes.Transparent; isStrokeSelectionCloneOn = false; - updateBorderStrokeSelectionControlLocation(); + updateBorderStrokeSelectionControlLocation(); } } @@ -4842,7 +4851,8 @@ private void MouseTouchMove(Point endP) //第二笔:画双曲线 double k = drawMultiStepShapeSpecialParameter3; bool isHyperbolaFocalPointOnXAxis = Math.Abs((endP.Y - iniP.Y) / (endP.X - iniP.X)) < k; - if (isHyperbolaFocalPointOnXAxis) { // 焦点在 x 轴上 + if (isHyperbolaFocalPointOnXAxis) + { // 焦点在 x 轴上 a = Math.Sqrt(Math.Abs((endP.X - iniP.X) * (endP.X - iniP.X) - (endP.Y - iniP.Y) * (endP.Y - iniP.Y) / (k * k))); b = a * k; pointList = new List(); @@ -4854,7 +4864,9 @@ private void MouseTouchMove(Point endP) pointList3.Add(new Point(iniP.X - i, iniP.Y - rY)); pointList4.Add(new Point(iniP.X - i, iniP.Y + rY)); } - } else { // 焦点在 y 轴上 + } + else + { // 焦点在 y 轴上 a = Math.Sqrt(Math.Abs((endP.Y - iniP.Y) * (endP.Y - iniP.Y) - (endP.X - iniP.X) * (endP.X - iniP.X) * (k * k))); b = a / k; pointList = new List(); @@ -5503,7 +5515,7 @@ private void inkCanvas_MouseUp(object sender, MouseButtonEventArgs e) { collection = lastTempStrokeCollection; } - else if(lastTempStroke != null) + else if (lastTempStroke != null) { collection = new StrokeCollection() { lastTempStroke }; } @@ -5514,7 +5526,7 @@ private void inkCanvas_MouseUp(object sender, MouseButtonEventArgs e) } lastTempStroke = null; lastTempStrokeCollection = null; - if(StrokeManipulationHistory?.Count > 0) + if (StrokeManipulationHistory?.Count > 0) { timeMachine.CommitStrokeManipulationHistory(StrokeManipulationHistory); foreach (var item in StrokeManipulationHistory) @@ -6929,7 +6941,7 @@ private void ImageBlackboard_MouseUp(object sender, MouseButtonEventArgs e) }); })).Start(); } - BorderPenColorRed_MouseUp(BorderPenColorRed, null); + BorderPenColorRed_MouseUp(BorderPenColorRed, null); } BtnSwitch_Click(BtnSwitch, null); diff --git a/Ink Canvas/RandWindow.xaml.cs b/Ink Canvas/RandWindow.xaml.cs index 3831fc57..18994b07 100644 --- a/Ink Canvas/RandWindow.xaml.cs +++ b/Ink Canvas/RandWindow.xaml.cs @@ -1,5 +1,5 @@ -using Microsoft.VisualBasic; -using iNKORE.UI.WPF.Modern.Controls; +using iNKORE.UI.WPF.Modern.Controls; +using Microsoft.VisualBasic; using System; using System.Collections.Generic; using System.IO; diff --git a/Ink Canvas/Settings.cs b/Ink Canvas/Settings.cs index 20a8e358..d1e8ee6d 100644 --- a/Ink Canvas/Settings.cs +++ b/Ink Canvas/Settings.cs @@ -32,7 +32,7 @@ public class Canvas public int InkStyle { get; set; } = 0; [JsonProperty("eraserSize")] public int EraserSize { get; set; } = 2; - [JsonProperty("eraserType")] + [JsonProperty("eraserType")] public int EraserType { get; set; } = 0; // 0 - 图标切换模式 1 - 面积擦 2 - 线条擦 [JsonProperty("hideStrokeWhenSelecting")] public bool HideStrokeWhenSelecting { get; set; } = true; @@ -89,7 +89,7 @@ public class Appearance [JsonProperty("isShowModeFingerToggleSwitch")] public bool IsShowModeFingerToggleSwitch { get; set; } = true; [JsonProperty("theme")] - public int Theme { get; set; } = 0; + public int Theme { get; set; } = 0; } public class PowerPointSettings From bbae10c724e609d0dfa250835453bc30ef7580b9 Mon Sep 17 00:00:00 2001 From: XY Wang Date: Sat, 13 Jul 2024 18:08:23 +0800 Subject: [PATCH 4/9] [Add] Animations --- Ink Canvas/MainWindow.xaml | 23 +++++---- Ink Canvas/MainWindow.xaml.cs | 97 ++++++++++++++++++++++------------- 2 files changed, 75 insertions(+), 45 deletions(-) diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml index 010f3c14..c243fb5d 100644 --- a/Ink Canvas/MainWindow.xaml +++ b/Ink Canvas/MainWindow.xaml @@ -701,7 +701,7 @@ Margin="0,10,0,0" Width="{Binding ElementName=StackPanelColors, Path=ActualWidth}" Height="{Binding ElementName=StackPanelColors, Path=ActualWidth}" Click="BtnColorBlack_Click"> - + @@ -717,7 +717,7 @@ Margin="0,10,0,0" Width="{Binding ElementName=StackPanelColors, Path=ActualWidth}" Height="{Binding ElementName=StackPanelColors, Path=ActualWidth}" Click="BtnColorGreen_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"> - + @@ -725,7 +725,7 @@ Margin="0,10,0,0" Width="{Binding ElementName=StackPanelColors, Path=ActualWidth}" Height="{Binding ElementName=StackPanelColors, Path=ActualWidth}" Click="BtnColorBlue_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"> - + @@ -733,7 +733,7 @@ Margin="0,10,0,0" Width="{Binding ElementName=StackPanelColors, Path=ActualWidth}" Height="{Binding ElementName=StackPanelColors, Path=ActualWidth}" Click="BtnColorYellow_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"> - + @@ -964,6 +964,9 @@ + + + @@ -980,37 +983,37 @@ - + - + - + - + - + - + diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs index 90c37851..00483742 100644 --- a/Ink Canvas/MainWindow.xaml.cs +++ b/Ink Canvas/MainWindow.xaml.cs @@ -47,6 +47,7 @@ public MainWindow() { InitializeComponent(); + BorderSettings.Opacity = 0; BorderSettings.Visibility = Visibility.Collapsed; StackPanelToolButtons.Visibility = Visibility.Collapsed; BorderDrawShape.Visibility = Visibility.Collapsed; @@ -1255,14 +1256,23 @@ private void BtnRestart_Click(object sender, RoutedEventArgs e) Application.Current.Shutdown(); } - private void BtnSettings_Click(object sender, RoutedEventArgs e) + private async void BtnSettings_Click(object sender, RoutedEventArgs e) { - if (BorderSettings.Visibility == Visibility.Visible) + if (BorderSettings.Tag as Visibility? == Visibility.Visible) { + BorderSettings.Tag = Visibility.Collapsed; + BorderSettings.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(50))); + await Task.Delay(60); BorderSettings.Visibility = Visibility.Collapsed; } else { + BorderSettings.Tag = Visibility.Visible; + BorderSettings.Visibility = Visibility.Visible; + BorderSettings.BeginAnimation(OpacityProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(150))); + + // 不要问为什么 + await Task.Delay(160); BorderSettings.Visibility = Visibility.Visible; } } @@ -1724,6 +1734,8 @@ private void StackPanel_IsVisibleChanged(object sender, DependencyPropertyChange int inkColor = 1; + const int ColorSwiftOpacityDurationOn = 150; + const int ColorSwiftOpacityDurationOff = 50; private void ColorSwitchCheck() { //EraserContainer.Background = null; @@ -1768,31 +1780,31 @@ private void ColorSwitchCheck() forceEraser = false; // 改变选中提示 - ViewboxBtnColorBlackContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorBlueContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorGreenContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorRedContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorYellowContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorWhiteContent.Visibility = Visibility.Collapsed; + ViewboxBtnColorBlackContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorBlueContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorGreenContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorRedContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorYellowContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorWhiteContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); switch (inkColor) { case 0: - ViewboxBtnColorBlackContent.Visibility = Visibility.Visible; + ViewboxBtnColorBlackContent.BeginAnimation(OpacityProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOn))); break; case 1: - ViewboxBtnColorRedContent.Visibility = Visibility.Visible; + ViewboxBtnColorRedContent.BeginAnimation(OpacityProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOn))); break; case 2: - ViewboxBtnColorGreenContent.Visibility = Visibility.Visible; + ViewboxBtnColorGreenContent.BeginAnimation(OpacityProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOn))); break; case 3: - ViewboxBtnColorBlueContent.Visibility = Visibility.Visible; + ViewboxBtnColorBlueContent.BeginAnimation(OpacityProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOn))); break; case 4: - ViewboxBtnColorYellowContent.Visibility = Visibility.Visible; + ViewboxBtnColorYellowContent.BeginAnimation(OpacityProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOn))); break; case 5: - ViewboxBtnColorWhiteContent.Visibility = Visibility.Visible; + ViewboxBtnColorWhiteContent.BeginAnimation(OpacityProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOn))); break; } } @@ -2597,7 +2609,7 @@ private void PptApplication_SlideShowBegin(SlideShowWindow Wn) ClearStrokes(true); - BorderFloatingBarMainControls.Visibility = Visibility.Visible; + SetBorderFloatingBarMainControlsVisibility(true, false); BorderPenColorRed_MouseUp(BorderPenColorRed, null); if (Settings.PowerPointSettings.IsShowCanvasAtNewSlideShow == false) @@ -6867,12 +6879,12 @@ private void SymbolIconSelect_MouseUp(object sender, MouseButtonEventArgs e) BtnSelect_Click(BtnSelect, null); ImageEraser.Visibility = Visibility.Visible; - ViewboxBtnColorBlackContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorBlueContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorGreenContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorRedContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorYellowContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorWhiteContent.Visibility = Visibility.Collapsed; + ViewboxBtnColorBlackContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorBlueContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorGreenContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorRedContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorYellowContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorWhiteContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); HideSubPanels(); } @@ -6959,12 +6971,12 @@ private void ImageEraser_MouseUp(object sender, MouseButtonEventArgs e) { BtnErase_Click(BtnErase, e); - ViewboxBtnColorBlackContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorBlueContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorGreenContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorRedContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorYellowContent.Visibility = Visibility.Collapsed; - ViewboxBtnColorWhiteContent.Visibility = Visibility.Collapsed; + ViewboxBtnColorBlackContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorBlueContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorGreenContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorRedContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorYellowContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); + ViewboxBtnColorWhiteContent.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(ColorSwiftOpacityDurationOff))); HideSubPanels(); } @@ -7169,20 +7181,35 @@ void SymbolIconEmoji_MouseUp(object sender, MouseButtonEventArgs e) if (e is null || (downPos.X == e.GetPosition(null).X && downPos.Y == e.GetPosition(null).Y)) { - if (BorderFloatingBarMainControls.Visibility == Visibility.Visible) - { - BorderFloatingBarMainControls.Visibility = Visibility.Collapsed; - } - else - { - BorderFloatingBarMainControls.Visibility = Visibility.Visible; - } + SetBorderFloatingBarMainControlsVisibility(!borderFloatingBarMainControlsVisibility); } GridForFloatingBarDraging.Visibility = Visibility.Collapsed; SymbolIconEmoji.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Emoji2; } + bool borderFloatingBarMainControlsVisibility = true; + void SetBorderFloatingBarMainControlsVisibility(bool isVisible, bool isAnimated = true) + { + borderFloatingBarMainControlsVisibility = isVisible; + if (!isVisible) + { + BorderFloatingBarMainControls.RenderTransform.BeginAnimation(ScaleTransform.ScaleXProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(isAnimated ? 100 : 0)) + { + EasingFunction = new PowerEase() { Power = 4, EasingMode = EasingMode.EaseOut }, + }); + BorderFloatingBarMainControls.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(isAnimated ? 100 : 0))); + } + else + { + BorderFloatingBarMainControls.RenderTransform.BeginAnimation(ScaleTransform.ScaleXProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(isAnimated ? 160 : 0)) + { + EasingFunction = new PowerEase() { Power = 4, EasingMode = EasingMode.EaseOut }, + }); + BorderFloatingBarMainControls.BeginAnimation(OpacityProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(isAnimated ? 160 : 0))); + } + } + #endregion From 1b78ca0ea1b557ba24118295dbfbe4ddf6e316f6 Mon Sep 17 00:00:00 2001 From: XY Wang Date: Sat, 13 Jul 2024 18:57:03 +0800 Subject: [PATCH 5/9] Release new version --- Ink Canvas Packaging/Package.appxmanifest | 2 +- .../Ink Canvas for ARM Packaging.wapproj | 1 + Ink Canvas for ARM Packaging/Package.appxmanifest | 2 +- Ink Canvas/Properties/AssemblyInfo.cs | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Ink Canvas Packaging/Package.appxmanifest b/Ink Canvas Packaging/Package.appxmanifest index f59e2f9b..9f5d3a98 100644 --- a/Ink Canvas Packaging/Package.appxmanifest +++ b/Ink Canvas Packaging/Package.appxmanifest @@ -9,7 +9,7 @@ + Version="4.0.0.0" /> Ink Canvas diff --git a/Ink Canvas for ARM Packaging/Ink Canvas for ARM Packaging.wapproj b/Ink Canvas for ARM Packaging/Ink Canvas for ARM Packaging.wapproj index 5d43db9f..17ed48d3 100644 --- a/Ink Canvas for ARM Packaging/Ink Canvas for ARM Packaging.wapproj +++ b/Ink Canvas for ARM Packaging/Ink Canvas for ARM Packaging.wapproj @@ -63,6 +63,7 @@ arm64 0 ..\Ink Canvas\Ink Canvas.csproj + SHA256 zh-cn diff --git a/Ink Canvas for ARM Packaging/Package.appxmanifest b/Ink Canvas for ARM Packaging/Package.appxmanifest index 6672e88a..96ab6e77 100644 --- a/Ink Canvas for ARM Packaging/Package.appxmanifest +++ b/Ink Canvas for ARM Packaging/Package.appxmanifest @@ -9,7 +9,7 @@ + Version="4.0.0.0" /> Ink Canvas for ARM diff --git a/Ink Canvas/Properties/AssemblyInfo.cs b/Ink Canvas/Properties/AssemblyInfo.cs index bc70ed56..b482bbc3 100644 --- a/Ink Canvas/Properties/AssemblyInfo.cs +++ b/Ink Canvas/Properties/AssemblyInfo.cs @@ -49,5 +49,5 @@ // 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("3.7.2.0")] -[assembly: AssemblyFileVersion("3.7.2.0")] +[assembly: AssemblyVersion("4.0.0.0")] +[assembly: AssemblyFileVersion("4.0.0.0")] From 0296b16fa6825b281f256a97cc20926912f04373 Mon Sep 17 00:00:00 2001 From: XY Wang Date: Sat, 13 Jul 2024 20:10:07 +0800 Subject: [PATCH 6/9] Create sync.yml --- .github/workflows/sync.yml | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/sync.yml diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 00000000..bbd8192b --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,40 @@ +name: Upstream Sync + +permissions: + contents: write + +on: + schedule: + - cron: "0 0 * * *" # every day + workflow_dispatch: + +jobs: + sync_latest_from_upstream: + name: Sync latest commits from upstream repo + runs-on: ubuntu-latest + if: github.repository == 'InkCanvas/Ink-Canvas' + + steps: + # Step 1: run a standard checkout action + - name: Checkout target repo + uses: actions/checkout@v3 + + # Step 2: run the sync action + - name: Sync upstream changes + id: sync + uses: aormsby/Fork-Sync-With-Upstream-action@v3.4 + with: + upstream_sync_repo: WXRIW/Ink-Canvas + upstream_sync_branch: main + target_sync_branch: main + target_repo_token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, no need to set + + # Set test_mode true to run tests instead of the true action!! + test_mode: false + + - name: Sync check + if: failure() + run: | + echo "[Error] Due to a change in the workflow file of the upstream repository, GitHub has automatically suspended the scheduled automatic update. You need to manually sync your fork." + echo "[错误] 由于上游仓库的工作流文件更改,GitHub 已自动暂停计划的自动更新。您需要手动同步您的分支。" + exit 1 From 6790f858699e27a683f9d92b44c5cc7140d7fe17 Mon Sep 17 00:00:00 2001 From: XY Wang Date: Sat, 13 Jul 2024 20:22:35 +0800 Subject: [PATCH 7/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 714f52f1..13796262 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FWXRIW%2FInk-Canvas.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FWXRIW%2FInk-Canvas?ref=badge_shield) [![交流群](https://img.shields.io/badge/-%E4%BA%A4%E6%B5%81%E7%BE%A4%20891913576-blue?style=flat&logo=TencentQQ)](https://jq.qq.com/?_wv=1027&k=NvlM1Rgg) ![GitHub issues](https://img.shields.io/github/issues/WXRIW/Ink-Canvas?logo=github) - + A fantastic Ink Canvas in WPF/C#, with fantastic support for Seewo Boards. 学校从传统投影仪换成了希沃白板,由于自带的“希沃白板”软件太难用,也没有同类好用的画板软件,所以开发了该画板。 From efb2181d1a036968711e995602415cf17b3b24df Mon Sep 17 00:00:00 2001 From: XY Wang Date: Sat, 13 Jul 2024 20:30:18 +0800 Subject: [PATCH 8/9] Update sync.yml --- .github/workflows/sync.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index bbd8192b..de5ad8b7 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -25,8 +25,8 @@ jobs: uses: aormsby/Fork-Sync-With-Upstream-action@v3.4 with: upstream_sync_repo: WXRIW/Ink-Canvas - upstream_sync_branch: main - target_sync_branch: main + upstream_sync_branch: master + target_sync_branch: master target_repo_token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, no need to set # Set test_mode true to run tests instead of the true action!! From e481b84f04b7d071f66c567894983cbfc27a484d Mon Sep 17 00:00:00 2001 From: clover_yan <56215525+clover-yan@users.noreply.github.com> Date: Thu, 18 Jul 2024 21:49:59 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E5=85=81=E8=AE=B8=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=A6=81=E7=94=A8=E5=8F=8C=E6=8C=87=E6=89=8B=E5=8A=BF=20(#142)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/MainWindow.xaml | 1 + Ink Canvas/MainWindow.xaml.cs | 23 +++++++++++++++++++++-- Ink Canvas/Settings.cs | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml index c243fb5d..4e2bdbb7 100644 --- a/Ink Canvas/MainWindow.xaml +++ b/Ink Canvas/MainWindow.xaml @@ -440,6 +440,7 @@ + diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs index 00483742..5239a95b 100644 --- a/Ink Canvas/MainWindow.xaml.cs +++ b/Ink Canvas/MainWindow.xaml.cs @@ -927,6 +927,18 @@ private void LoadSettings(bool isStartup = true) { Settings.Gesture = new Gesture(); } + if (Settings.Gesture.IsDisableLockSmithByDefault) + { + ToggleSwitchDisableLockSmithByDefault.IsOn = true; + _lockSmith = false; + LockSmithSymbol.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Pin; + } + else + { + ToggleSwitchDisableLockSmithByDefault.IsOn = false; + _lockSmith = true; + LockSmithSymbol.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.UnPin; + } if (Settings.Gesture.IsEnableTwoFingerZoom) { ToggleSwitchEnableTwoFingerZoom.IsOn = true; @@ -3317,8 +3329,15 @@ private void ToggleSwitchEnableFingerGestureSlideShowControl_Toggled(object send SaveSettingsToFile(); } - private void ToggleSwitchEnableTwoFingerZoom_Toggled(object sender, RoutedEventArgs e) - { + private void ToggleSwitchDisableLockSmithByDefault_Toggled(object sender, RoutedEventArgs e) { + if (!isLoaded) return; + + Settings.Gesture.IsDisableLockSmithByDefault = ToggleSwitchDisableLockSmithByDefault.IsOn; + + SaveSettingsToFile(); + } + + private void ToggleSwitchEnableTwoFingerZoom_Toggled(object sender, RoutedEventArgs e) { if (!isLoaded) return; Settings.Gesture.IsEnableTwoFingerZoom = ToggleSwitchEnableTwoFingerZoom.IsOn; diff --git a/Ink Canvas/Settings.cs b/Ink Canvas/Settings.cs index d1e8ee6d..79f7a539 100644 --- a/Ink Canvas/Settings.cs +++ b/Ink Canvas/Settings.cs @@ -55,6 +55,8 @@ public class Gesture { [JsonIgnore] public bool IsEnableTwoFingerGesture => IsEnableTwoFingerZoom || IsEnableTwoFingerTranslate || IsEnableTwoFingerRotation; + [JsonProperty("isDisableLockSmithByDefault")] + public bool IsDisableLockSmithByDefault { get; set; } = true; [JsonProperty("isEnableTwoFingerZoom")] public bool IsEnableTwoFingerZoom { get; set; } = true; [JsonProperty("isEnableTwoFingerTranslate")]