[update] 选择子面板,墨迹选择相关设置(还没写完,这几天事情太多了)

This commit is contained in:
Dubi906w 2024-08-05 21:53:56 +08:00
parent 54e5e515d5
commit 16086741e8
7 changed files with 358 additions and 43 deletions

View File

@ -20,6 +20,9 @@
<Compile Update="Popups\ScreenshotWindow.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Popups\SelectionPopup.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Update="MainWindow_cs\MW_ContextMenus.xaml">
@ -43,6 +46,9 @@
<Page Update="Popups\ScreenshotWindow.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Popups\SelectionPopup.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Resources\GeometryIcons.xaml">
<SubType>Designer</SubType>
</Page>

View File

@ -122,6 +122,10 @@
<popups:ColorPalette x:Name="PenPaletteV2" Width="300" />
</Popup>
<Popup Name="SelectionPopupV2" PopupAnimation="Fade" IsOpen="False" StaysOpen="True" AllowsTransparency="True" Placement="Bottom">
<popups:SelectionPopup x:Name="SelectionV2" Width="300" />
</Popup>
<!--// 黑/白 板幕布 //-->
<Grid Name="GridBackgroundCoverHolder">
<Grid Name="GridBackgroundCover" Visibility="Collapsed" Background="#1F1F1F" />
@ -6008,6 +6012,40 @@
IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold"
Toggled="ToggleSwitchFitToCurve_Toggled" />
</ui:SimpleStackPanel>
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0" Stroke="#3f3f46"
StrokeThickness="1" Margin="0,4,0,4" />
<TextBlock Margin="0,0,0,8" Text="选择" FontWeight="Bold" Foreground="#fafafa"
FontSize="20" />
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Foreground="#fafafa" Text="墨迹选择模式" VerticalAlignment="Center"
FontSize="14" Margin="0,0,6,0" />
<Border Height="20" CornerRadius="3" Background="#1e3a8a" Margin="0,0,12,0"
Padding="4,0">
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="3"
VerticalAlignment="Center">
<Image Width="16" Height="16" VerticalAlignment="Center">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#dbeafe"
Geometry="F0 M24,24z M0,0z M18.75,4C18.75,3.58579 18.4142,3.25 18,3.25 17.5858,3.25 17.25,3.58579 17.25,4 17.25,4.33152 17.1183,4.64946 16.8839,4.88388 16.6495,5.1183 16.3315,5.25 16,5.25 15.5858,5.25 15.25,5.58579 15.25,6 15.25,6.41421 15.5858,6.75 16,6.75 16.3315,6.75 16.6495,6.8817 16.8839,7.11612 17.1183,7.35054 17.25,7.66848 17.25,8 17.25,8.41421 17.5858,8.75 18,8.75 18.4142,8.75 18.75,8.41421 18.75,8 18.75,7.66848 18.8817,7.35054 19.1161,7.11612 19.3505,6.8817 19.6685,6.75 20,6.75 20.4142,6.75 20.75,6.41421 20.75,6 20.75,5.58579 20.4142,5.25 20,5.25 19.6685,5.25 19.3505,5.1183 19.1161,4.88388 18.8817,4.64946 18.75,4.33152 18.75,4z M9.75,6C9.75,5.58579 9.41421,5.25 9,5.25 8.58579,5.25 8.25,5.58579 8.25,6 8.25,7.39239 7.69688,8.72774 6.71231,9.71231 5.72774,10.6969 4.39239,11.25 3,11.25 2.58579,11.25 2.25,11.5858 2.25,12 2.25,12.4142 2.58579,12.75 3,12.75 4.39239,12.75 5.72774,13.3031 6.71231,14.2877 7.69688,15.2723 8.25,16.6076 8.25,18 8.25,18.4142 8.58579,18.75 9,18.75 9.41421,18.75 9.75,18.4142 9.75,18 9.75,16.6076 10.3031,15.2723 11.2877,14.2877 12.2723,13.3031 13.6076,12.75 15,12.75 15.4142,12.75 15.75,12.4142 15.75,12 15.75,11.5858 15.4142,11.25 15,11.25 13.6076,11.25 12.2723,10.6969 11.2877,9.71231 10.3031,8.72774 9.75,7.39239 9.75,6z M18.75,16C18.75,15.5858 18.4142,15.25 18,15.25 17.5858,15.25 17.25,15.5858 17.25,16 17.25,16.3315 17.1183,16.6495 16.8839,16.8839 16.6495,17.1183 16.3315,17.25 16,17.25 15.5858,17.25 15.25,17.5858 15.25,18 15.25,18.4142 15.5858,18.75 16,18.75 16.3315,18.75 16.6495,18.8817 16.8839,19.1161 17.1183,19.3505 17.25,19.6685 17.25,20 17.25,20.4142 17.5858,20.75 18,20.75 18.4142,20.75 18.75,20.4142 18.75,20 18.75,19.6685 18.8817,19.3505 19.1161,19.1161 19.3505,18.8817 19.6685,18.75 20,18.75 20.4142,18.75 20.75,18.4142 20.75,18 20.75,17.5858 20.4142,17.25 20,17.25 19.6685,17.25 19.3505,17.1183 19.1161,16.8839 18.8817,16.6495 18.75,16.3315 18.75,16z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Foreground="#dbeafe" Text="新功能" FontSize="12"
VerticalAlignment="Center">
</TextBlock>
</ui:SimpleStackPanel>
</Border>
<ComboBox Name="ComboBoxSelectionMethod" FontFamily="Microsoft YaHei UI"
SelectedIndex="0">
<ComboBoxItem Content="矩形框选" FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="套索圈选" FontFamily="Microsoft YaHei UI" />
</ComboBox>
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
</GroupBox>
<GroupBox Name="SettingsGestureGroupBox">
@ -8542,6 +8580,13 @@
<TextBlock
Text="© 2022-2024 HARKOTEK Studio 提供技术支持"
TextWrapping="Wrap" Foreground="#a1a1aa" />
<TextBlock
Text="感谢 HARKOTEK Studio 的成员 “幻想熵K2ro_” 提供技术支持"
TextWrapping="Wrap" Foreground="#a1a1aa" />
<TextBlock
Text="ICC的部分元素设计参考来源于© iNKORE! 名下产品 Inkways已经过授权使用最终解释权归 Yoojun Zhou 所有"
TextWrapping="Wrap" Foreground="#a1a1aa" />
<TextBlock
Text="osu! 相关素材:© ppy powered 2007-2024"
TextWrapping="Wrap" Foreground="#a1a1aa" />

View File

@ -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();
}

View File

@ -334,6 +334,7 @@ namespace Ink_Canvas {
// new popup
PenPaletteV2Popup.IsOpen = false;
SelectionPopupV2.IsOpen = false;
await Task.Delay(10);
isHidingSubPanelsWhenInking = false;
@ -846,9 +847,22 @@ namespace Ink_Canvas {
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == SymbolIconSelect && lastBorderMouseDownObject != SymbolIconSelect) return;
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");
BtnSelect_Click(null, null);
HideSubPanels("select");
forceEraser = true;
drawingShapeMode = 0;
inkCanvas.IsManipulationEnabled = false;
if (inkCanvas.EditingMode != InkCanvasEditingMode.Select) {
inkCanvas.EditingMode = InkCanvasEditingMode.Select;
}
// update tool selection
SelectedMode = ICCToolsEnum.LassoMode;

View File

@ -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
}
}

View File

@ -0,0 +1,183 @@
<UserControl x:Class="Ink_Canvas.Popups.SelectionPopup"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Ink_Canvas.Popups"
xmlns:modern="http://schemas.inkore.net/lib/ui/wpf/modern"
mc:Ignorable="d" Width="300" Height="209" UseLayoutRounding="True">
<Grid>
<Border Margin="8" Background="#f4f4f5" BorderBrush="#3b82f6" BorderThickness="2" CornerRadius="6">
<Border.Effect>
<DropShadowEffect BlurRadius="5" Opacity="0.2" />
</Border.Effect>
<Grid>
<modern:SimpleStackPanel Spacing="4" Margin="8,0" Height="40" VerticalAlignment="Top" Orientation="Horizontal">
<Border x:Name="LassoTabButton" VerticalAlignment="Bottom"
Background="#223b82f6" Height="34" Width="96"
CornerRadius="6">
<Grid>
<modern:SimpleStackPanel
x:Name="LassoTabButtonIndicator"
Visibility="Visible"
Orientation="Horizontal"
HorizontalAlignment="Center"
VerticalAlignment="Bottom">
<Border Width="32" Height="4"
Background="#2563eb" CornerRadius="2" />
</modern:SimpleStackPanel>
<modern:SimpleStackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,2">
<modern:SimpleStackPanel
VerticalAlignment="Center"
Orientation="Horizontal"
HorizontalAlignment="Center">
<Image Height="20" Width="20">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing x:Name="LassoTabButtonIcon" Brush="#2563eb" Geometry="F0 M24,24z M0,0z M3.98316,13.1776C3.35263,12.2377 3.00974,11.1318 3.00003,9.99608 3.00274,6.3269 6.81405,3 12,3 17.1827,3 20.9924,6.32263 21,9.98902 20.9861,10.5697 20.8906,11.1456 20.7162,11.6997 20.5503,12.2265 20.843,12.788 21.3698,12.9539 21.8966,13.1197 22.4581,12.8271 22.6239,12.3003 22.8561,11.5624 22.9827,10.7954 22.9998,10.0221L23,10C23,4.83074 17.8522,1 12,1 6.14786,1 1.00003,4.83074 1.00003,10L1,10 1.00006,10.0079C1.01259,11.6014 1.51288,13.1514 2.43137,14.4502 2.1515,14.914 2.00003,15.4492 2.00003,16 2.00003,16.7956 2.3161,17.5587 2.87871,18.1213 3.21344,18.456 3.61912,18.7035 4.06041,18.8491 4.15138,19.4855 4.34432,20.105 4.63347,20.6833 5.05003,21.5164 5.65485,22.2411 6.40003,22.8 6.84186,23.1314 7.46866,23.0418 7.80003,22.6 8.1314,22.1582 8.04186,21.5314 7.60003,21.2 7.10325,20.8274 6.70003,20.3443 6.42232,19.7889 6.26497,19.4742 6.15036,19.1411 6.08057,18.7986 6.46727,18.6493 6.82258,18.4201 7.12135,18.1213 7.13419,18.1085 7.1469,18.0955 7.15948,18.0825 8.01906,18.4228 8.91036,18.6755 9.82719,18.8268 10.3721,18.9168 10.8867,18.5479 10.9767,18.003 11.0666,17.4581 10.6978,16.9435 10.1529,16.8535 9.4167,16.732 8.69395,16.5316 7.98881,16.2593 7.99626,16.1734 8.00003,16.0869 8.00003,16 8.00003,15.2044 7.68396,14.4413 7.12135,13.8787 6.55874,13.3161 5.79568,13 5.00003,13 4.65,13 4.30628,13.0612 3.98316,13.1776z M5.00003,17C5.26525,17 5.5196,16.8946 5.70714,16.7071 5.89467,16.5196 6.00003,16.2652 6.00003,16 6.00003,15.7348 5.89467,15.4804 5.70714,15.2929 5.5196,15.1054 5.26525,15 5.00003,15 4.73481,15 4.48046,15.1054 4.29292,15.2929 4.10539,15.4804 4.00003,15.7348 4.00003,16 4.00003,16.2652 4.10539,16.5196 4.29292,16.7071 4.48046,16.8946 4.73481,17 5.00003,17z M14.33,10.3398C14.6781,10.3398,14.9666,10.4752,15.1755,10.6477L22.5072,16.6409C22.7213,16.8121 22.8775,17.0452 22.954,17.3087 23.032,17.5769 23.0235,17.8628 22.9299,18.1259 22.8362,18.389 22.6621,18.616 22.4323,18.7746 22.2062,18.9306 21.9375,19.0127 21.6631,19.0098L17.7148,19.0098 15.4417,22.415C15.4316,22.4303 15.421,22.4452 15.41,22.4598 15.2843,22.6275 15.1212,22.7636 14.9338,22.8573 14.7463,22.951 14.5396,22.9998 14.33,22.9998L14.24,22.9998C14.1335,22.9998 14.0276,22.9828 13.9264,22.9494 13.6644,22.8629 13.4353,22.6982 13.2698,22.4775 13.1043,22.2568 13.0104,21.9908 13.0007,21.7151 13.0002,21.7033 13,21.6916 13,21.6798L13,11.6803 13,11.6798C13,11.3313 13.1357,10.9965 13.3785,10.7464 13.6213,10.4962 13.9521,10.3505 14.3006,10.3403 14.3104,10.34 14.3202,10.3398 14.33,10.3398z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock
x:Name="LassoTabButtonText"
Foreground="#2563eb"
FontWeight="Medium"
FontSize="14" TextAlignment="Center"
VerticalAlignment="Center"
Text="套索选择" Margin="4,0,0,0" />
</modern:SimpleStackPanel>
</modern:SimpleStackPanel>
</Grid>
</Border>
<Border x:Name="RectangleTabButton" VerticalAlignment="Bottom"
Background="#223b82f6" Height="34" Width="96"
CornerRadius="6">
<Grid>
<modern:SimpleStackPanel
x:Name="RectangleTabButtonIndicator"
Visibility="Visible"
Orientation="Horizontal"
HorizontalAlignment="Center"
VerticalAlignment="Bottom">
<Border Width="32" Height="4"
Background="#2563eb" CornerRadius="2" />
</modern:SimpleStackPanel>
<modern:SimpleStackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,2">
<modern:SimpleStackPanel
VerticalAlignment="Center"
Orientation="Horizontal"
HorizontalAlignment="Center">
<Image Height="20" Width="20">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing x:Name="RectangleTabButtonIcon" Brush="#2563eb" Geometry="F0 M24,24z M0,0z M2.87868,2.87868C3.44129,2.31607 4.20435,2 5,2 5.55228,2 6,2.44772 6,3 6,3.55228 5.55228,4 5,4 4.73478,4 4.48043,4.10536 4.29289,4.29289 4.10536,4.48043 4,4.73478 4,5 4,5.55228 3.55228,6 3,6 2.44772,6 2,5.55228 2,5 2,4.20435 2.31607,3.44129 2.87868,2.87868z M18,3C18,2.44772 18.4477,2 19,2 19.7957,2 20.5587,2.31607 21.1213,2.87868 21.6839,3.44129 22,4.20435 22,5 22,5.55228 21.5523,6 21,6 20.4477,6 20,5.55228 20,5 20,4.73478 19.8946,4.48043 19.7071,4.29289 19.5196,4.10536 19.2652,4 19,4 18.4477,4 18,3.55228 18,3z M11.2929,11.2929C11.5758,11.0101,12,10.923,12.3714,11.0716L22.3714,15.0716C22.7518,15.2237 23.0009,15.5924 23,16.002 22.9992,16.4117 22.7486,16.7794 22.3677,16.93L18.4707,18.4707 16.93,22.3677C16.7794,22.7486 16.4117,22.9992 16.002,23 15.5924,23.0009 15.2237,22.7518 15.0716,22.3714L11.0716,12.3714C10.923,12,11.0101,11.5758,11.2929,11.2929z M4,19C4,18.4477 3.55228,18 3,18 2.44772,18 2,18.4477 2,19 2,19.7957 2.31607,20.5587 2.87868,21.1213 3.44129,21.6839 4.20435,22 5,22 5.55228,22 6,21.5523 6,21 6,20.4477 5.55228,20 5,20 4.73478,20 4.48043,19.8946 4.29289,19.7071 4.10536,19.5196 4,19.2652 4,19z M8,3C8,2.44772,8.44772,2,9,2L10,2C10.5523,2 11,2.44772 11,3 11,3.55228 10.5523,4 10,4L9,4C8.44772,4,8,3.55228,8,3z M9,20C8.44772,20 8,20.4477 8,21 8,21.5523 8.44772,22 9,22L11,22C11.5523,22 12,21.5523 12,21 12,20.4477 11.5523,20 11,20L9,20z M13,3C13,2.44772,13.4477,2,14,2L15,2C15.5523,2 16,2.44772 16,3 16,3.55228 15.5523,4 15,4L14,4C13.4477,4,13,3.55228,13,3z M4,9C4,8.44772 3.55228,8 3,8 2.44772,8 2,8.44772 2,9L2,10C2,10.5523 2.44772,11 3,11 3.55228,11 4,10.5523 4,10L4,9z M21,8C21.5523,8,22,8.44772,22,9L22,11C22,11.5523 21.5523,12 21,12 20.4477,12 20,11.5523 20,11L20,9C20,8.44772,20.4477,8,21,8z M4,14C4,13.4477 3.55228,13 3,13 2.44772,13 2,13.4477 2,14L2,15C2,15.5523 2.44772,16 3,16 3.55228,16 4,15.5523 4,15L4,14z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock
x:Name="RectangleTabButtonText"
Foreground="#2563eb"
FontWeight="Medium"
FontSize="14" TextAlignment="Center"
VerticalAlignment="Center"
Text="矩形框选" Margin="4,0,0,0" />
</modern:SimpleStackPanel>
</modern:SimpleStackPanel>
</Grid>
</Border>
</modern:SimpleStackPanel>
<Border Name="CloseButtonBorder" MouseDown="CloseButtonBorder_MouseDown" MouseUp="CloseButtonBorder_MouseUp" MouseLeave="CloseButtonBorder_MouseLeave"
Height="34" Width="34" CornerRadius="6" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,6,8,0">
<Image Height="24" Width="24">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#dc2626" Geometry="F0 M24,24z M0,0z M18.7071,6.70711C19.0976,6.31658 19.0976,5.68342 18.7071,5.29289 18.3166,4.90237 17.6834,4.90237 17.2929,5.29289L12,10.5858 6.70711,5.29289C6.31658,4.90237 5.68342,4.90237 5.29289,5.29289 4.90237,5.68342 4.90237,6.31658 5.29289,6.70711L10.5858,12 5.29289,17.2929C4.90237,17.6834 4.90237,18.3166 5.29289,18.7071 5.68342,19.0976 6.31658,19.0976 6.70711,18.7071L12,13.4142 17.2929,18.7071C17.6834,19.0976 18.3166,19.0976 18.7071,18.7071 19.0976,18.3166 19.0976,17.6834 18.7071,17.2929L13.4142,12 18.7071,6.70711z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Border>
<Grid Margin="0,40,0,0" modern:ThemeManager.RequestedTheme="Light">
<!--main menu-->
<Border Margin="6" CornerRadius="6" Background="#fafafa" BorderBrush="#d4d4d8" BorderThickness="1">
<Grid>
<modern:SimpleStackPanel Orientation="Vertical">
<Grid Margin="8,9,8,0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button Click="SelectAllButtonClicked" Grid.Column="0" HorizontalAlignment="Stretch" Margin="0,0,3,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Image Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M5,4C5,3.44772 4.55228,3 4,3 3.44772,3 3,3.44772 3,4L3,4.01C3,4.56228 3.44772,5.01 4,5.01 4.55228,5.01 5,4.56228 5,4.01L5,4z M7.58579,7.58579C7.96086,7.21071,8.46957,7,9,7L15,7C15.5304,7 16.0391,7.21071 16.4142,7.58579 16.7893,7.96086 17,8.46957 17,9L17,15C17,15.5304 16.7893,16.0391 16.4142,16.4142 16.0391,16.7893 15.5304,17 15,17L9,17C8.46957,17 7.96086,16.7893 7.58579,16.4142 7.21071,16.0391 7,15.5304 7,15L7,9C7,8.46957,7.21071,7.96086,7.58579,7.58579z M12,19C12.5523,19,13,19.4477,13,20L13,20.01C13,20.5623 12.5523,21.01 12,21.01 11.4477,21.01 11,20.5623 11,20.01L11,20C11,19.4477,11.4477,19,12,19z M17,20C17,19.4477 16.5523,19 16,19 15.4477,19 15,19.4477 15,20L15,20.01C15,20.5623 15.4477,21.01 16,21.01 16.5523,21.01 17,20.5623 17,20.01L17,20z M8,19C8.55228,19,9,19.4477,9,20L9,20.01C9,20.5623 8.55228,21.01 8,21.01 7.44772,21.01 7,20.5623 7,20.01L7,20C7,19.4477,7.44772,19,8,19z M5,20C5,19.4477 4.55228,19 4,19 3.44772,19 3,19.4477 3,20L3,20.01C3,20.5623 3.44772,21.01 4,21.01 4.55228,21.01 5,20.5623 5,20.01L5,20z M4,15C4.55228,15,5,15.4477,5,16L5,16.01C5,16.5623 4.55228,17.01 4,17.01 3.44772,17.01 3,16.5623 3,16.01L3,16C3,15.4477,3.44772,15,4,15z M5,12C5,11.4477 4.55228,11 4,11 3.44772,11 3,11.4477 3,12L3,12.01C3,12.5623 3.44772,13.01 4,13.01 4.55228,13.01 5,12.5623 5,12.01L5,12z M4,7C4.55228,7,5,7.44772,5,8L5,8.01C5,8.56228 4.55228,9.01 4,9.01 3.44772,9.01 3,8.56228 3,8.01L3,8C3,7.44772,3.44772,7,4,7z M8,3C8.55228,3,9,3.44772,9,4L9,4.01C9,4.56228 8.55228,5.01 8,5.01 7.44772,5.01 7,4.56228 7,4.01L7,4C7,3.44772,7.44772,3,8,3z M13,4C13,3.44772 12.5523,3 12,3 11.4477,3 11,3.44772 11,4L11,4.01C11,4.56228 11.4477,5.01 12,5.01 12.5523,5.01 13,4.56228 13,4.01L13,4z M16,3C16.5523,3,17,3.44772,17,4L17,4.01C17,4.56228 16.5523,5.01 16,5.01 15.4477,5.01 15,4.56228 15,4.01L15,4C15,3.44772,15.4477,3,16,3z M21,4C21,3.44772 20.5523,3 20,3 19.4477,3 19,3.44772 19,4L19,4.01C19,4.56228 19.4477,5.01 20,5.01 20.5523,5.01 21,4.56228 21,4.01L21,4z M20,7C20.5523,7,21,7.44772,21,8L21,8.01C21,8.56228 20.5523,9.01 20,9.01 19.4477,9.01 19,8.56228 19,8.01L19,8C19,7.44772,19.4477,7,20,7z M21,12C21,11.4477 20.5523,11 20,11 19.4477,11 19,11.4477 19,12L19,12.01C19,12.5623 19.4477,13.01 20,13.01 20.5523,13.01 21,12.5623 21,12.01L21,12z M20,15C20.5523,15,21,15.4477,21,16L21,16.01C21,16.5623 20.5523,17.01 20,17.01 19.4477,17.01 19,16.5623 19,16.01L19,16C19,15.4477,19.4477,15,20,15z M15,9L9,9 9,15 15,15 15,9z M21,20C21,19.4477 20.5523,19 20,19 19.4477,19 19,19.4477 19,20L19,20.01C19,20.5623 19.4477,21.01 20,21.01 20.5523,21.01 21,20.5623 21,20.01L21,20z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Text="全选" VerticalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Button>
<Button Click="UnSelectButtonClicked" ClipToBounds="False" Grid.Column="1" HorizontalAlignment="Stretch" Margin="3,0,3,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Image Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M3.70711,2.29289C3.31658,1.90237 2.68342,1.90237 2.29289,2.29289 1.90237,2.68342 1.90237,3.31658 2.29289,3.70711L7,8.41421 7,15C7,15.5304 7.21071,16.0391 7.58579,16.4142 7.96086,16.7893 8.46957,17 9,17L15.5858,17 20.2929,21.7071C20.6834,22.0976 21.3166,22.0976 21.7071,21.7071 22.0976,21.3166 22.0976,20.6834 21.7071,20.2929L3.70711,2.29289z M13.5858,15L9,10.4142 9,15 13.5858,15z M8,3C8.55228,3,9,3.44772,9,4L9,4.01C9,4.56228 8.55228,5.01 8,5.01 7.44772,5.01 7,4.56228 7,4.01L7,4C7,3.44772,7.44772,3,8,3z M12,9C11.4477,9 11,8.55228 11,8 11,7.44772 11.4477,7 12,7L15,7C15.5304,7 16.0391,7.21071 16.4142,7.58579 16.7893,7.96086 17,8.46957 17,9L17,12C17,12.5523 16.5523,13 16,13 15.4477,13 15,12.5523 15,12L15,9 12,9z M13,20C13,19.4477 12.5523,19 12,19 11.4477,19 11,19.4477 11,20L11,20.01C11,20.5623 11.4477,21.01 12,21.01 12.5523,21.01 13,20.5623 13,20.01L13,20z M16,19C16.5523,19,17,19.4477,17,20L17,20.01C17,20.5623 16.5523,21.01 16,21.01 15.4477,21.01 15,20.5623 15,20.01L15,20C15,19.4477,15.4477,19,16,19z M9,20C9,19.4477 8.55228,19 8,19 7.44772,19 7,19.4477 7,20L7,20.01C7,20.5623 7.44772,21.01 8,21.01 8.55228,21.01 9,20.5623 9,20.01L9,20z M4,19C4.55228,19,5,19.4477,5,20L5,20.01C5,20.5623 4.55228,21.01 4,21.01 3.44772,21.01 3,20.5623 3,20.01L3,20C3,19.4477,3.44772,19,4,19z M5,16C5,15.4477 4.55228,15 4,15 3.44772,15 3,15.4477 3,16L3,16.01C3,16.5623 3.44772,17.01 4,17.01 4.55228,17.01 5,16.5623 5,16.01L5,16z M4,11C4.55228,11,5,11.4477,5,12L5,12.01C5,12.5623 4.55228,13.01 4,13.01 3.44772,13.01 3,12.5623 3,12.01L3,12C3,11.4477,3.44772,11,4,11z M5,8C5,7.44772 4.55228,7 4,7 3.44772,7 3,7.44772 3,8L3,8.01C3,8.56228 3.44772,9.01 4,9.01 4.55228,9.01 5,8.56228 5,8.01L5,8z M13,4C13,3.44772 12.5523,3 12,3 11.4477,3 11,3.44772 11,4L11,4.01C11,4.56228 11.4477,5.01 12,5.01 12.5523,5.01 13,4.56228 13,4.01L13,4z M16,3C16.5523,3,17,3.44772,17,4L17,4.01C17,4.56228 16.5523,5.01 16,5.01 15.4477,5.01 15,4.56228 15,4.01L15,4C15,3.44772,15.4477,3,16,3z M21,4C21,3.44772 20.5523,3 20,3 19.4477,3 19,3.44772 19,4L19,4.01C19,4.56228 19.4477,5.01 20,5.01 20.5523,5.01 21,4.56228 21,4.01L21,4z M20,7C20.5523,7,21,7.44772,21,8L21,8.01C21,8.56228 20.5523,9.01 20,9.01 19.4477,9.01 19,8.56228 19,8.01L19,8C19,7.44772,19.4477,7,20,7z M21,12C21,11.4477 20.5523,11 20,11 19.4477,11 19,11.4477 19,12L19,12.01C19,12.5623 19.4477,13.01 20,13.01 20.5523,13.01 21,12.5623 21,12.01L21,12z M20,15C20.5523,15,21,15.4477,21,16L21,16.01C21,16.5623 20.5523,17.01 20,17.01 19.4477,17.01 19,16.5623 19,16.01L19,16C19,15.4477,19.4477,15,20,15z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Text="清选" VerticalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Button>
<Button Click="ReverseSelectButtonClicked" Grid.Column="2" HorizontalAlignment="Stretch" Margin="3,0,0,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Image Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M10,5C9.73478,5 9.48043,5.10536 9.29289,5.29289 9.10536,5.48043 9,5.73478 9,6L9,7 10,7C10.5523,7 11,7.44772 11,8 11,8.55228 10.5523,9 10,9L9,9 9,10C9,10.5523 8.55228,11 8,11 7.44772,11 7,10.5523 7,10L7,9 6,9C5.73478,9 5.48043,9.10536 5.29289,9.29289 5.10536,9.48043 5,9.73478 5,10L5,18C5,18.2652 5.10536,18.5196 5.29289,18.7071 5.48043,18.8946 5.73478,19 6,19L14,19C14.2652,19 14.5196,18.8946 14.7071,18.7071 14.8946,18.5196 15,18.2652 15,18L15,17 14,17C13.4477,17 13,16.5523 13,16 13,15.4477 13.4477,15 14,15L15,15 15,14C15,13.4477 15.4477,13 16,13 16.5523,13 17,13.4477 17,14L17,15 18,15C18.2652,15 18.5196,14.8946 18.7071,14.7071 18.8946,14.5196 19,14.2652 19,14L19,6C19,5.73478 18.8946,5.48043 18.7071,5.29289 18.5196,5.10536 18.2652,5 18,5L10,5z M7.87868,3.87868C8.44129,3.31607,9.20435,3,10,3L18,3C18.7956,3 19.5587,3.31607 20.1213,3.87868 20.6839,4.44129 21,5.20435 21,6L21,14C21,14.7957 20.6839,15.5587 20.1213,16.1213 19.5587,16.6839 18.7957,17 18,17L17,17 17,18C17,18.7957 16.6839,19.5587 16.1213,20.1213 15.5587,20.6839 14.7957,21 14,21L6,21C5.20435,21 4.44129,20.6839 3.87868,20.1213 3.31607,19.5587 3,18.7956 3,18L3,10C3,9.20435 3.31607,8.44129 3.87868,7.87868 4.44129,7.31607 5.20435,7 6,7L7,7 7,6C7,5.20435,7.31607,4.44129,7.87868,3.87868z M9,14C9,13.4477 8.55228,13 8,13 7.44772,13 7,13.4477 7,14L7,16C7,16.5523,7.44772,17,8,17L10,17C10.5523,17 11,16.5523 11,16 11,15.4477 10.5523,15 10,15L9,15 9,14z M13,8C13,7.44772,13.4477,7,14,7L16,7C16.5523,7,17,7.44772,17,8L17,10C17,10.5523 16.5523,11 16,11 15.4477,11 15,10.5523 15,10L15,9 14,9C13.4477,9,13,8.55228,13,8z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Text="反选" VerticalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Button>
</Grid>
<modern:SimpleStackPanel Spacing="-4" Orientation="Vertical" Margin="11,4,0,0">
<CheckBox Content="将墨迹缩放应用于触笔笔尖" IsChecked="True"></CheckBox>
<CheckBox Content="仅命中全部包含的墨迹" IsChecked="True"></CheckBox>
<CheckBox Content="允许点选命中被锁定的墨迹" IsChecked="True"></CheckBox>
</modern:SimpleStackPanel>
</modern:SimpleStackPanel>
</Grid>
</Border>
</Grid>
</Grid>
</Border>
</Grid>
</UserControl>

View File

@ -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<RoutedEventArgs> SelectionPopupShouldCloseEvent;
public event EventHandler<RoutedEventArgs> SelectAllEvent;
public event EventHandler<RoutedEventArgs> UnSelectEvent;
public event EventHandler<RoutedEventArgs> 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());
}
}
}