mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-05 16:56:34 +08:00
修改暂存一下
This commit is contained in:
@@ -25,17 +25,31 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
private Point? rubberbandSelectionStartPoint = null;
|
||||
|
||||
private DrawMode VectorLineDrawMode
|
||||
private DrawMode DrawMode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_viewModel.DrawModeViewModel?.VectorLineDrawMode != null)
|
||||
if (_viewModel.DrawModeViewModel?.LineDrawMode != null)
|
||||
{
|
||||
return _viewModel.DrawModeViewModel.VectorLineDrawMode;
|
||||
return _viewModel.DrawModeViewModel.LineDrawMode;
|
||||
}
|
||||
else
|
||||
{
|
||||
return _service.DrawModeViewModel.VectorLineDrawMode;
|
||||
return _service.DrawModeViewModel.LineDrawMode;
|
||||
}
|
||||
}
|
||||
}
|
||||
private RouterMode RouterMode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_viewModel.DrawModeViewModel?.LineRouterMode != null)
|
||||
{
|
||||
return _viewModel.DrawModeViewModel.LineRouterMode;
|
||||
}
|
||||
else
|
||||
{
|
||||
return _service.DrawModeViewModel.LineRouterMode;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,7 +217,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
Rect rectangleBounds = sourceConnector.TransformToVisual(this).TransformBounds(new Rect(sourceConnector.RenderSize));
|
||||
Point point = new Point(rectangleBounds.Left + (rectangleBounds.Width / 2),
|
||||
rectangleBounds.Bottom + (rectangleBounds.Height / 2));
|
||||
partialConnection = new ConnectorViewModel(_viewModel, sourceDataItem, new PartCreatedConnectionInfo(point.X, point.Y), VectorLineDrawMode);
|
||||
partialConnection = new ConnectorViewModel(_viewModel, sourceDataItem, new PartCreatedConnectionInfo(point.X, point.Y), DrawMode, RouterMode);
|
||||
|
||||
_viewModel.DirectAddItemCommand.Execute(partialConnection);
|
||||
}
|
||||
@@ -225,7 +239,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
Rect rectangleBounds = new Rect(sourceConnectorInfo.DataItem.Left, sourceConnectorInfo.DataItem.Top, 3, 3);
|
||||
Point point = new Point(rectangleBounds.Left + (rectangleBounds.Width / 2),
|
||||
rectangleBounds.Bottom + (rectangleBounds.Height / 2));
|
||||
partialConnection = new ConnectorViewModel(_viewModel, sourceConnectorInfo, new PartCreatedConnectionInfo(point.X, point.Y), VectorLineDrawMode);
|
||||
partialConnection = new ConnectorViewModel(_viewModel, sourceConnectorInfo, new PartCreatedConnectionInfo(point.X, point.Y), DrawMode, RouterMode);
|
||||
_viewModel.DirectAddItemCommand.Execute(partialConnection);
|
||||
}
|
||||
}
|
||||
@@ -270,7 +284,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
e.Handled = true;
|
||||
|
||||
if (_service.DrawModeViewModel.GetDrawMode() == DrawMode.ConnectingLine)
|
||||
if (_service.DrawModeViewModel.GetDrawMode() == DrawMode.SmoothConnectingLine)
|
||||
{
|
||||
if (connectorsHit.Count == 0)
|
||||
{
|
||||
@@ -362,9 +376,9 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
int indexOfLastTempConnection = sinkDataItem.DataItem.Parent.Items.Count - 1;
|
||||
sinkDataItem.DataItem.Parent.DirectRemoveItemCommand.Execute(
|
||||
sinkDataItem.DataItem.Parent.Items[indexOfLastTempConnection]);
|
||||
sinkDataItem.DataItem.Parent.AddItemCommand.Execute(new ConnectorViewModel(_viewModel, sourceDataItem, sinkDataItem, VectorLineDrawMode));
|
||||
sinkDataItem.DataItem.Parent.AddItemCommand.Execute(new ConnectorViewModel(_viewModel, sourceDataItem, sinkDataItem, DrawMode, RouterMode));
|
||||
}
|
||||
else if (_service.DrawModeViewModel.GetDrawMode() == DrawMode.ConnectingLine && connectorsHit.Count() == 1)
|
||||
else if (_service.DrawModeViewModel.GetDrawMode() == DrawMode.SmoothConnectingLine && connectorsHit.Count() == 1)
|
||||
{
|
||||
LinkPointDesignerItemViewModel pointItemView = new LinkPointDesignerItemViewModel(e.GetPosition(this));
|
||||
FullyCreatedConnectorInfo sinkDataItem = pointItemView.TopConnector;
|
||||
@@ -373,7 +387,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
_viewModel.DirectRemoveItemCommand.Execute(_viewModel.Items[indexOfLastTempConnection]);
|
||||
_viewModel.DirectAddItemCommand.Execute(pointItemView);
|
||||
|
||||
var connector = new ConnectorViewModel(_viewModel, sourceDataItem, sinkDataItem, VectorLineDrawMode);
|
||||
var connector = new ConnectorViewModel(_viewModel, sourceDataItem, sinkDataItem, DrawMode, RouterMode);
|
||||
_viewModel.AddItemCommand.Execute(connector);
|
||||
|
||||
sourceDataItem.DataItem.ZIndex++;
|
||||
|
||||
Reference in New Issue
Block a user