marker.还有一点bug

This commit is contained in:
艾竹
2023-01-26 18:42:58 +08:00
parent 9bb6c6d321
commit b5867c148e
2 changed files with 30 additions and 8 deletions

View File

@@ -54,6 +54,30 @@ namespace AIStudio.Wpf.DiagramDesigner.Demo.ViewModels
connector1.AddLabel("Square");
DiagramViewModel.DirectAddItemCommand.Execute(connector1);
node1 = new DefaultDesignerItemViewModel() { Left = 50, Top = 380, Text = "1" };
DiagramViewModel.DirectAddItemCommand.Execute(node1);
node2 = new DefaultDesignerItemViewModel() { Left = 400, Top = 380, Text = "2" };
DiagramViewModel.DirectAddItemCommand.Execute(node2);
connector1 = new ConnectionViewModel(node1.RightConnector, node2.LeftConnector);
connector1.ShapeViewModel.SourceMarker = LinkMarker.NewRectangle(10, 20);
connector1.ShapeViewModel.SinkMarker = LinkMarker.NewArrow(20, 10);
connector1.AddLabel("Factory");
DiagramViewModel.DirectAddItemCommand.Execute(connector1);
node1 = new DefaultDesignerItemViewModel() { Left = 50, Top = 490, Text = "1" };
DiagramViewModel.DirectAddItemCommand.Execute(node1);
node2 = new DefaultDesignerItemViewModel() { Left = 400, Top = 490, Text = "2" };
DiagramViewModel.DirectAddItemCommand.Execute(node2);
connector1 = new ConnectionViewModel(node1.RightConnector, node2.LeftConnector);
connector1.ShapeViewModel.SourceMarker = new LinkMarker("M 0 -8 L 3 -8 3 8 0 8 z M 4 -8 7 -8 7 8 4 8 z M 8 -8 16 0 8 8 z", 16, ArrowPathStyle.Arrow, ArrowSizeStyle.ExtraLarge);
connector1.ShapeViewModel.SinkMarker = new LinkMarker("M 0 -8 L 8 -8 4 0 8 8 0 8 4 0 z", 8, ArrowPathStyle.Arrow, ArrowSizeStyle.Small);
connector1.AddLabel("Custom");
DiagramViewModel.DirectAddItemCommand.Execute(connector1);
}
}
}

View File

@@ -21,11 +21,11 @@
</Style.Triggers>
</Style>
<Style x:Key="ArrowStyle" TargetType="Path">
<Setter Property="Stroke" Value="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"/>
<!--<Setter Property="Stroke" Value="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"/>-->
<Setter Property="Fill" Value="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"/>
<Style.Triggers>
<DataTrigger Value="True" Binding="{Binding IsSelected}">
<Setter Property="Stroke" Value="Black"/>
<!--<Setter Property="Stroke" Value="Black"/>-->
<Setter Property="Fill" Value="Black"/>
</DataTrigger>
</Style.Triggers>
@@ -46,9 +46,8 @@
<Path x:Name="rightarrow"
Data="{Binding ShapeViewModel.SinkMarker.Path}"
Visibility="{Binding Path=IsFullConnection, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"
Height="{Binding GetSinkMarkerWidth()}"
Width="{Binding GetSinkMarkerWidth()}"
Stretch="Fill"
Width="{Binding ShapeViewModel.SinkMarker.Width}"
Stretch="UniformToFill"
HorizontalAlignment="Left"
VerticalAlignment="Top"
RenderTransformOrigin="0.5,0.5"
@@ -63,12 +62,11 @@
<Path x:Name="leftarrow"
Data="{Binding ShapeViewModel.SourceMarker.Path}"
Visibility="{Binding Path=IsFullConnection, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"
Height="{Binding ShapeViewModel.SourceMarker.Width}"
Visibility="{Binding Path=IsFullConnection, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"
Width="{Binding ShapeViewModel.SourceMarker.Width}"
Canvas.Left="{Binding StartPoint.X}"
Canvas.Top="{Binding StartPoint.Y}"
Stretch="Fill"
Stretch="UniformToFill"
HorizontalAlignment="Left"
VerticalAlignment="Top"
RenderTransformOrigin="0.5,0.5"