diff --git a/InkCanvasForClass/InkCanvasForClass.csproj.user b/InkCanvasForClass/InkCanvasForClass.csproj.user
index a711d86..d9348c4 100644
--- a/InkCanvasForClass/InkCanvasForClass.csproj.user
+++ b/InkCanvasForClass/InkCanvasForClass.csproj.user
@@ -20,6 +20,9 @@
Code
+
+ Code
+
@@ -43,6 +46,9 @@
Designer
+
+ Designer
+
Designer
diff --git a/InkCanvasForClass/MainWindow.xaml b/InkCanvasForClass/MainWindow.xaml
index c95972f..8daff08 100644
--- a/InkCanvasForClass/MainWindow.xaml
+++ b/InkCanvasForClass/MainWindow.xaml
@@ -122,6 +122,10 @@
+
+
+
+
@@ -6008,6 +6012,40 @@
IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold"
Toggled="ToggleSwitchFitToCurve_Toggled" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -8542,6 +8580,13 @@
+
+
diff --git a/InkCanvasForClass/MainWindow.xaml.cs b/InkCanvasForClass/MainWindow.xaml.cs
index 3f7f8d1..e872ba3 100644
--- a/InkCanvasForClass/MainWindow.xaml.cs
+++ b/InkCanvasForClass/MainWindow.xaml.cs
@@ -72,12 +72,6 @@ namespace Ink_Canvas {
BoardBorderDrawShape.Visibility = Visibility.Collapsed;
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
- //if (!App.StartArgs.Contains("-o"))
-
- // old ui
- //ViewBoxStackPanelMain.Visibility = Visibility.Collapsed;
- //ViewBoxStackPanelShapes.Visibility = Visibility.Collapsed;
-
ViewboxFloatingBar.Margin = new Thickness((SystemParameters.WorkArea.Width - 284) / 2,
SystemParameters.WorkArea.Height - 60, -2000, -200);
ViewboxFloatingBarMarginAnimation(100, true);
@@ -266,6 +260,7 @@ namespace Ink_Canvas {
StylusInvertedListenerInit();
PenPaletteV2Init();
+ SelectionV2Init();
InitStorageManagementModule();
}
diff --git a/InkCanvasForClass/MainWindow_cs/MW_FloatingBarIcons.cs b/InkCanvasForClass/MainWindow_cs/MW_FloatingBarIcons.cs
index 0b42d61..0400e6c 100644
--- a/InkCanvasForClass/MainWindow_cs/MW_FloatingBarIcons.cs
+++ b/InkCanvasForClass/MainWindow_cs/MW_FloatingBarIcons.cs
@@ -334,6 +334,7 @@ namespace Ink_Canvas {
// new popup
PenPaletteV2Popup.IsOpen = false;
+ SelectionPopupV2.IsOpen = false;
await Task.Delay(10);
isHidingSubPanelsWhenInking = false;
@@ -845,10 +846,23 @@ namespace Ink_Canvas {
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == SymbolIconSelect && lastBorderMouseDownObject != SymbolIconSelect) return;
-
- BtnSelect_Click(null, null);
- HideSubPanels("select");
+ if (SelectedMode == ICCToolsEnum.LassoMode) {
+ if (SelectionPopupV2.IsOpen == false) {
+ var transform = SymbolIconSelect.TransformToVisual(Main_Grid);
+ var pt = transform.Transform(new Point(0, 0));
+ SelectionPopupV2.VerticalOffset = pt.Y;
+ SelectionPopupV2.HorizontalOffset = pt.X - 32;
+ }
+ SelectionPopupV2.IsOpen = !SelectionPopupV2.IsOpen;
+ } else HideSubPanels("select");
+
+ forceEraser = true;
+ drawingShapeMode = 0;
+ inkCanvas.IsManipulationEnabled = false;
+ if (inkCanvas.EditingMode != InkCanvasEditingMode.Select) {
+ inkCanvas.EditingMode = InkCanvasEditingMode.Select;
+ }
// update tool selection
SelectedMode = ICCToolsEnum.LassoMode;
diff --git a/InkCanvasForClass/MainWindow_cs/MW_SelectionGestures.cs b/InkCanvasForClass/MainWindow_cs/MW_SelectionGestures.cs
index b7708c7..c875ba9 100644
--- a/InkCanvasForClass/MainWindow_cs/MW_SelectionGestures.cs
+++ b/InkCanvasForClass/MainWindow_cs/MW_SelectionGestures.cs
@@ -294,24 +294,35 @@ namespace Ink_Canvas {
CancelCurrentStrokesSelection();
}
- private void RectangleSelectionHitTestBorder_MouseDown(object sender, MouseButtonEventArgs e)
- {
- RectangleSelectionHitTestBorder.CaptureMouse();
- isRectangleSelectionMouseDown = true;
+ private void RectangleSelectionHitTestBorder_MouseDown(object sender, MouseButtonEventArgs e) {
var pt = e.GetPosition(Main_Grid);
- rectangleSelection_FirstPoint = pt;
+ var nt = inkCanvas.Strokes.HitTest(pt, 8);
+ if (nt.Count > 0) {
+ if (nt.Count > 1) {
+ var nodia = nt.HitTest(pt);
+ if (nodia.Count > 0) {
+ inkCanvas.Select(new StrokeCollection() {nodia[nodia.Count-1]});
+ } else {
+ inkCanvas.Select(new StrokeCollection() { nt[0] });
+ }
+ } else if (nt.Count == 1) {
+ inkCanvas.Select(nt);
+ }
+ } else {
+ RectangleSelectionHitTestBorder.CaptureMouse();
+ isRectangleSelectionMouseDown = true;
+ rectangleSelection_FirstPoint = pt;
+ }
}
- private void RectangleSelectionHitTestBorder_MouseMove(object sender, MouseEventArgs e)
- {
- if (!isRectangleSelectionMouseDown) return;
+ private void RectangleSelectionHitTestBorder_MouseMove(object sender, MouseEventArgs e) {
var pt = e.GetPosition(Main_Grid);
+ if (!isRectangleSelectionMouseDown) return;
rectangleSelection_LastPoint = pt;
RectangleSelection.DrawSelectionBox(new Rect(rectangleSelection_FirstPoint, rectangleSelection_LastPoint));
}
- private void RectangleSelectionHitTestBorder_MouseUp(object sender, MouseButtonEventArgs e)
- {
+ private void RectangleSelectionHitTestBorder_MouseUp(object sender, MouseButtonEventArgs e) {
RectangleSelectionHitTestBorder.ReleaseMouseCapture();
isRectangleSelectionMouseDown = false;
var pt = e.GetPosition(Main_Grid);
@@ -339,28 +350,6 @@ namespace Ink_Canvas {
RectangleSelection.ClearDrawing();
}
- private void BtnSelect_Click(object sender, RoutedEventArgs e) {
- forceEraser = true;
- drawingShapeMode = 0;
- inkCanvas.IsManipulationEnabled = false;
- if (inkCanvas.EditingMode == InkCanvasEditingMode.Select) {
- if (inkCanvas.GetSelectedStrokes().Count == inkCanvas.Strokes.Count) {
- inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
- inkCanvas.EditingMode = InkCanvasEditingMode.Select;
- }
- else {
- var selectedStrokes = new StrokeCollection();
- foreach (var stroke in inkCanvas.Strokes)
- if (stroke.GetBounds().Width > 0 && stroke.GetBounds().Height > 0)
- selectedStrokes.Add(stroke);
- inkCanvas.Select(selectedStrokes);
- }
- }
- else {
- inkCanvas.EditingMode = InkCanvasEditingMode.Select;
- }
- }
-
private Border[] StrokeSelectionBorderHandles = new Border[] { };
@@ -527,8 +516,9 @@ namespace Ink_Canvas {
}
if (final_w >= 1 && final_h >= 1) {
- StrokeSelectionBorder.Width = final_w;
- StrokeSelectionBorder.Height = final_h;
+ // 此處還需要修改行為,讓其能夠縮放到1x1;
+ StrokeSelectionBorder.Width = final_w >=1 ? final_w : 1;
+ StrokeSelectionBorder.Height = final_h >=1 ? final_h : 1;
System.Windows.Controls.Canvas.SetLeft(StrokeSelectionBorder, l);
System.Windows.Controls.Canvas.SetTop(StrokeSelectionBorder, t);
@@ -1268,5 +1258,30 @@ namespace Ink_Canvas {
}
catch { }
}
+
+ #region SelectionV2 Popup
+
+ private void SelectionV2Init() {
+ SelectionV2.SelectAllEvent += (sender, args) => {
+ inkCanvas.Select(inkCanvas.Strokes);
+ SelectionPopupV2.IsOpen = false;
+ };
+ SelectionV2.UnSelectEvent += (sender, args) => {
+ CancelCurrentStrokesSelection();
+ SelectionPopupV2.IsOpen = false;
+ };
+ SelectionV2.ReverseSelectEvent += (sender, args) => {
+ var strokes = new StrokeCollection(inkCanvas.Strokes.Where(stroke =>
+ !inkCanvas.GetSelectedStrokes().Contains(stroke)).Where(stroke=>!stroke.ContainsPropertyData(IsLockGuid)));
+ if (strokes.Any()) {
+ inkCanvas.Select(strokes);
+ } else {
+ CancelCurrentStrokesSelection();
+ }
+ SelectionPopupV2.IsOpen = false;
+ };
+ }
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/InkCanvasForClass/Popups/SelectionPopup.xaml b/InkCanvasForClass/Popups/SelectionPopup.xaml
new file mode 100644
index 0000000..e87204d
--- /dev/null
+++ b/InkCanvasForClass/Popups/SelectionPopup.xaml
@@ -0,0 +1,183 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/InkCanvasForClass/Popups/SelectionPopup.xaml.cs b/InkCanvasForClass/Popups/SelectionPopup.xaml.cs
new file mode 100644
index 0000000..fe3e78b
--- /dev/null
+++ b/InkCanvasForClass/Popups/SelectionPopup.xaml.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Ink_Canvas.Popups {
+ public partial class SelectionPopup : UserControl {
+ public SelectionPopup() {
+ InitializeComponent();
+ }
+
+ private bool isCloseButtonDown = false;
+ public event EventHandler SelectionPopupShouldCloseEvent;
+ public event EventHandler SelectAllEvent;
+ public event EventHandler UnSelectEvent;
+ public event EventHandler ReverseSelectEvent;
+
+ private void CloseButtonBorder_MouseDown(object sender, MouseButtonEventArgs e) {
+ isCloseButtonDown = true;
+ CloseButtonBorder.Background = new SolidColorBrush(Color.FromArgb(34, 220, 38, 38));
+ }
+
+ private void CloseButtonBorder_MouseLeave(object sender, MouseEventArgs e) {
+ isCloseButtonDown = false;
+ CloseButtonBorder.Background = new SolidColorBrush(Colors.Transparent);
+ }
+
+ private void CloseButtonBorder_MouseUp(object sender, MouseButtonEventArgs e) {
+ if (!isCloseButtonDown) return;
+
+ CloseButtonBorder_MouseLeave(null, null);
+ SelectionPopupShouldCloseEvent?.Invoke(this,new RoutedEventArgs());
+ }
+
+ private void SelectAllButtonClicked(object sender, RoutedEventArgs e) {
+ SelectAllEvent?.Invoke(this,new RoutedEventArgs());
+ }
+
+ private void UnSelectButtonClicked(object sender, RoutedEventArgs e) {
+ UnSelectEvent?.Invoke(this,new RoutedEventArgs());
+ }
+
+ private void ReverseSelectButtonClicked(object sender, RoutedEventArgs e) {
+ ReverseSelectEvent?.Invoke(this,new RoutedEventArgs());
+ }
+ }
+}