Skip to content

Commit 9cf054e

Browse files
1007098: Code standard validation for code example
1 parent e6abdc1 commit 9cf054e

5 files changed

Lines changed: 161 additions & 1 deletion

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
@page "/BezierSegmentEditOrientationSample"
2+
3+
@using Syncfusion.Blazor.Diagram
4+
5+
<SfDiagramComponent Width="1000px" Height="500px" Nodes="@_nodes" Connectors="@_connectors"></SfDiagramComponent>
6+
7+
@code {
8+
//Define the diagram's connector collection.
9+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
10+
//Define the diagram's node collection.
11+
private DiagramObjectCollection<Node> _nodes = new DiagramObjectCollection<Node>();
12+
13+
protected override void OnInitialized()
14+
{
15+
_nodes.Add(
16+
new Node()
17+
{
18+
ID = "node1",
19+
OffsetX = 300,
20+
OffsetY = 100,
21+
Width = 100,
22+
Height = 100,
23+
Ports = new DiagramObjectCollection<PointPort>()
24+
{
25+
new PointPort()
26+
{
27+
ID="Port1",
28+
Visibility = PortVisibility.Visible,
29+
Offset = new DiagramPoint() { X = 1, Y = 0.5 },
30+
},
31+
}
32+
});
33+
_nodes.Add(new Node()
34+
{
35+
ID = "node2",
36+
OffsetX = 300,
37+
OffsetY = 350,
38+
Width = 100,
39+
Height = 100,
40+
Ports = new DiagramObjectCollection<PointPort>()
41+
{
42+
new PointPort()
43+
{
44+
ID="Port1",
45+
Visibility = PortVisibility.Visible,
46+
Offset = new DiagramPoint() { X = 0, Y = 0.5 },
47+
},
48+
}
49+
});
50+
Connector connector1 = new Connector()
51+
{
52+
ID = "connector1",
53+
SourceID = "node1",
54+
TargetID = "node2",
55+
SourcePortID = "Port1",
56+
TargetPortID = "Port1",
57+
Type = ConnectorSegmentType.Bezier,
58+
BezierConnectorSettings = new BezierConnectorSettings()
59+
{
60+
//Define the smoothness for a bezier connector.
61+
Smoothness = BezierSmoothness.SymmetricAngle,
62+
//Define the orientation of the segment editing controls.
63+
SegmentEditOrientation = BezierSegmentEditOrientation.FreeForm
64+
},
65+
Constraints = ConnectorConstraints.Default | ConnectorConstraints.DragSegmentThumb
66+
};
67+
_connectors.Add(connector1);
68+
}
69+
}

Diagram/Server/Pages/Connectors/Segments/BezierSegment.razor renamed to Diagram/Server/Pages/Connectors/Segments/BezierSegmentSample.razor

File renamed without changes.

Diagram/Server/Pages/Connectors/Segments/BezierSegmentShape1.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@using Syncfusion.Blazor.Diagram.Internal
55

66
<SfDiagramComponent Width="1000px" Height="500px" Connectors="@_connectors"></SfDiagramComponent>
7-
@code
7+
@code
88
{
99
//Define the diagram's connector collection.
1010
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
@page "/BezierSegmentThumb"
2+
3+
@using Syncfusion.Blazor.Diagram
4+
5+
<SfDiagramComponent Width="1000px" Height="500px" Nodes="@_nodes" Connectors="@_connectors"></SfDiagramComponent>
6+
7+
@code {
8+
//Define the diagram's connector collection.
9+
DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
10+
//Define the diagram's node collection.
11+
DiagramObjectCollection<Node> _nodes = new DiagramObjectCollection<Node>();
12+
13+
protected override void OnInitialized()
14+
{
15+
_nodes.Add(
16+
new Node()
17+
{
18+
ID = "node1",
19+
OffsetX = 300,
20+
OffsetY = 100,
21+
Width = 100,
22+
Height = 100,
23+
Ports = new DiagramObjectCollection<PointPort>()
24+
{
25+
new PointPort()
26+
{
27+
ID="Port1",
28+
Visibility = PortVisibility.Visible,
29+
Offset = new DiagramPoint() { X = 1, Y = 0.5 },
30+
},
31+
}
32+
});
33+
_nodes.Add(new Node()
34+
{
35+
ID = "node2",
36+
OffsetX = 300,
37+
OffsetY = 350,
38+
Width = 100,
39+
Height = 100,
40+
Ports = new DiagramObjectCollection<PointPort>()
41+
{
42+
new PointPort()
43+
{
44+
ID="Port1",
45+
Visibility = PortVisibility.Visible,
46+
Offset = new DiagramPoint() { X = 0, Y = 0.5 },
47+
},
48+
}
49+
});
50+
Connector connector1 = new Connector()
51+
{
52+
ID = "connector1",
53+
SourceID = "node1",
54+
TargetID = "node2",
55+
SourcePortID = "Port1",
56+
TargetPortID = "Port1",
57+
Type = ConnectorSegmentType.Bezier,
58+
Constraints = ConnectorConstraints.Default | ConnectorConstraints.DragSegmentThumb
59+
};
60+
_connectors.Add(connector1);
61+
}
62+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@page "/ControlPointsVisibilitySample"
2+
3+
@using Syncfusion.Blazor.Diagram
4+
<SfDiagramComponent Width="1000px" Height="500px" Connectors="@_connectors"></SfDiagramComponent>
5+
@code {
6+
//Define the diagram's connector collection.
7+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
8+
protected override void OnInitialized()
9+
{
10+
Connector connector1 = new Connector()
11+
{
12+
ID = "connector1",
13+
SourcePoint = new DiagramPoint() { X = 700, Y = 200 },
14+
TargetPoint = new DiagramPoint() { X = 1000, Y = 400 },
15+
Segments = new DiagramObjectCollection<ConnectorSegment>()
16+
{
17+
new BezierSegment(){Type = ConnectorSegmentType.Bezier, Point = new DiagramPoint(){X = 750, Y = 250}},
18+
new BezierSegment(){Type = ConnectorSegmentType.Bezier, Point = new DiagramPoint(){X = 900, Y = 350}}
19+
},
20+
Type = ConnectorSegmentType.Bezier,
21+
BezierConnectorSettings = new BezierConnectorSettings()
22+
{
23+
//Define the visibility of the control points.
24+
ControlPointsVisibility = ControlPointsVisibility.Intermediate
25+
},
26+
};
27+
_connectors.Add(connector1);
28+
}
29+
}

0 commit comments

Comments
 (0)