添加block快,不需要连接线,直接吸附。

This commit is contained in:
艾竹
2023-05-21 22:06:59 +08:00
parent 2fd8321363
commit fde899cfa9
30 changed files with 680 additions and 338 deletions

View File

@@ -109,6 +109,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AIStudio.Wpf.ColorPicker" Version="1.1.2" />
<PackageReference Include="AIStudio.Wpf.ComeCapture" Version="1.1.0" />
<PackageReference Include="Costura.Fody" Version="5.7.0">
<PrivateAssets>all</PrivateAssets>

View File

@@ -727,7 +727,8 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
private void ColorPickerExecuted()
{
AIStudio.Wpf.ColorPicker.MainWindow window = new AIStudio.Wpf.ColorPicker.MainWindow();
window.Show();
}
#region

View File

@@ -580,7 +580,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
public void AddImageExecuted(object para)
{
ImageItemViewModel itemBase = new ImageItemViewModel();
DiagramViewModel?.AddItemCommand.Execute(itemBase);
DiagramViewModel?.AddCommand.Execute(itemBase);
if (itemBase.Root != null)
{
_service.DrawModeViewModel.CursorMode = CursorMode.Move;
@@ -631,7 +631,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
public void AddVideoExectued(object para)
{
VideoItemViewModel itemBase = new VideoItemViewModel();
DiagramViewModel?.AddItemCommand.Execute(itemBase);
DiagramViewModel?.AddCommand.Execute(itemBase);
if (itemBase.Root != null)
{
_service.DrawModeViewModel.CursorMode = CursorMode.Move;
@@ -641,7 +641,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
public void AddOutLineTextExecuted(object para)
{
OutLineTextDesignerItemViewModel itemBase = new OutLineTextDesignerItemViewModel();
DiagramViewModel?.AddItemCommand.Execute(itemBase);
DiagramViewModel?.AddCommand.Execute(itemBase);
if (itemBase.Root != null)
{
_service.DrawModeViewModel.CursorMode = CursorMode.Move;
@@ -651,7 +651,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
public void AddBarcodeExecuted(object para)
{
BarcodeDesignerItemViewModel itemBase = new BarcodeDesignerItemViewModel() { Format = (BarcodeFormat)Enum.Parse(typeof(BarcodeFormat), para.ToString()), Text = "AIStudio.Wpf.DiagramApp" };
DiagramViewModel?.AddItemCommand.Execute(itemBase);
DiagramViewModel?.AddCommand.Execute(itemBase);
if (itemBase.Root != null)
{
_service.DrawModeViewModel.CursorMode = CursorMode.Move;

View File

@@ -80,7 +80,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
}
private ICommand _addItemCommand;
public ICommand AddItemCommand
public ICommand AddCommand
{
get
{
@@ -119,7 +119,9 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
List<ToolBoxData> defaultToolBoxItems = new List<ToolBoxData>();
defaultToolBoxItems.Add(new TextToolBoxData("", typeof(DefaultDesignerItemViewModel)));
var blockitem = new TextToolBoxData("", typeof(BlockDesignerItemViewModel), 64, 32, new Size(130, 65));
blockitem.ColorViewModel.FillColor.Color = Color.FromRgb(0x00, 0x2F, 0xA7);
defaultToolBoxItems.Add(blockitem);
ToolBoxCategory.Add(new ToolBoxCategory() { Header = "Default", ToolBoxItems = new ObservableCollection<ToolBoxData>(defaultToolBoxItems), IsExpanded = true });
ToolBoxCategory.Add(new ToolBoxCategory() { Header = "Svg", ToolBoxItems = new ObservableCollection<ToolBoxData>() });

View File

@@ -2556,6 +2556,16 @@
Width="190" />
</Fluent:Button.ToolTip>
</Fluent:Button>
<Fluent:Button Header="取色器" Width="50" VerticalAlignment="Top" Command="{Binding ColorPickerCommand}">
<Fluent:Button.LargeIcon>
<Path Width="18" Height="18" Stretch="Uniform" Fill="Black" Data="M484.9999999999999 416.5L416.5 485A48.00000000000001 48.00000000000001 0 0 1 350 486.75L300 436.75L267.75 467.75A25 25 0 0 1 232.2500000000001 432.25L263.25 400L125 261.75A50 50 0 0 1 110.75 231.5000000000001L100 127.25A25 25 0 0 1 107.25 107.25A25 25 0 0 1 125 100H127.25L231.5 109.5A50 50 0 0 1 261.75 123.75L401.25 263.25L432.2499999999999 232.25A25 25 0 0 1 467.7499999999998 232.25A25 25 0 0 1 467.7499999999998 267.75L436.7499999999999 298.75L486.7499999999999 348.75A48.00000000000001 48.00000000000001 0 0 1 484.9999999999999 416.5zM160 226.5L300 366L367.25 298.5000000000001L297.5 228.7500000000001"/>
</Fluent:Button.LargeIcon>
<Fluent:Button.ToolTip>
<Fluent:ScreenTip Title="Screen"
Text="取色器"
Width="190" />
</Fluent:Button.ToolTip>
</Fluent:Button>
</Fluent:RibbonGroupBox>
</Fluent:RibbonTabItem>
<Fluent:RibbonTabItem Header="帮助">

View File

@@ -363,7 +363,7 @@
<Button Margin="0,5,2,5" ToolTip="导入到我的符号" Command="{Binding DataContext.ImportItemCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}" Width="16" Height="16" Foreground="{DynamicResource BlackBrush}" Background="{DynamicResource WhiteBrush}" BorderBrush="Transparent">
<Path Stretch="Fill" Margin="2" Fill="{DynamicResource GrayBrush2}" Data="M14,12L10,8V11H2V13H10V16M20,18V6C20,4.89 19.1,4 18,4H6A2,2 0 0,0 4,6V9H6V6H18V18H6V15H4V18A2,2 0 0,0 6,20H18A2,2 0 0,0 20,18Z" ></Path>
</Button>
<Button Margin="0,5,2,5" ToolTip="添加到我的符号" Command="{Binding DataContext.AddItemCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}" Width="16" Height="16" Foreground="{DynamicResource BlackBrush}" Background="{DynamicResource WhiteBrush}" BorderBrush="Transparent">
<Button Margin="0,5,2,5" ToolTip="添加到我的符号" Command="{Binding DataContext.AddCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}" Width="16" Height="16" Foreground="{DynamicResource BlackBrush}" Background="{DynamicResource WhiteBrush}" BorderBrush="Transparent">
<Path Stretch="Fill" Margin="2" Fill="{DynamicResource GrayBrush2}" Data="M938.666667 426.666667h-341.333334V85.333333c0-46.933333-38.4-85.333333-85.333333-85.333333s-85.333333 38.4-85.333333 85.333333v341.333334H85.333333c-46.933333 0-85.333333 38.4-85.333333 85.333333s38.4 85.333333 85.333333 85.333333h341.333334v341.333334c0 46.933333 38.4 85.333333 85.333333 85.333333s85.333333-38.4 85.333333-85.333333v-341.333334h341.333334c46.933333 0 85.333333-38.4 85.333333-85.333333s-38.4-85.333333-85.333333-85.333333z" ></Path>
</Button>
<Button Margin="0,5,5,5" ToolTip="移除" Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}" CommandParameter="{Binding .}" Width="16" Height="16" Foreground="{DynamicResource BlackBrush}" Background="{DynamicResource WhiteBrush}" BorderBrush="Transparent">