12
12
</SfCheckBox >
13
13
</div >
14
14
<div id =" palette-space" class =" sb-mobile-palette" style =" border : 2px solid #b200ff " >
15
- <SfSymbolPaletteComponent @ref =" symbolPalette" Height =" 1000px" Width =" 300px" GetSymbolInfo =" GetSymbolInfo"
16
- Palettes =" Palettes" SymbolHeight =" 60" SymbolWidth =" 60"
17
- SymbolMargin =" symbolMargin" >
15
+ <SfSymbolPaletteComponent @ref =" symbolPalette" Height =" 1000px" Width =" 300px" GetSymbolInfo =" GetSymbolInfo" Palettes =" Palettes" SymbolHeight =" 60"
16
+ SymbolWidth =" 60" SymbolMargin =" symbolMargin" >
18
17
</SfSymbolPaletteComponent >
19
18
</div >
20
19
</div >
24
23
</div >
25
24
26
25
@code {
27
- // Controls tooltip visibility for symbols at runtime
26
+ // Controls tooltip visibility for symbols at runtime.
28
27
private bool ShowTooltip = false ;
29
28
private SfSymbolPaletteComponent ? symbolPalette ;
30
29
private SfDiagramComponent ? diagram ;
31
- private SymbolMargin symbolMargin = new SymbolMargin
30
+ private SymbolMargin symbolMargin = new SymbolMargin ()
32
31
{
33
32
Left = 15 ,
34
33
Right = 15 ,
43
42
44
43
protected override void OnInitialized ()
45
44
{
46
- // Initialize all palette models with predefined shapes
45
+ // Initialize all palette models with predefined shapes.
47
46
InitPaletteModel ();
48
47
}
49
48
50
49
protected override async Task OnAfterRenderAsync (bool firstRender )
51
50
{
52
51
if (firstRender && symbolPalette != null && diagram != null )
53
52
{
54
- // Set diagram as drag-drop target for symbol palette
53
+ // Set diagram as drag-drop target for symbol palette.
55
54
symbolPalette .Targets = new DiagramObjectCollection <SfDiagramComponent > { diagram };
56
55
}
57
56
}
58
57
59
- // Configures symbol tooltip display based on checkbox state
58
+ // Configures symbol tooltip display based on checkbox state.
60
59
private SymbolInfo GetSymbolInfo (IDiagramObject symbol )
61
60
{
62
- // Enable/disable tooltip display based on user preference at runtime
61
+ // Enable/disable tooltip display based on user preference at runtime.
63
62
return new SymbolInfo { ShowTooltip = ShowTooltip };
64
63
}
65
64
66
65
private void InitPaletteModel ()
67
66
{
68
- // Add flow shapes to palette
67
+ // Add flow shapes to palette.
69
68
AddFlowShape (NodeFlowShapes .Terminator , " Terminator" , 0 );
70
69
AddFlowShape (NodeFlowShapes .Decision , " Decision" , 1 );
71
70
AddFlowShape (NodeFlowShapes .Process , " Process" , 2 );
72
71
AddFlowShape (NodeFlowShapes .Document , " Document" , 3 );
73
72
74
- // Add basic shapes to palette
73
+ // Add basic shapes to palette.
75
74
AddBasicShape (NodeBasicShapes .Rectangle , " Rectangle" , 0 );
76
75
AddBasicShape (NodeBasicShapes .Ellipse , " Ellipse" , 1 );
77
76
AddBasicShape (NodeBasicShapes .Pentagon , " Pentagon" , 2 );
78
77
AddBasicShape (NodeBasicShapes .Hexagon , " Hexagon" , 3 );
79
78
80
- // Add connectors to palette
79
+ // Add connectors to palette.
81
80
AddConnector (" Orthogonal" , ConnectorSegmentType .Orthogonal , DecoratorShape .Arrow , 0 );
82
81
AddConnector (" Straight" , ConnectorSegmentType .Straight , DecoratorShape .Arrow , 1 );
83
82
AddConnector (" Bezier" , ConnectorSegmentType .Bezier , DecoratorShape .Arrow , 2 );
84
83
AddConnector (" StraightOpp" , ConnectorSegmentType .Straight , DecoratorShape .None , 3 );
85
84
86
- // Create palette collection with all shape categories
85
+ // Create palette collection with all shape categories.
87
86
Palettes = new DiagramObjectCollection <Palette >
88
87
{
89
88
new Palette { Symbols = FlowShapesPalette , Title = " Flow Shapes" , ID = " FlowShapes" , IsExpanded = true },
103
102
Style = new ShapeStyle { Fill = " #6495ED" , StrokeColor = " #6495ED" },
104
103
Constraints = NodeConstraints .Default | NodeConstraints .Tooltip
105
104
};
106
-
107
- // Add tooltip for even-indexed shapes only
105
+ // Add tooltip for even-indexed shapes only.
108
106
if (index % 2 == 0 )
109
107
{
110
108
node .Tooltip = new DiagramTooltip
113
111
ShowTipPointer = true ,
114
112
Position = Position .RightCenter
115
113
};
116
- }
117
-
114
+ }
118
115
FlowShapesPalette .Add (node );
119
116
}
120
117
134
131
Style = new ShapeStyle { Fill = " #9CCC65" , StrokeColor = " #558B2F" },
135
132
Constraints = NodeConstraints .Default | NodeConstraints .Tooltip
136
133
};
137
-
138
- // Add tooltip for even-indexed shapes only
134
+ // Add tooltip for even-indexed shapes only.
139
135
if (index % 2 == 0 )
140
136
{
141
137
node .Tooltip = new DiagramTooltip
145
141
Position = Position .RightCenter
146
142
};
147
143
}
148
-
149
144
BasicShapesPalette .Add (node );
150
145
}
151
146
165
160
},
166
161
Constraints = ConnectorConstraints .Default | ConnectorConstraints .Tooltip
167
162
};
168
-
169
- // Add tooltip for even-indexed connectors only
163
+ // Add tooltip for even-indexed connectors only.
170
164
if (index % 2 == 0 )
171
165
{
172
166
connector .Tooltip = new DiagramTooltip
176
170
ShowTipPointer = true
177
171
};
178
172
}
179
-
180
173
ConnectorsPalette .Add (connector );
181
174
}
182
175
}
0 commit comments