Skip to content

Commit e094afa

Browse files
Merge pull request #64 from ParameshwaranSF4845/1007233-UGConstraints
1007233: UG constraint and serilaization
2 parents 9967aaa + bad29db commit e094afa

28 files changed

Lines changed: 940 additions & 82 deletions

Diagram/Server/Pages/Constraints/AddOperation.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
@using Syncfusion.Blazor.Diagram
44

5-
<SfDiagramComponent Height="600px" Constraints="@diagramConstraint" />
5+
<SfDiagramComponent Height="600px" Constraints="@_diagramConstraint" />
66

77
@code
88
{
99
//To adding line routing constraint with default contraints.
10-
private DiagramConstraints diagramConstraint = DiagramConstraints.Default | DiagramConstraints.Bridging;
10+
private DiagramConstraints _diagramConstraint = DiagramConstraints.Default | DiagramConstraints.Bridging;
1111
}

Diagram/Server/Pages/Constraints/AnnotationConstraintsSample.razor

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
@using Syncfusion.Blazor.Diagram
44

55
@* Initialize the diagram with NodeCollection *@
6-
<SfDiagramComponent Height="600px" Nodes="@nodes" />
6+
<SfDiagramComponent Height="600px" Nodes="@_nodes" />
77

88
@code
99
{
10-
private DiagramObjectCollection<Node> nodes;
11-
10+
private DiagramObjectCollection<Node> _nodes;
1211
protected override void OnInitialized()
1312
{
1413
//Initialize the NodeCollection.
15-
nodes = new DiagramObjectCollection<Node>();
14+
_nodes = new DiagramObjectCollection<Node>();
1615
Node node = new Node()
1716
{
1817
ID = "node1",
@@ -40,6 +39,6 @@
4039
},
4140
}
4241
};
43-
nodes.Add(node);
42+
_nodes.Add(node);
4443
}
4544
}

Diagram/Server/Pages/Constraints/BoundaryConstraintsSample.razor

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
@using Syncfusion.Blazor.Diagram
44

5-
<SfDiagramComponent Height="600px" Nodes="@nodes">
5+
<SfDiagramComponent Height="600px" Nodes="@_nodes">
66
@* Initialize the pagesettings with boundary constraints *@
77
<PageSettings Width="600" Height="500" BoundaryConstraints="BoundaryConstraints.Page" />
88
</SfDiagramComponent>
99

1010
@code
1111
{
12-
private DiagramObjectCollection<Node> nodes;
12+
private DiagramObjectCollection<Node> _nodes;
1313

1414
protected override void OnInitialized()
1515
{
1616
//Initialize the NodeCollection.
17-
nodes = new DiagramObjectCollection<Node>();
17+
_nodes = new DiagramObjectCollection<Node>();
1818
Node node = new Node()
1919
{
2020
ID = "node1",
@@ -23,6 +23,6 @@
2323
OffsetX = 100,
2424
OffsetY = 100,
2525
};
26-
nodes.Add(node);
26+
_nodes.Add(node);
2727
}
2828
}

Diagram/Server/Pages/Constraints/ConnectorConstraintsSample.razor

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
@using Syncfusion.Blazor.Diagram
44

55
@* Initialize the diagram with connectors *@
6-
<SfDiagramComponent Height="600px" Connectors="@connectors" />
6+
<SfDiagramComponent Height="600px" Connectors="@_connectors" />
77

88
@code
99
{
10-
private DiagramObjectCollection<Connector> connectors;
11-
10+
private DiagramObjectCollection<Connector> _connectors;
1211
protected override void OnInitialized()
1312
{
1413
//Initialize the connector collection
15-
connectors = new DiagramObjectCollection<Connector>();
14+
_connectors = new DiagramObjectCollection<Connector>();
1615
Connector connector = new Connector()
1716
{
1817
ID = "connector1",
@@ -22,6 +21,6 @@
2221
//sets the ConnectorConstraints...
2322
Constraints = ConnectorConstraints.Default & ~ConnectorConstraints.Select
2423
};
25-
connectors.Add(connector);
24+
_connectors.Add(connector);
2625
}
2726
}

Diagram/Server/Pages/Constraints/InheritBehaviors.razor

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
@using Syncfusion.Blazor.Diagram
44

55
@* Initialize the diagram with constraints *@
6-
<SfDiagramComponent Height="600px" Connectors="@connectors" Constraints="@diagramConstraints" />
6+
<SfDiagramComponent Height="600px" Connectors="@_connectors" Constraints="@_diagramConstraints" />
77

88
@code
99
{
1010
//Sets the diagram constraints
11-
private DiagramConstraints diagramConstraints = DiagramConstraints.Default | DiagramConstraints.Bridging;
12-
private DiagramObjectCollection<Connector> connectors;
11+
private DiagramConstraints _diagramConstraints = DiagramConstraints.Default | DiagramConstraints.Bridging;
12+
private DiagramObjectCollection<Connector> _connectors;
1313

1414
protected override void OnInitialized()
1515
{
16-
connectors = new DiagramObjectCollection<Connector>();
16+
_connectors = new DiagramObjectCollection<Connector>();
1717
Connector connector = new Connector()
1818
{
1919
ID = "connector1",
@@ -28,7 +28,7 @@
2828
SourcePoint = new DiagramPoint() { X = 200, Y = 100 },
2929
TargetPoint = new DiagramPoint() { X = 100, Y = 200 },
3030
};
31-
connectors.Add(connector);
32-
connectors.Add(connector1);
31+
_connectors.Add(connector);
32+
_connectors.Add(connector1);
3333
}
3434
}

Diagram/Server/Pages/Constraints/NodeConstraintsSample.razor

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
@using Syncfusion.Blazor.Diagram
44

55
@* Initialize the diagram with NodeCollection *@
6-
<SfDiagramComponent Height="600px" Nodes="@nodes" />
6+
<SfDiagramComponent Height="600px" Nodes="@_nodes" />
77

88
@code
99
{
1010

11-
private DiagramObjectCollection<Node> nodes;
11+
private DiagramObjectCollection<Node> _nodes;
1212

1313
protected override void OnInitialized()
1414
{
1515
//Intialize the node collection
16-
nodes = new DiagramObjectCollection<Node>();
16+
_nodes = new DiagramObjectCollection<Node>();
1717
Node node = new Node()
1818
{
1919
ID = "node1",
@@ -25,6 +25,6 @@
2525
//Sets the NodeConstraints constraints.
2626
Constraints = NodeConstraints.Default & ~NodeConstraints.Rotate
2727
};
28-
nodes.Add(node);
28+
_nodes.Add(node);
2929
}
3030
}

Diagram/Server/Pages/Constraints/PortConstraintsSample.razor

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
@using Syncfusion.Blazor.Diagram
44

55
@* Initialize the diagram with NodeCollection *@
6-
<SfDiagramComponent Height="600px" Nodes="@nodes" />
6+
<SfDiagramComponent Height="600px" Nodes="@_nodes" />
77

88
@code
99
{
10-
private DiagramObjectCollection<Node> nodes;
10+
private DiagramObjectCollection<Node> _nodes;
1111

1212
protected override void OnInitialized()
1313
{
1414
// Initialize the NodeCollection.
15-
nodes = new DiagramObjectCollection<Node>();
15+
_nodes = new DiagramObjectCollection<Node>();
1616
Node node = new Node()
1717
{
1818
ID = "node1",
@@ -33,6 +33,6 @@
3333
Constraints=PortConstraints.None
3434
}
3535
};
36-
nodes.Add(node);
36+
_nodes.Add(node);
3737
}
3838
}

Diagram/Server/Pages/Constraints/RemoveOperation.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
@using Syncfusion.Blazor.Diagram
44

5-
<SfDiagramComponent Height="600px" Constraints="@diagramConstraint" />
5+
<SfDiagramComponent Height="600px" Constraints="@_diagramConstraint" />
66

77
@code
88
{
99
//To removing zoom and panning constraints from the default contraints
1010
//It has disabled zoom and panning funcationality for the diagram.
11-
private DiagramConstraints diagramConstraint = DiagramConstraints.Default & ~(DiagramConstraints.Zoom | DiagramConstraints.Pan);
11+
private DiagramConstraints _diagramConstraint = DiagramConstraints.Default & ~(DiagramConstraints.Zoom | DiagramConstraints.Pan);
1212
}

Diagram/Server/Pages/Constraints/SelectorConstraintsSample.razor

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
@using Syncfusion.Blazor.Diagram
44

5-
<SfDiagramComponent Height="600px" Nodes="@nodes" SelectionSettings="@selectedItems" />
5+
<SfDiagramComponent Height="600px" Nodes="@_nodes" SelectionSettings="@_selectedItems" />
66

77
@code
88
{
9-
private DiagramObjectCollection<Node> nodes;
9+
private DiagramObjectCollection<Node> _nodes;
1010

11-
private DiagramSelectionSettings selectedItems = new DiagramSelectionSettings()
11+
private DiagramSelectionSettings _selectedItems = new DiagramSelectionSettings()
1212
{
1313
Constraints = SelectorConstraints.All & ~SelectorConstraints.Rotate
1414
};
1515

1616
protected override void OnInitialized()
1717
{
1818
//Initialize the NodeCollection.
19-
nodes = new DiagramObjectCollection<Node>();
19+
_nodes = new DiagramObjectCollection<Node>();
2020
Node node = new Node()
2121
{
2222
ID = "node1",
@@ -26,6 +26,6 @@
2626
OffsetX = 100,
2727
OffsetY = 100,
2828
};
29-
nodes.Add(node);
29+
_nodes.Add(node);
3030
}
3131
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
@page "/selectordisable"
2+
@using Syncfusion.Blazor.Diagram
3+
@using Syncfusion.Blazor.Popups
4+
<p>Selector Constraints</p>
5+
<input type="checkbox" value="Tooltip" @onchange="@constraintschange" />Tooltip
6+
<SfDiagramComponent Width="1000px" Height="500px" Nodes="@_nodes" SelectionSettings="@_selection" />
7+
@code
8+
{
9+
private DiagramObjectCollection<Node> _nodes;
10+
private bool _selector = true;
11+
private DiagramSelectionSettings _selection = new DiagramSelectionSettings()
12+
{
13+
Constraints = SelectorConstraints.All
14+
};
15+
protected override void OnInitialized()
16+
{
17+
_nodes = new DiagramObjectCollection<Node>();
18+
Node node = new Node()
19+
{
20+
ID = "node1",
21+
OffsetX = 250,
22+
OffsetY = 250,
23+
Width = 100,
24+
Height = 100,
25+
Style = new ShapeStyle()
26+
{
27+
Fill = "#6495ED",
28+
StrokeColor = "white"
29+
},
30+
Tooltip = new DiagramTooltip() { Content = "NodeTooltip" },
31+
Constraints = NodeConstraints.Default | NodeConstraints.Tooltip,
32+
};
33+
_nodes.Add(node);
34+
}
35+
private void constraintschange(Microsoft.AspNetCore.Components.ChangeEventArgs e)
36+
{
37+
bool isChecked = e.Value is bool b && b;
38+
39+
if (isChecked)
40+
{
41+
_selection.Constraints |= SelectorConstraints.Tooltip;
42+
_selector = true;
43+
}
44+
else
45+
{
46+
_selection.Constraints &= ~SelectorConstraints.Tooltip;
47+
_selector = false;
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)