Skip to content

Commit 06bad93

Browse files
977114: MaxSegment examples updatde
1 parent c12bbfa commit 06bad93

File tree

2 files changed

+10
-28
lines changed
  • UG-Samples/Connectors/Customization
    • MaxSegmentThumbRuntime/MaxSegmentThumbRuntime/Pages
    • MaxSegmentThumb/MaxSegmentThumb/Pages

2 files changed

+10
-28
lines changed

UG-Samples/Connectors/Customization/MaxSegmentThumb/MaxSegmentThumb/Pages/Index.razor

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,21 @@
1010

1111
protected override void OnInitialized()
1212
{
13-
// Create orthogonal connector with custom segments and styling
13+
// Create orthogonal connector with custom segments and styling.
1414
Connector orthogonalConnector = new Connector()
1515
{
1616
ID = "orthogonal",
1717
SourcePoint = new DiagramPoint() { X = 550, Y = 200 },
1818
TargetPoint = new DiagramPoint() { X = 650, Y = 300 },
1919
Style = new ShapeStyle() { StrokeColor = "#6495ED" },
20-
21-
// Enable dragging segment thumbs
2220
Constraints = ConnectorConstraints.Default | ConnectorConstraints.DragSegmentThumb,
23-
2421
TargetDecorator = new DecoratorSettings()
2522
{
2623
Shape = DecoratorShape.Arrow,
2724
Style = new ShapeStyle() { StrokeColor = "#6495ED", Fill = "#6495ED" }
2825
},
29-
30-
// Orthogonal connector
3126
Type = ConnectorSegmentType.Orthogonal,
32-
33-
// Define orthogonal segments (Type on each segment is redundant and omitted)
27+
// Define orthogonal segments (Type on each segment is redundant and omitted).
3428
Segments = new DiagramObjectCollection<ConnectorSegment>()
3529
{
3630
new OrthogonalSegment
@@ -46,10 +40,7 @@
4640
Direction = Direction.Bottom
4741
}
4842
},
49-
50-
// Limit the number of visible/draggable segment thumbs
5143
MaxSegmentThumbs = 2
52-
5344
};
5445
connectors.Add(orthogonalConnector);
5546
}

UG-Samples/Connectors/Customization/MaxSegmentThumbRuntime/MaxSegmentThumbRuntime/Pages/Index.razor

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
<div class="d-flex flex-column gap-3">
77
<div class="d-flex align-items-center gap-3 p-3 bg-light rounded">
8-
<SfButton Content="Update Selected Connectors (Max 5)" IsPrimary="true" OnClick="UpdateSelectedConnectorThumbs"
9-
CssClass="btn-selected">
8+
<SfButton Content="Update Selected Connectors (Max 5)" IsPrimary="true" OnClick="UpdateSelectedConnectorThumbs" CssClass="btn-selected">
109
</SfButton>
1110
<SfButton Content="Update All Connectors (Max 6)" OnClick="UpdateAllConnectorThumbs"CssClass="btn-all">
1211
</SfButton>
@@ -21,27 +20,21 @@
2120

2221
protected override void OnInitialized()
2322
{
24-
// Create orthogonal connector with custom segments and styling
23+
// Create orthogonal connector with custom segments and styling.
2524
Connector orthogonalConnector = new Connector()
2625
{
2726
ID = "orthogonal",
2827
SourcePoint = new DiagramPoint() { X = 550, Y = 200 },
2928
TargetPoint = new DiagramPoint() { X = 650, Y = 300 },
3029
Style = new ShapeStyle() { StrokeColor = "#6495ED" },
31-
32-
// Enable dragging segment thumbs
3330
Constraints = ConnectorConstraints.Default | ConnectorConstraints.DragSegmentThumb,
34-
3531
TargetDecorator = new DecoratorSettings()
3632
{
3733
Shape = DecoratorShape.Arrow,
3834
Style = new ShapeStyle() { StrokeColor = "#6495ED", Fill = "#6495ED" }
3935
},
40-
41-
// Orthogonal connector
4236
Type = ConnectorSegmentType.Orthogonal,
43-
44-
// Define orthogonal segments (Type on each segment is redundant and omitted)
37+
// Define orthogonal segments (Type on each segment is redundant and omitted).
4538
Segments = new DiagramObjectCollection<ConnectorSegment>()
4639
{
4740
new OrthogonalSegment
@@ -57,35 +50,33 @@
5750
Direction = Direction.Bottom
5851
}
5952
},
60-
61-
// Limit the number of visible/draggable segment thumbs
53+
// Limit the number of visible/draggable segment thumbs.
6254
MaxSegmentThumbs = 2
63-
6455
};
6556
connectors.Add(orthogonalConnector);
6657
}
6758

68-
// Updates MaxSegmentThumbs to 5 for all currently selected connectors at runtime
59+
// Updates MaxSegmentThumbs to 5 for all currently selected connectors at runtime.
6960
private void UpdateSelectedConnectorThumbs()
7061
{
7162
if (diagram?.SelectionSettings?.Connectors != null)
7263
{
7364
for (int i = 0; i < diagram.SelectionSettings.Connectors.Count; i++)
7465
{
75-
// Set segment thumb limit for selected connector only
66+
// Set segment thumb limit for selected connector only.
7667
diagram.SelectionSettings.Connectors[i].MaxSegmentThumbs = 5;
7768
}
7869
}
7970
}
8071

81-
// Updates MaxSegmentThumbs to 6 for all connectors in the diagram at runtime
72+
// Updates MaxSegmentThumbs to 6 for all connectors in the diagram at runtime.
8273
private void UpdateAllConnectorThumbs()
8374
{
8475
if (diagram?.Connectors != null)
8576
{
8677
for (int i = 0; i < diagram.Connectors.Count; i++)
8778
{
88-
// Set segment thumb limit for each connector in diagram
79+
// Set segment thumb limit for each connector in diagram.
8980
diagram.Connectors[i].MaxSegmentThumbs = 6;
9081
}
9182
}

0 commit comments

Comments
 (0)