@babylonjs/shared-ui-components 5.28.0 → 5.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/colorPicker/colorComponentEntry.d.ts +18 -18
- package/colorPicker/colorComponentEntry.js +36 -36
- package/colorPicker/colorPicker.d.ts +43 -43
- package/colorPicker/colorPicker.js +136 -136
- package/colorPicker/hexColor.d.ts +20 -20
- package/colorPicker/hexColor.js +42 -42
- package/components/Button.d.ts +10 -10
- package/components/Button.js +6 -6
- package/components/Icon.d.ts +6 -6
- package/components/Icon.js +6 -6
- package/components/Label.d.ts +7 -7
- package/components/Label.js +6 -6
- package/components/MessageDialog.d.ts +7 -7
- package/components/MessageDialog.js +22 -22
- package/components/Toggle.d.ts +8 -8
- package/components/Toggle.js +15 -15
- package/components/bars/CommandBarComponent.d.ts +16 -16
- package/components/bars/CommandBarComponent.js +68 -68
- package/components/bars/CommandBarComponent.js.map +1 -1
- package/components/bars/CommandButtonComponent.d.ts +11 -11
- package/components/bars/CommandButtonComponent.js +6 -6
- package/components/bars/CommandDropdownComponent.d.ts +26 -26
- package/components/bars/CommandDropdownComponent.js +48 -48
- package/components/classNames.d.ts +2 -2
- package/components/classNames.js +18 -18
- package/components/colorPicker/ColorComponentEntry.d.ts +18 -18
- package/components/colorPicker/ColorComponentEntry.js +37 -37
- package/components/colorPicker/ColorPicker.d.ts +43 -43
- package/components/colorPicker/ColorPicker.js +137 -137
- package/components/colorPicker/HexColor.d.ts +20 -20
- package/components/colorPicker/HexColor.js +45 -45
- package/components/layout/DraggableIcon.d.ts +23 -0
- package/components/layout/DraggableIcon.js +18 -0
- package/components/layout/DraggableIcon.js.map +1 -0
- package/components/layout/FlexibleColumn.d.ts +17 -0
- package/components/layout/FlexibleColumn.js +12 -0
- package/components/layout/FlexibleColumn.js.map +1 -0
- package/components/layout/FlexibleDragHandler.d.ts +18 -0
- package/components/layout/FlexibleDragHandler.js +88 -0
- package/components/layout/FlexibleDragHandler.js.map +1 -0
- package/components/layout/FlexibleDropZone.d.ts +19 -0
- package/components/layout/FlexibleDropZone.js +12 -0
- package/components/layout/FlexibleDropZone.js.map +1 -0
- package/components/layout/FlexibleGridContainer.d.ts +10 -0
- package/components/layout/FlexibleGridContainer.js +23 -0
- package/components/layout/FlexibleGridContainer.js.map +1 -0
- package/components/layout/FlexibleGridLayout.d.ts +16 -0
- package/components/layout/FlexibleGridLayout.js +24 -0
- package/components/layout/FlexibleGridLayout.js.map +1 -0
- package/components/layout/FlexibleResizeBar.d.ts +40 -0
- package/components/layout/FlexibleResizeBar.js +21 -0
- package/components/layout/FlexibleResizeBar.js.map +1 -0
- package/components/layout/FlexibleTab.d.ts +34 -0
- package/components/layout/FlexibleTab.js +36 -0
- package/components/layout/FlexibleTab.js.map +1 -0
- package/components/layout/FlexibleTabsContainer.d.ts +28 -0
- package/components/layout/FlexibleTabsContainer.js +54 -0
- package/components/layout/FlexibleTabsContainer.js.map +1 -0
- package/components/layout/LayoutContext.d.ts +12 -0
- package/components/layout/LayoutContext.js +3 -0
- package/components/layout/LayoutContext.js.map +1 -0
- package/components/layout/types.d.ts +82 -0
- package/components/layout/types.js +13 -0
- package/components/layout/types.js.map +1 -0
- package/components/layout/utils.d.ts +25 -0
- package/components/layout/utils.js +68 -0
- package/components/layout/utils.js.map +1 -0
- package/components/lines/ColorLineComponent.d.ts +40 -40
- package/components/lines/ColorLineComponent.js +145 -145
- package/components/lines/ColorPickerLineComponent.d.ts +33 -33
- package/components/lines/ColorPickerLineComponent.js +61 -61
- package/components/lines/FileButtonLineComponent.d.ts +16 -16
- package/components/lines/FileButtonLineComponent.js +21 -21
- package/components/lines/NumericInputComponent.d.ts +31 -31
- package/components/lines/NumericInputComponent.js +86 -86
- package/lines/booleanLineComponent.d.ts +11 -11
- package/lines/booleanLineComponent.js +14 -14
- package/lines/buttonLineComponent.d.ts +12 -12
- package/lines/buttonLineComponent.js +10 -10
- package/lines/checkBoxLineComponent.d.ts +36 -36
- package/lines/checkBoxLineComponent.js +88 -88
- package/lines/color3LineComponent.d.ts +18 -18
- package/lines/color3LineComponent.js +9 -9
- package/lines/color4LineComponent.d.ts +18 -18
- package/lines/color4LineComponent.js +9 -9
- package/lines/colorLineComponent.d.ts +40 -40
- package/lines/colorLineComponent.js +144 -144
- package/lines/colorPickerComponent.d.ts +31 -31
- package/lines/colorPickerComponent.js +60 -60
- package/lines/draggableLineComponent.d.ts +9 -9
- package/lines/draggableLineComponent.js +12 -12
- package/lines/fileButtonLineComponent.d.ts +17 -17
- package/lines/fileButtonLineComponent.js +20 -20
- package/lines/fileMultipleButtonLineComponent.d.ts +17 -17
- package/lines/fileMultipleButtonLineComponent.js +20 -20
- package/lines/floatLineComponent.d.ts +50 -50
- package/lines/floatLineComponent.js +175 -175
- package/lines/hexLineComponent.d.ts +40 -40
- package/lines/hexLineComponent.js +121 -121
- package/lines/iSelectedLineContainer.d.ts +4 -4
- package/lines/iSelectedLineContainer.js +1 -1
- package/lines/iconButtonLineComponent.d.ts +11 -11
- package/lines/iconButtonLineComponent.js +10 -10
- package/lines/iconComponent.d.ts +9 -9
- package/lines/iconComponent.js +7 -7
- package/lines/indentedTextLineComponent.d.ts +16 -16
- package/lines/indentedTextLineComponent.js +26 -26
- package/lines/inputArrowsComponent.d.ts +13 -13
- package/lines/inputArrowsComponent.js +37 -37
- package/lines/lineContainerComponent.d.ts +19 -19
- package/lines/lineContainerComponent.js +49 -49
- package/lines/linkButtonComponent.d.ts +16 -16
- package/lines/linkButtonComponent.js +20 -20
- package/lines/matrixLineComponent.d.ts +36 -36
- package/lines/matrixLineComponent.js +102 -102
- package/lines/messageLineComponent.d.ts +12 -12
- package/lines/messageLineComponent.js +14 -14
- package/lines/numericInputComponent.d.ts +31 -31
- package/lines/numericInputComponent.js +85 -85
- package/lines/optionsLineComponent.d.ts +48 -48
- package/lines/optionsLineComponent.js +118 -118
- package/lines/popup.d.ts +4 -4
- package/lines/popup.js +67 -67
- package/lines/radioLineComponent.d.ts +21 -21
- package/lines/radioLineComponent.js +26 -26
- package/lines/sliderLineComponent.d.ts +37 -37
- package/lines/sliderLineComponent.js +89 -89
- package/lines/targetsProxy.d.ts +11 -11
- package/lines/targetsProxy.js +42 -42
- package/lines/textInputLineComponent.d.ts +47 -47
- package/lines/textInputLineComponent.js +154 -154
- package/lines/textLineComponent.d.ts +21 -21
- package/lines/textLineComponent.js +30 -30
- package/lines/unitButton.d.ts +8 -8
- package/lines/unitButton.js +7 -7
- package/lines/valueLineComponent.d.ts +15 -15
- package/lines/valueLineComponent.js +12 -12
- package/lines/vector2LineComponent.d.ts +36 -36
- package/lines/vector2LineComponent.js +63 -63
- package/lines/vector3LineComponent.d.ts +41 -41
- package/lines/vector3LineComponent.js +74 -74
- package/lines/vector4LineComponent.d.ts +42 -42
- package/lines/vector4LineComponent.js +81 -81
- package/nodeGraphSystem/displayLedger.d.ts +5 -5
- package/nodeGraphSystem/displayLedger.js +3 -3
- package/nodeGraphSystem/frameNodePort.d.ts +25 -25
- package/nodeGraphSystem/frameNodePort.js +59 -59
- package/nodeGraphSystem/graphCanvas.d.ts +117 -111
- package/nodeGraphSystem/graphCanvas.js +1137 -1131
- package/nodeGraphSystem/graphCanvas.js.map +1 -1
- package/nodeGraphSystem/graphFrame.d.ts +153 -153
- package/nodeGraphSystem/graphFrame.js +1328 -1328
- package/nodeGraphSystem/graphNode.d.ts +81 -79
- package/nodeGraphSystem/graphNode.js +465 -459
- package/nodeGraphSystem/graphNode.js.map +1 -1
- package/nodeGraphSystem/interfaces/displayManager.d.ts +13 -13
- package/nodeGraphSystem/interfaces/displayManager.js +1 -1
- package/nodeGraphSystem/interfaces/nodeContainer.d.ts +6 -6
- package/nodeGraphSystem/interfaces/nodeContainer.js +1 -1
- package/nodeGraphSystem/interfaces/nodeData.d.ts +15 -15
- package/nodeGraphSystem/interfaces/nodeData.js +1 -1
- package/nodeGraphSystem/interfaces/nodeLocationInfo.d.ts +26 -26
- package/nodeGraphSystem/interfaces/nodeLocationInfo.js +1 -1
- package/nodeGraphSystem/interfaces/portData.d.ts +28 -28
- package/nodeGraphSystem/interfaces/portData.js +7 -7
- package/nodeGraphSystem/interfaces/propertyComponentProps.d.ts +6 -6
- package/nodeGraphSystem/interfaces/propertyComponentProps.js +1 -1
- package/nodeGraphSystem/interfaces/selectionChangedOptions.d.ts +11 -11
- package/nodeGraphSystem/interfaces/selectionChangedOptions.js +1 -1
- package/nodeGraphSystem/nodeLink.d.ts +31 -31
- package/nodeGraphSystem/nodeLink.js +182 -182
- package/nodeGraphSystem/nodePort.d.ts +35 -35
- package/nodeGraphSystem/nodePort.js +128 -128
- package/nodeGraphSystem/propertyLedger.d.ts +8 -8
- package/nodeGraphSystem/propertyLedger.js +3 -3
- package/nodeGraphSystem/stateManager.d.ts +45 -45
- package/nodeGraphSystem/stateManager.js +18 -18
- package/nodeGraphSystem/tools.d.ts +5 -5
- package/nodeGraphSystem/tools.js +36 -36
- package/nodeGraphSystem/typeLedger.d.ts +8 -8
- package/nodeGraphSystem/typeLedger.js +2 -2
- package/nodeGraphSystem/types/framePortData.d.ts +7 -7
- package/nodeGraphSystem/types/framePortData.js +1 -1
- package/package.json +4 -3
- package/propertyChangedEvent.d.ts +7 -7
- package/propertyChangedEvent.js +2 -2
- package/stories/Button.stories.d.ts +10 -10
- package/stories/Button.stories.js +19 -19
- package/stories/Icon.stories.d.ts +9 -9
- package/stories/Icon.stories.js +16 -16
- package/stories/Label.stories.d.ts +8 -8
- package/stories/Label.stories.js +10 -10
- package/stories/MessageDialog.stories.d.ts +9 -9
- package/stories/MessageDialog.stories.js +19 -19
- package/stories/Toggle.stories.d.ts +9 -9
- package/stories/Toggle.stories.js +17 -17
- package/stories/bars/CommandBarComponent.stories.d.ts +11 -11
- package/stories/bars/CommandBarComponent.stories.js +12 -12
- package/stories/bars/CommandButtonComponent.stories.d.ts +6 -6
- package/stories/bars/CommandButtonComponent.stories.js +6 -6
- package/stories/colorPicker/ColorPicker.stories.d.ts +11 -11
- package/stories/colorPicker/ColorPicker.stories.js +4 -4
- package/stories/layout/FlexibleGridLayout.stories.d.ts +46 -0
- package/stories/layout/FlexibleGridLayout.stories.js +48 -0
- package/stories/layout/FlexibleGridLayout.stories.js.map +1 -0
- package/stories/lines/ColorLineComponent.stories.d.ts +21 -21
- package/stories/lines/ColorLineComponent.stories.js +9 -9
- package/stories/lines/ColorPickerLineComponent.stories.d.ts +14 -14
- package/stories/lines/ColorPickerLineComponent.stories.js +10 -10
- package/stories/lines/FileButtonLineComponent.stories.d.ts +6 -6
- package/stories/lines/FileButtonLineComponent.stories.js +5 -5
- package/stories/lines/NumericInputComponent.stories.d.ts +11 -11
- package/stories/lines/NumericInputComponent.stories.js +5 -5
- package/stringTools.d.ts +11 -11
- package/stringTools.js +88 -88
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.js +15 -15
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.js +14 -14
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.d.ts +17 -17
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.js +55 -55
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.js +12 -12
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.js +15 -15
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.d.ts +17 -17
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.js +38 -38
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.js +16 -16
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.js +25 -25
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.js +17 -17
- package/tabs/propertyGrids/gui/linePropertyGridComponent.d.ts +16 -16
- package/tabs/propertyGrids/gui/linePropertyGridComponent.js +27 -27
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.js +17 -17
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.js +15 -15
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.js +15 -15
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.js +16 -16
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.js +14 -14
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.js +34 -34
- package/tabs/propertyGrids/lockObject.d.ts +9 -9
- package/tabs/propertyGrids/lockObject.js +11 -11
@@ -1,460 +1,466 @@
|
|
1
|
-
import * as React from "react";
|
2
|
-
import { NodePort } from "./nodePort.js";
|
3
|
-
import { PropertyLedger } from "./propertyLedger.js";
|
4
|
-
import { DisplayLedger } from "./displayLedger.js";
|
5
|
-
import localStyles from "./graphNode.modules.scss";
|
6
|
-
import commonStyles from "./common.modules.scss";
|
7
|
-
export class GraphNode {
|
8
|
-
constructor(content, stateManager) {
|
9
|
-
this.content = content;
|
10
|
-
this._inputPorts = [];
|
11
|
-
this._outputPorts = [];
|
12
|
-
this._links = [];
|
13
|
-
this._x = 0;
|
14
|
-
this._y = 0;
|
15
|
-
this._gridAlignedX = 0;
|
16
|
-
this._gridAlignedY = 0;
|
17
|
-
this._mouseStartPointX = null;
|
18
|
-
this._mouseStartPointY = null;
|
19
|
-
this._displayManager = null;
|
20
|
-
this._isVisible = true;
|
21
|
-
this._enclosingFrameId = -1;
|
22
|
-
this._stateManager = stateManager;
|
23
|
-
this._onSelectionChangedObserver = this._stateManager.onSelectionChangedObservable.add((options) => {
|
24
|
-
const { selection: node } = options || {};
|
25
|
-
if (node === this) {
|
26
|
-
this._visual.classList.add(localStyles["selected"]);
|
27
|
-
}
|
28
|
-
else {
|
29
|
-
setTimeout(() => {
|
30
|
-
if (this._ownerCanvas.selectedNodes.indexOf(this) === -1) {
|
31
|
-
this._visual.classList.remove(localStyles["selected"]);
|
32
|
-
}
|
33
|
-
});
|
34
|
-
}
|
35
|
-
});
|
36
|
-
this._onUpdateRequiredObserver = this._stateManager.onUpdateRequiredObservable.add((data) => {
|
37
|
-
if (data !== this.content.data) {
|
38
|
-
return;
|
39
|
-
}
|
40
|
-
this.refresh();
|
41
|
-
});
|
42
|
-
this._onSelectionBoxMovedObserver = this._stateManager.onSelectionBoxMoved.add((rect1) => {
|
43
|
-
const rect2 = this._visual.getBoundingClientRect();
|
44
|
-
const overlap = !(rect1.right < rect2.left || rect1.left > rect2.right || rect1.bottom < rect2.top || rect1.top > rect2.bottom);
|
45
|
-
this.setIsSelected(overlap, true);
|
46
|
-
});
|
47
|
-
this._onFrameCreatedObserver = this._stateManager.onFrameCreatedObservable.add((frame) => {
|
48
|
-
if (this._ownerCanvas.frames.some((f) => f.nodes.indexOf(this) !== -1)) {
|
49
|
-
return;
|
50
|
-
}
|
51
|
-
if (this.isOverlappingFrame(frame)) {
|
52
|
-
frame.nodes.push(this);
|
53
|
-
}
|
54
|
-
});
|
55
|
-
}
|
56
|
-
|
57
|
-
|
58
|
-
}
|
59
|
-
|
60
|
-
this.
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
for (const
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
}
|
86
|
-
get
|
87
|
-
return this.
|
88
|
-
}
|
89
|
-
get
|
90
|
-
return this.
|
91
|
-
}
|
92
|
-
get
|
93
|
-
return this.
|
94
|
-
}
|
95
|
-
get
|
96
|
-
return this.
|
97
|
-
}
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
this._x
|
103
|
-
|
104
|
-
|
105
|
-
this.
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
this._y
|
116
|
-
|
117
|
-
|
118
|
-
this.
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
}
|
127
|
-
get
|
128
|
-
return this.
|
129
|
-
}
|
130
|
-
get
|
131
|
-
return this.
|
132
|
-
}
|
133
|
-
get
|
134
|
-
return this.
|
135
|
-
}
|
136
|
-
get
|
137
|
-
return this.
|
138
|
-
}
|
139
|
-
|
140
|
-
this.
|
141
|
-
}
|
142
|
-
|
143
|
-
this.
|
144
|
-
}
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
this.
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
this.
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
for (const port of this.
|
181
|
-
const attachedPoint = port.portData;
|
182
|
-
if (attachedPoint === portData || (attachedPoint.ownerData === portData.ownerData && attachedPoint.internalName === portData.internalName)) {
|
183
|
-
return port;
|
184
|
-
}
|
185
|
-
}
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
for (const port of this.
|
196
|
-
const attachedPoint = port.portData;
|
197
|
-
if (attachedPoint.data === data) {
|
198
|
-
return attachedPoint;
|
199
|
-
}
|
200
|
-
}
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
return
|
208
|
-
}
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
}
|
259
|
-
|
260
|
-
|
261
|
-
}
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
}
|
268
|
-
this.
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
this.
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
}
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
this.
|
325
|
-
this.
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
}
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
}
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
this.
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
this.
|
391
|
-
this._visual.
|
392
|
-
this.
|
393
|
-
this.
|
394
|
-
this.
|
395
|
-
this.
|
396
|
-
this.
|
397
|
-
this.
|
398
|
-
this.
|
399
|
-
this.
|
400
|
-
this.
|
401
|
-
this.
|
402
|
-
this.
|
403
|
-
this.
|
404
|
-
this.
|
405
|
-
this.
|
406
|
-
this.
|
407
|
-
this.
|
408
|
-
this.
|
409
|
-
this.
|
410
|
-
this.
|
411
|
-
this.
|
412
|
-
this.
|
413
|
-
this.
|
414
|
-
this.
|
415
|
-
root.
|
416
|
-
|
417
|
-
this.
|
418
|
-
this.
|
419
|
-
this.
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
this.
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
if (this.
|
439
|
-
this._stateManager.
|
440
|
-
}
|
441
|
-
if (this.
|
442
|
-
this.
|
443
|
-
}
|
444
|
-
if (this.
|
445
|
-
this._stateManager.
|
446
|
-
}
|
447
|
-
|
448
|
-
|
449
|
-
}
|
450
|
-
|
451
|
-
|
452
|
-
}
|
453
|
-
const
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
1
|
+
import * as React from "react";
|
2
|
+
import { NodePort } from "./nodePort.js";
|
3
|
+
import { PropertyLedger } from "./propertyLedger.js";
|
4
|
+
import { DisplayLedger } from "./displayLedger.js";
|
5
|
+
import localStyles from "./graphNode.modules.scss";
|
6
|
+
import commonStyles from "./common.modules.scss";
|
7
|
+
export class GraphNode {
|
8
|
+
constructor(content, stateManager) {
|
9
|
+
this.content = content;
|
10
|
+
this._inputPorts = [];
|
11
|
+
this._outputPorts = [];
|
12
|
+
this._links = [];
|
13
|
+
this._x = 0;
|
14
|
+
this._y = 0;
|
15
|
+
this._gridAlignedX = 0;
|
16
|
+
this._gridAlignedY = 0;
|
17
|
+
this._mouseStartPointX = null;
|
18
|
+
this._mouseStartPointY = null;
|
19
|
+
this._displayManager = null;
|
20
|
+
this._isVisible = true;
|
21
|
+
this._enclosingFrameId = -1;
|
22
|
+
this._stateManager = stateManager;
|
23
|
+
this._onSelectionChangedObserver = this._stateManager.onSelectionChangedObservable.add((options) => {
|
24
|
+
const { selection: node } = options || {};
|
25
|
+
if (node === this) {
|
26
|
+
this._visual.classList.add(localStyles["selected"]);
|
27
|
+
}
|
28
|
+
else {
|
29
|
+
setTimeout(() => {
|
30
|
+
if (this._ownerCanvas.selectedNodes.indexOf(this) === -1) {
|
31
|
+
this._visual.classList.remove(localStyles["selected"]);
|
32
|
+
}
|
33
|
+
});
|
34
|
+
}
|
35
|
+
});
|
36
|
+
this._onUpdateRequiredObserver = this._stateManager.onUpdateRequiredObservable.add((data) => {
|
37
|
+
if (data !== this.content.data) {
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
this.refresh();
|
41
|
+
});
|
42
|
+
this._onSelectionBoxMovedObserver = this._stateManager.onSelectionBoxMoved.add((rect1) => {
|
43
|
+
const rect2 = this._visual.getBoundingClientRect();
|
44
|
+
const overlap = !(rect1.right < rect2.left || rect1.left > rect2.right || rect1.bottom < rect2.top || rect1.top > rect2.bottom);
|
45
|
+
this.setIsSelected(overlap, true);
|
46
|
+
});
|
47
|
+
this._onFrameCreatedObserver = this._stateManager.onFrameCreatedObservable.add((frame) => {
|
48
|
+
if (this._ownerCanvas.frames.some((f) => f.nodes.indexOf(this) !== -1)) {
|
49
|
+
return;
|
50
|
+
}
|
51
|
+
if (this.isOverlappingFrame(frame)) {
|
52
|
+
frame.nodes.push(this);
|
53
|
+
}
|
54
|
+
});
|
55
|
+
}
|
56
|
+
addClassToVisual(className) {
|
57
|
+
this._visual.classList.add(className);
|
58
|
+
}
|
59
|
+
removeClassFromVisual(className) {
|
60
|
+
this._visual.classList.remove(className);
|
61
|
+
}
|
62
|
+
get isVisible() {
|
63
|
+
return this._isVisible;
|
64
|
+
}
|
65
|
+
set isVisible(value) {
|
66
|
+
this._isVisible = value;
|
67
|
+
if (!value) {
|
68
|
+
this._visual.classList.add(commonStyles["hidden"]);
|
69
|
+
}
|
70
|
+
else {
|
71
|
+
this._visual.classList.remove(commonStyles["hidden"]);
|
72
|
+
this._upateNodePortNames();
|
73
|
+
}
|
74
|
+
for (const link of this._links) {
|
75
|
+
link.isVisible = value;
|
76
|
+
}
|
77
|
+
this._refreshLinks();
|
78
|
+
}
|
79
|
+
_upateNodePortNames() {
|
80
|
+
for (const port of this._inputPorts.concat(this._outputPorts)) {
|
81
|
+
if (port.hasLabel()) {
|
82
|
+
port.portName = port.portData.name;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
get outputPorts() {
|
87
|
+
return this._outputPorts;
|
88
|
+
}
|
89
|
+
get inputPorts() {
|
90
|
+
return this._inputPorts;
|
91
|
+
}
|
92
|
+
get links() {
|
93
|
+
return this._links;
|
94
|
+
}
|
95
|
+
get gridAlignedX() {
|
96
|
+
return this._gridAlignedX;
|
97
|
+
}
|
98
|
+
get gridAlignedY() {
|
99
|
+
return this._gridAlignedY;
|
100
|
+
}
|
101
|
+
get x() {
|
102
|
+
return this._x;
|
103
|
+
}
|
104
|
+
set x(value) {
|
105
|
+
if (this._x === value) {
|
106
|
+
return;
|
107
|
+
}
|
108
|
+
this._x = value;
|
109
|
+
this._gridAlignedX = this._ownerCanvas.getGridPosition(value);
|
110
|
+
this._visual.style.left = `${this._gridAlignedX}px`;
|
111
|
+
this._refreshLinks();
|
112
|
+
this._refreshFrames();
|
113
|
+
}
|
114
|
+
get y() {
|
115
|
+
return this._y;
|
116
|
+
}
|
117
|
+
set y(value) {
|
118
|
+
if (this._y === value) {
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
this._y = value;
|
122
|
+
this._gridAlignedY = this._ownerCanvas.getGridPosition(value);
|
123
|
+
this._visual.style.top = `${this._gridAlignedY}px`;
|
124
|
+
this._refreshLinks();
|
125
|
+
this._refreshFrames();
|
126
|
+
}
|
127
|
+
get width() {
|
128
|
+
return this._visual.clientWidth;
|
129
|
+
}
|
130
|
+
get height() {
|
131
|
+
return this._visual.clientHeight;
|
132
|
+
}
|
133
|
+
get id() {
|
134
|
+
return this.content.uniqueId;
|
135
|
+
}
|
136
|
+
get name() {
|
137
|
+
return this.content.name;
|
138
|
+
}
|
139
|
+
get isSelected() {
|
140
|
+
return this._isSelected;
|
141
|
+
}
|
142
|
+
get enclosingFrameId() {
|
143
|
+
return this._enclosingFrameId;
|
144
|
+
}
|
145
|
+
set enclosingFrameId(value) {
|
146
|
+
this._enclosingFrameId = value;
|
147
|
+
}
|
148
|
+
set isSelected(value) {
|
149
|
+
this.setIsSelected(value, false);
|
150
|
+
}
|
151
|
+
setIsSelected(value, marqueeSelection) {
|
152
|
+
if (this._isSelected === value) {
|
153
|
+
return;
|
154
|
+
}
|
155
|
+
this._isSelected = value;
|
156
|
+
if (!value) {
|
157
|
+
this._visual.classList.remove(localStyles["selected"]);
|
158
|
+
const indexInSelection = this._ownerCanvas.selectedNodes.indexOf(this);
|
159
|
+
if (indexInSelection > -1) {
|
160
|
+
this._ownerCanvas.selectedNodes.splice(indexInSelection, 1);
|
161
|
+
}
|
162
|
+
}
|
163
|
+
else {
|
164
|
+
this._stateManager.onSelectionChangedObservable.notifyObservers({ selection: this, marqueeSelection });
|
165
|
+
}
|
166
|
+
}
|
167
|
+
isOverlappingFrame(frame) {
|
168
|
+
const rect2 = this._visual.getBoundingClientRect();
|
169
|
+
const rect1 = frame.element.getBoundingClientRect();
|
170
|
+
// Add a tiny margin
|
171
|
+
rect1.width -= 5;
|
172
|
+
rect1.height -= 5;
|
173
|
+
const isOverlappingFrame = !(rect1.right < rect2.left || rect1.left > rect2.right || rect1.bottom < rect2.top || rect1.top > rect2.bottom);
|
174
|
+
if (isOverlappingFrame) {
|
175
|
+
this.enclosingFrameId = frame.id;
|
176
|
+
}
|
177
|
+
return isOverlappingFrame;
|
178
|
+
}
|
179
|
+
getPortForPortData(portData) {
|
180
|
+
for (const port of this._inputPorts) {
|
181
|
+
const attachedPoint = port.portData;
|
182
|
+
if (attachedPoint === portData || (attachedPoint.ownerData === portData.ownerData && attachedPoint.internalName === portData.internalName)) {
|
183
|
+
return port;
|
184
|
+
}
|
185
|
+
}
|
186
|
+
for (const port of this._outputPorts) {
|
187
|
+
const attachedPoint = port.portData;
|
188
|
+
if (attachedPoint === portData || (attachedPoint.ownerData === portData.ownerData && attachedPoint.internalName === portData.internalName)) {
|
189
|
+
return port;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
return null;
|
193
|
+
}
|
194
|
+
getPortDataForPortDataContent(data) {
|
195
|
+
for (const port of this._inputPorts) {
|
196
|
+
const attachedPoint = port.portData;
|
197
|
+
if (attachedPoint.data === data) {
|
198
|
+
return attachedPoint;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
for (const port of this._outputPorts) {
|
202
|
+
const attachedPoint = port.portData;
|
203
|
+
if (attachedPoint.data === data) {
|
204
|
+
return attachedPoint;
|
205
|
+
}
|
206
|
+
}
|
207
|
+
return null;
|
208
|
+
}
|
209
|
+
getLinksForPortDataContent(data) {
|
210
|
+
return this._links.filter((link) => link.portA.portData.data === data || link.portB.portData.data === data);
|
211
|
+
}
|
212
|
+
getLinksForPortData(portData) {
|
213
|
+
return this._links.filter((link) => link.portA.portData === portData || link.portB.portData === portData);
|
214
|
+
}
|
215
|
+
_refreshFrames() {
|
216
|
+
if (this._ownerCanvas._frameIsMoving || this._ownerCanvas._isLoading) {
|
217
|
+
return;
|
218
|
+
}
|
219
|
+
// Frames
|
220
|
+
for (const frame of this._ownerCanvas.frames) {
|
221
|
+
frame.syncNode(this);
|
222
|
+
}
|
223
|
+
}
|
224
|
+
_refreshLinks() {
|
225
|
+
if (this._ownerCanvas._isLoading) {
|
226
|
+
return;
|
227
|
+
}
|
228
|
+
for (const link of this._links) {
|
229
|
+
link.update();
|
230
|
+
}
|
231
|
+
}
|
232
|
+
refresh() {
|
233
|
+
if (this._displayManager) {
|
234
|
+
this._header.innerHTML = this._displayManager.getHeaderText(this.content);
|
235
|
+
this._displayManager.updatePreviewContent(this.content, this._content);
|
236
|
+
this._visual.style.background = this._displayManager.getBackgroundColor(this.content);
|
237
|
+
const additionalClass = this._displayManager.getHeaderClass(this.content);
|
238
|
+
this._header.classList.value = localStyles.header;
|
239
|
+
this._headerContainer.classList.value = localStyles["header-container"];
|
240
|
+
if (additionalClass) {
|
241
|
+
this._headerContainer.classList.add(additionalClass);
|
242
|
+
}
|
243
|
+
if (this._displayManager.updateFullVisualContent) {
|
244
|
+
this._displayManager.updateFullVisualContent(this.content, {
|
245
|
+
visual: this._visual,
|
246
|
+
header: this._header,
|
247
|
+
headerContainer: this._headerContainer,
|
248
|
+
headerIcon: this._headerIcon,
|
249
|
+
headerIconImg: this._headerIconImg,
|
250
|
+
comments: this._comments,
|
251
|
+
connections: this._connections,
|
252
|
+
inputsContainer: this._inputsContainer,
|
253
|
+
outputsContainer: this._outputsContainer,
|
254
|
+
content: this._content,
|
255
|
+
selectionBorder: this._selectionBorder,
|
256
|
+
});
|
257
|
+
}
|
258
|
+
}
|
259
|
+
else {
|
260
|
+
this._header.innerHTML = this.content.name;
|
261
|
+
}
|
262
|
+
for (const port of this._inputPorts) {
|
263
|
+
port.refresh();
|
264
|
+
}
|
265
|
+
for (const port of this._outputPorts) {
|
266
|
+
port.refresh();
|
267
|
+
}
|
268
|
+
if (this.enclosingFrameId !== -1) {
|
269
|
+
const index = this._ownerCanvas.frames.findIndex((frame) => frame.id === this.enclosingFrameId);
|
270
|
+
if (index >= 0 && this._ownerCanvas.frames[index].isCollapsed) {
|
271
|
+
this._ownerCanvas.frames[index].redrawFramePorts();
|
272
|
+
}
|
273
|
+
}
|
274
|
+
this._comments.innerHTML = this.content.comments || "";
|
275
|
+
this._comments.title = this.content.comments || "";
|
276
|
+
this.content.prepareHeaderIcon(this._headerIcon, this._headerIconImg);
|
277
|
+
}
|
278
|
+
_onDown(evt) {
|
279
|
+
// Check if this is coming from the port
|
280
|
+
if (evt.target && evt.target.nodeName === "IMG") {
|
281
|
+
return;
|
282
|
+
}
|
283
|
+
const indexInSelection = this._ownerCanvas.selectedNodes.indexOf(this);
|
284
|
+
if (indexInSelection === -1) {
|
285
|
+
this._stateManager.onSelectionChangedObservable.notifyObservers({ selection: this });
|
286
|
+
}
|
287
|
+
else if (evt.ctrlKey) {
|
288
|
+
this.setIsSelected(false, false);
|
289
|
+
}
|
290
|
+
evt.stopPropagation();
|
291
|
+
for (const selectedNode of this._ownerCanvas.selectedNodes) {
|
292
|
+
selectedNode.cleanAccumulation();
|
293
|
+
}
|
294
|
+
this._mouseStartPointX = evt.clientX;
|
295
|
+
this._mouseStartPointY = evt.clientY;
|
296
|
+
this._visual.setPointerCapture(evt.pointerId);
|
297
|
+
}
|
298
|
+
cleanAccumulation(useCeil = false) {
|
299
|
+
this.x = this._ownerCanvas.getGridPosition(this.x, useCeil);
|
300
|
+
this.y = this._ownerCanvas.getGridPosition(this.y, useCeil);
|
301
|
+
}
|
302
|
+
_onUp(evt) {
|
303
|
+
evt.stopPropagation();
|
304
|
+
for (const selectedNode of this._ownerCanvas.selectedNodes) {
|
305
|
+
selectedNode.cleanAccumulation();
|
306
|
+
}
|
307
|
+
this._mouseStartPointX = null;
|
308
|
+
this._mouseStartPointY = null;
|
309
|
+
this._visual.releasePointerCapture(evt.pointerId);
|
310
|
+
if (!this._ownerCanvas._targetLinkCandidate) {
|
311
|
+
return;
|
312
|
+
}
|
313
|
+
// Connect the ports
|
314
|
+
const inputs = [];
|
315
|
+
const outputs = [];
|
316
|
+
const availableNodeInputs = [];
|
317
|
+
const availableNodeOutputs = [];
|
318
|
+
const leftNode = this._ownerCanvas._targetLinkCandidate.nodeA;
|
319
|
+
const rightNode = this._ownerCanvas._targetLinkCandidate.nodeB;
|
320
|
+
// Delete previous
|
321
|
+
this._ownerCanvas._targetLinkCandidate.dispose();
|
322
|
+
this._ownerCanvas._targetLinkCandidate = null;
|
323
|
+
// Get the ports
|
324
|
+
availableNodeInputs.push(...this.content.inputs.filter((i) => !i.isConnected));
|
325
|
+
availableNodeOutputs.push(...this.content.outputs);
|
326
|
+
inputs.push(...leftNode.content.outputs);
|
327
|
+
outputs.push(...rightNode.content.inputs.filter((i) => !i.isConnected));
|
328
|
+
// Reconnect
|
329
|
+
this._ownerCanvas.automaticRewire(inputs, availableNodeInputs, true);
|
330
|
+
this._ownerCanvas.automaticRewire(availableNodeOutputs, outputs, true);
|
331
|
+
this._stateManager.onRebuildRequiredObservable.notifyObservers(false);
|
332
|
+
}
|
333
|
+
_onMove(evt) {
|
334
|
+
this._ownerCanvas._targetLinkCandidate = null;
|
335
|
+
if (this._mouseStartPointX === null || this._mouseStartPointY === null || evt.ctrlKey) {
|
336
|
+
return;
|
337
|
+
}
|
338
|
+
// Move
|
339
|
+
const newX = (evt.clientX - this._mouseStartPointX) / this._ownerCanvas.zoom;
|
340
|
+
const newY = (evt.clientY - this._mouseStartPointY) / this._ownerCanvas.zoom;
|
341
|
+
for (const selectedNode of this._ownerCanvas.selectedNodes) {
|
342
|
+
selectedNode.x += newX;
|
343
|
+
selectedNode.y += newY;
|
344
|
+
}
|
345
|
+
for (const frame of this._ownerCanvas.selectedFrames) {
|
346
|
+
frame._moveFrame(newX, newY);
|
347
|
+
}
|
348
|
+
this._mouseStartPointX = evt.clientX;
|
349
|
+
this._mouseStartPointY = evt.clientY;
|
350
|
+
evt.stopPropagation();
|
351
|
+
if (this._inputPorts.some((p) => p.portData.isConnected) || this._outputPorts.some((o) => o.portData.hasEndpoints)) {
|
352
|
+
return;
|
353
|
+
}
|
354
|
+
// Check wires that could be underneath
|
355
|
+
const rect = this._visual.getBoundingClientRect();
|
356
|
+
for (const link of this._ownerCanvas.links) {
|
357
|
+
if (link.portA.node === this || link.portB.node === this) {
|
358
|
+
link.isTargetCandidate = false;
|
359
|
+
continue;
|
360
|
+
}
|
361
|
+
link.isTargetCandidate = link.intersectsWith(rect);
|
362
|
+
if (link.isTargetCandidate) {
|
363
|
+
if (this._ownerCanvas._targetLinkCandidate !== link) {
|
364
|
+
if (this._ownerCanvas._targetLinkCandidate) {
|
365
|
+
this._ownerCanvas._targetLinkCandidate.isTargetCandidate = false;
|
366
|
+
}
|
367
|
+
this._ownerCanvas._targetLinkCandidate = link;
|
368
|
+
}
|
369
|
+
}
|
370
|
+
}
|
371
|
+
}
|
372
|
+
renderProperties() {
|
373
|
+
let control = PropertyLedger.RegisteredControls[this.content.getClassName()];
|
374
|
+
if (!control) {
|
375
|
+
control = PropertyLedger.DefaultControl;
|
376
|
+
}
|
377
|
+
return React.createElement(control, {
|
378
|
+
stateManager: this._stateManager,
|
379
|
+
nodeData: this.content,
|
380
|
+
});
|
381
|
+
}
|
382
|
+
appendVisual(root, owner) {
|
383
|
+
this._ownerCanvas = owner;
|
384
|
+
// Display manager
|
385
|
+
const displayManagerClass = DisplayLedger.RegisteredControls[this.content.getClassName()];
|
386
|
+
if (displayManagerClass) {
|
387
|
+
this._displayManager = new displayManagerClass();
|
388
|
+
}
|
389
|
+
// DOM
|
390
|
+
this._visual = root.ownerDocument.createElement("div");
|
391
|
+
this._visual.classList.add(localStyles.visual);
|
392
|
+
this._visual.addEventListener("pointerdown", (evt) => this._onDown(evt));
|
393
|
+
this._visual.addEventListener("pointerup", (evt) => this._onUp(evt));
|
394
|
+
this._visual.addEventListener("pointermove", (evt) => this._onMove(evt));
|
395
|
+
this._headerContainer = root.ownerDocument.createElement("div");
|
396
|
+
this._headerContainer.classList.add(localStyles["header-container"]);
|
397
|
+
this._visual.appendChild(this._headerContainer);
|
398
|
+
this._header = root.ownerDocument.createElement("div");
|
399
|
+
this._header.classList.add(localStyles.header);
|
400
|
+
this._headerContainer.appendChild(this._header);
|
401
|
+
this._headerIcon = root.ownerDocument.createElement("div");
|
402
|
+
this._headerIcon.classList.add(localStyles.headerIcon);
|
403
|
+
this._headerIconImg = root.ownerDocument.createElement("img");
|
404
|
+
this._headerIcon.appendChild(this._headerIconImg);
|
405
|
+
this._headerContainer.appendChild(this._headerIcon);
|
406
|
+
this._selectionBorder = root.ownerDocument.createElement("div");
|
407
|
+
this._selectionBorder.classList.add("selection-border");
|
408
|
+
this._visual.appendChild(this._selectionBorder);
|
409
|
+
this._connections = root.ownerDocument.createElement("div");
|
410
|
+
this._connections.classList.add(localStyles.connections);
|
411
|
+
this._visual.appendChild(this._connections);
|
412
|
+
this._inputsContainer = root.ownerDocument.createElement("div");
|
413
|
+
this._inputsContainer.classList.add(commonStyles.inputsContainer);
|
414
|
+
this._connections.appendChild(this._inputsContainer);
|
415
|
+
this._outputsContainer = root.ownerDocument.createElement("div");
|
416
|
+
this._outputsContainer.classList.add(commonStyles.outputsContainer);
|
417
|
+
this._connections.appendChild(this._outputsContainer);
|
418
|
+
this._content = root.ownerDocument.createElement("div");
|
419
|
+
this._content.classList.add(localStyles.content);
|
420
|
+
this._visual.appendChild(this._content);
|
421
|
+
root.appendChild(this._visual);
|
422
|
+
// Comments
|
423
|
+
this._comments = root.ownerDocument.createElement("div");
|
424
|
+
this._comments.classList.add(localStyles.comments);
|
425
|
+
this._visual.appendChild(this._comments);
|
426
|
+
// Connections
|
427
|
+
for (const input of this.content.inputs) {
|
428
|
+
this._inputPorts.push(NodePort.CreatePortElement(input, this, this._inputsContainer, this._displayManager, this._stateManager));
|
429
|
+
}
|
430
|
+
for (const output of this.content.outputs) {
|
431
|
+
this._outputPorts.push(NodePort.CreatePortElement(output, this, this._outputsContainer, this._displayManager, this._stateManager));
|
432
|
+
}
|
433
|
+
this.refresh();
|
434
|
+
}
|
435
|
+
dispose() {
|
436
|
+
// notify frame observers that this node is being deleted
|
437
|
+
this._stateManager.onGraphNodeRemovalObservable.notifyObservers(this);
|
438
|
+
if (this._onSelectionChangedObserver) {
|
439
|
+
this._stateManager.onSelectionChangedObservable.remove(this._onSelectionChangedObserver);
|
440
|
+
}
|
441
|
+
if (this._onUpdateRequiredObserver) {
|
442
|
+
this._stateManager.onUpdateRequiredObservable.remove(this._onUpdateRequiredObserver);
|
443
|
+
}
|
444
|
+
if (this._onSelectionBoxMovedObserver) {
|
445
|
+
this._stateManager.onSelectionBoxMoved.remove(this._onSelectionBoxMovedObserver);
|
446
|
+
}
|
447
|
+
if (this._visual.parentElement) {
|
448
|
+
this._visual.parentElement.removeChild(this._visual);
|
449
|
+
}
|
450
|
+
if (this._onFrameCreatedObserver) {
|
451
|
+
this._stateManager.onFrameCreatedObservable.remove(this._onFrameCreatedObserver);
|
452
|
+
}
|
453
|
+
for (const port of this._inputPorts) {
|
454
|
+
port.dispose();
|
455
|
+
}
|
456
|
+
for (const port of this._outputPorts) {
|
457
|
+
port.dispose();
|
458
|
+
}
|
459
|
+
const links = this._links.slice(0);
|
460
|
+
for (const link of links) {
|
461
|
+
link.dispose();
|
462
|
+
}
|
463
|
+
this.content.dispose();
|
464
|
+
}
|
465
|
+
}
|
460
466
|
//# sourceMappingURL=graphNode.js.map
|