-
-
Notifications
You must be signed in to change notification settings - Fork 230
CuttingLine Overview
The CuttingLine
control is a custom control used to remove intersecting connections.
The default gesture to start cutting is SHIFT+ALT+LeftClick
and can be configured by setting the EditorGestures.Editor.Cutting
gesture. The cutting can be canceled by pressing the Escape
key or the right mouse button which can be configured by setting the EditorGestures.Editor.CancelAction
gesture.
Relevant commands available in NodifyEditor
:
- CuttingStartedCommand
- CuttingCompletedCommand
- RemoveConnectionCommand - is called for each intersecting connection when the cutting operation is completed
For the connection style to change when intersecting with the cutting line, it's required to set NodifyEditor.EnableCuttingLinePreview
to true
.
Warning
Depending on the number of connections and the complexity of their geometry, this may have a great performance impact.
To enable cutting custom connections you must add the connection type to NodifyEditor.CuttingConnectionTypes
:
// example adding the Line shape to the connection types that can be cut
NodifyEditor.CuttingConnectionTypes.Add(typeof(System.Windows.Shapes.Line));
The style of the intersecting custom connection can be customized as follows:
<Style TargetType="Line">
<Style.Triggers>
<Trigger Property="nodify:CuttingLine.IsOverElement" Value="True">
<Setter Property="Opacity"
Value="0.4" />
</Trigger>
</Style.Triggers>
</Style>
The CuttingLineStyle
is used to customize the cutting line:
<Style x:Key="CuttingLineStyle"
TargetType="{x:Type nodify:CuttingLine}"
BasedOn="{StaticResource {x:Type nodify:CuttingLine}}">
<Setter Property="StrokeDashArray"
Value="1 1" />
<Setter Property="StrokeThickness"
Value="2" />
</Style>
<nodify:NodifyEditor CuttingLineStyle="{StaticResource CuttingLineStyle}" ... />