mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
EnableSnapping完成
This commit is contained in:
@@ -13,7 +13,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
public FullyCreatedConnectorInfo(DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint = false, ValueTypePoint valueTypePoint = 0)
|
||||
: base(orientation)
|
||||
{
|
||||
this.DataItem = dataItem;
|
||||
this.Parent = dataItem;
|
||||
this.IsInnerPoint = isInnerPoint;
|
||||
this.ValueTypePoint = valueTypePoint;
|
||||
if (IsInnerPoint == true)
|
||||
@@ -24,7 +24,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
public FullyCreatedConnectorInfo(IDiagramViewModel root, DesignerItemViewModelBase dataItem, SelectableItemBase designer) : base(root, designer)
|
||||
{
|
||||
this.DataItem = dataItem;
|
||||
this.Parent = dataItem;
|
||||
if (IsInnerPoint == true)
|
||||
{
|
||||
BuildMenuOptions();
|
||||
@@ -33,7 +33,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
public FullyCreatedConnectorInfo(IDiagramViewModel root, DesignerItemViewModelBase dataItem, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
|
||||
{
|
||||
this.DataItem = dataItem;
|
||||
this.Parent = dataItem;
|
||||
if (IsInnerPoint == true)
|
||||
{
|
||||
BuildMenuOptions();
|
||||
@@ -88,7 +88,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
public DesignerItemViewModelBase DataItem
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return Parent as DesignerItemViewModelBase;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _showConnectors = false;
|
||||
@@ -257,6 +260,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool CanAttachTo(FullyCreatedConnectorInfo port) => port != this && !port.IsReadOnly && DataItem != port.DataItem;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -366,6 +366,31 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
private bool _enableSnapping;
|
||||
public bool EnableSnapping
|
||||
{
|
||||
get
|
||||
{
|
||||
return _enableSnapping;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _enableSnapping, value);
|
||||
}
|
||||
}
|
||||
|
||||
private double _snappingRadius = 50;
|
||||
public double SnappingRadius
|
||||
{
|
||||
get
|
||||
{
|
||||
return _snappingRadius;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _snappingRadius, value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isEditName;
|
||||
[Browsable(false)]
|
||||
@@ -1089,7 +1114,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ExecuteBringForwardCommand(object parameter)
|
||||
{
|
||||
@@ -1391,7 +1416,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
SelectedItems.OfType<DesignerItemViewModelBase>().ToList();
|
||||
|
||||
List<ConnectionViewModel> selectedConnections =
|
||||
SelectedItems.OfType<ConnectionViewModel>().ToList();
|
||||
SelectedItems.OfType<ConnectionViewModel>().ToList();
|
||||
|
||||
foreach (ConnectionViewModel connection in Items.OfType<ConnectionViewModel>())
|
||||
{
|
||||
@@ -1444,7 +1469,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
foreach (var diagramItemData in copyitem.DesignerItems)
|
||||
{
|
||||
DesignerItemViewModelBase newItem = null;
|
||||
|
||||
|
||||
Type type = TypeHelper.GetType(diagramItemData.ModelTypeName);
|
||||
|
||||
DesignerItemViewModelBase itemBase = Activator.CreateInstance(type, this, diagramItemData, ".json") as DesignerItemViewModelBase;
|
||||
@@ -1460,7 +1485,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
items.Add(newItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DirectAddItemCommand.Execute(items);
|
||||
OffsetX += 10;
|
||||
@@ -1751,7 +1776,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user