sunrize 1.2.0 → 1.2.2
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/bin/sunrize.js +9 -9
- package/package.json +4 -4
- package/src/Application/Application.js +154 -152
- package/src/Editors/OutlineEditor.js +10 -4
- package/src/Editors/OutlineRouteGraph.js +182 -191
- package/src/Editors/ScriptEditor.js +28 -4
- package/src/Tools/Core/X3DChildNodeTool.js +93 -50
- package/src/Tools/Core/X3DNodeTool.js +18 -11
- package/src/Tools/EnvironmentalSensor/X3DEnvironmentalSensorNodeTool.js +1 -18
- package/src/Tools/EnvironmentalSensor/X3DEnvironmentalSensorNodeTool.x3d +3 -5
- package/src/Tools/Grouping/X3DTransformNodeTool.js +22 -14
- package/src/Tools/Grouping/X3DTransformNodeTool.x3d +47 -37
- package/src/Tools/Lighting/DirectionalLightTool.js +5 -0
- package/src/Tools/Lighting/PointLightTool.js +5 -0
- package/src/Tools/Lighting/SpotLightTool.js +5 -0
- package/src/Tools/Lighting/X3DLightNodeTool.js +0 -28
- package/src/Tools/Lighting/X3DLightNodeTool.x3d +17 -55
- package/src/Tools/Navigation/X3DViewpointNodeTool.js +1 -18
- package/src/Tools/Navigation/X3DViewpointNodeTool.x3d +3 -3
- package/src/Tools/Sound/SoundTool.js +36 -14
- package/src/Tools/Sound/SoundTool.x3d +431 -28
- package/src/Tools/TextureProjection/X3DTextureProjectorNodeTool.js +1 -23
- package/src/Tools/TextureProjection/X3DTextureProjectorNodeTool.x3d +3 -3
- package/src/Undo/Editor.js +8 -2
- package/src/assets/themes/default-template.css +14 -1
- package/src/assets/themes/default.css +14 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict"
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
const
|
|
4
4
|
$ = require ("jquery"),
|
|
5
5
|
X3D = require ("../X3D"),
|
|
6
|
-
OutlineView = require ("./OutlineView")
|
|
6
|
+
OutlineView = require ("./OutlineView");
|
|
7
7
|
|
|
8
8
|
const
|
|
9
9
|
routeColor = "#000000",
|
|
10
|
-
routeSelectedColor = "rgb(255, 69, 58)"
|
|
10
|
+
routeSelectedColor = "rgb(255, 69, 58)";
|
|
11
11
|
|
|
12
12
|
module .exports = class OutlineRouteGraph extends OutlineView
|
|
13
13
|
{
|
|
14
14
|
constructor (element)
|
|
15
15
|
{
|
|
16
|
-
super (element)
|
|
16
|
+
super (element);
|
|
17
17
|
|
|
18
|
-
this .selectedRoutes = new Set ()
|
|
18
|
+
this .selectedRoutes = new Set ();
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
selectRoutes (type, event)
|
|
@@ -24,13 +24,13 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
24
24
|
|
|
25
25
|
const
|
|
26
26
|
element = $(event .currentTarget) .closest (".field", this .sceneGraph),
|
|
27
|
-
field = this .getField (element)
|
|
27
|
+
field = this .getField (element);
|
|
28
28
|
|
|
29
29
|
// Block default href.
|
|
30
|
-
event .preventDefault ()
|
|
31
|
-
event .stopImmediatePropagation ()
|
|
30
|
+
event .preventDefault ();
|
|
31
|
+
event .stopImmediatePropagation ();
|
|
32
32
|
|
|
33
|
-
this .selectedRoutes .clear ()
|
|
33
|
+
this .selectedRoutes .clear ();
|
|
34
34
|
|
|
35
35
|
switch (type)
|
|
36
36
|
{
|
|
@@ -38,25 +38,25 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
38
38
|
{
|
|
39
39
|
for (const route of field .getInputRoutes ())
|
|
40
40
|
{
|
|
41
|
-
this .selectedRoutes .add (route .getId ())
|
|
42
|
-
this .expandTo (route .getSourceNode ())
|
|
41
|
+
this .selectedRoutes .add (route .getId ());
|
|
42
|
+
this .expandTo (route .getSourceNode ());
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
break
|
|
45
|
+
break;
|
|
46
46
|
}
|
|
47
47
|
case "output":
|
|
48
48
|
{
|
|
49
49
|
for (const route of field .getOutputRoutes ())
|
|
50
50
|
{
|
|
51
|
-
this .selectedRoutes .add (route .getId ())
|
|
52
|
-
this .expandTo (route .getDestinationNode ())
|
|
51
|
+
this .selectedRoutes .add (route .getId ());
|
|
52
|
+
this .expandTo (route .getDestinationNode ());
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
break
|
|
55
|
+
break;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
this .updateRouteGraph ()
|
|
59
|
+
this .updateRouteGraph ();
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
selectSingleRoute (type, event)
|
|
@@ -65,74 +65,65 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
65
65
|
|
|
66
66
|
const
|
|
67
67
|
element = $(event .currentTarget) .closest (".route", this .sceneGraph),
|
|
68
|
-
field = this .getField (element)
|
|
68
|
+
field = this .getField (element);
|
|
69
69
|
|
|
70
70
|
// Block default href.
|
|
71
|
-
event .preventDefault ()
|
|
72
|
-
event .stopImmediatePropagation ()
|
|
71
|
+
event .preventDefault ();
|
|
72
|
+
event .stopImmediatePropagation ();
|
|
73
73
|
|
|
74
|
-
this .selectedRoutes .clear ()
|
|
74
|
+
this .selectedRoutes .clear ();
|
|
75
75
|
|
|
76
76
|
switch (type)
|
|
77
77
|
{
|
|
78
78
|
case "input":
|
|
79
79
|
{
|
|
80
|
-
const route = this .getRoute (element, field .getInputRoutes ())
|
|
80
|
+
const route = this .getRoute (element, field .getInputRoutes ());
|
|
81
81
|
|
|
82
|
-
this .selectedRoutes .add (route .getId ())
|
|
83
|
-
this .expandTo (route .getSourceNode ())
|
|
84
|
-
break
|
|
82
|
+
this .selectedRoutes .add (route .getId ());
|
|
83
|
+
this .expandTo (route .getSourceNode ());
|
|
84
|
+
break;
|
|
85
85
|
}
|
|
86
86
|
case "output":
|
|
87
87
|
{
|
|
88
|
-
const route = this .getRoute (element, field .getOutputRoutes ())
|
|
88
|
+
const route = this .getRoute (element, field .getOutputRoutes ());
|
|
89
89
|
|
|
90
|
-
this .selectedRoutes .add (route .getId ())
|
|
91
|
-
this .expandTo (route .getDestinationNode ())
|
|
92
|
-
break
|
|
90
|
+
this .selectedRoutes .add (route .getId ());
|
|
91
|
+
this .expandTo (route .getDestinationNode ());
|
|
92
|
+
break;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
this .updateRouteGraph ()
|
|
96
|
+
this .updateRouteGraph ();
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
updateRouteGraph ()
|
|
100
100
|
{
|
|
101
|
-
const canvases = this .sceneGraph .find (".route-curves canvas")
|
|
101
|
+
const canvases = this .sceneGraph .find (".route-curves canvas");
|
|
102
102
|
|
|
103
103
|
// Determine visible fields.
|
|
104
104
|
|
|
105
|
-
const fields = new Set ()
|
|
105
|
+
const fields = new Set ();
|
|
106
106
|
|
|
107
|
-
canvases .each (
|
|
107
|
+
canvases .each ((i, canvas) =>
|
|
108
108
|
{
|
|
109
109
|
const element = $(canvas)
|
|
110
|
-
.closest ("li[node-id][field-id]", this .sceneGraph)
|
|
110
|
+
.closest ("li[node-id][field-id]", this .sceneGraph);
|
|
111
111
|
|
|
112
112
|
if (!element .length)
|
|
113
|
-
return
|
|
113
|
+
return;
|
|
114
114
|
|
|
115
|
-
fields .add (this .getField (element))
|
|
116
|
-
}
|
|
117
|
-
.bind (this))
|
|
115
|
+
fields .add (this .getField (element));
|
|
116
|
+
})
|
|
118
117
|
|
|
119
118
|
this .sceneGraph
|
|
120
119
|
.find ("canvas.field-routes")
|
|
121
|
-
.each (
|
|
122
|
-
{
|
|
123
|
-
this .updateFieldRoutes ($(canvas), fields)
|
|
124
|
-
}
|
|
125
|
-
.bind (this))
|
|
120
|
+
.each ((i, canvas) => this .updateFieldRoutes ($(canvas), fields));
|
|
126
121
|
|
|
127
122
|
this .sceneGraph
|
|
128
123
|
.find ("canvas.single-route")
|
|
129
|
-
.each (
|
|
130
|
-
{
|
|
131
|
-
this .updateSingleRoute ($(canvas), fields)
|
|
132
|
-
}
|
|
133
|
-
.bind (this))
|
|
124
|
+
.each ((i, canvas) => this .updateSingleRoute ($(canvas), fields));
|
|
134
125
|
|
|
135
|
-
this .updateRouteCurves (canvases, fields)
|
|
126
|
+
this .updateRouteCurves (canvases, fields);
|
|
136
127
|
}
|
|
137
128
|
|
|
138
129
|
updateFieldRoutes ($canvas, fields)
|
|
@@ -144,20 +135,20 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
144
135
|
field = this .getField (element),
|
|
145
136
|
parent = $canvas .parent (),
|
|
146
137
|
canvas = $canvas .get (0),
|
|
147
|
-
context = canvas .getContext ("2d")
|
|
138
|
+
context = canvas .getContext ("2d");
|
|
148
139
|
|
|
149
|
-
$canvas .height (Math .ceil (parent .height ()))
|
|
140
|
+
$canvas .height (Math .ceil (parent .height ()));
|
|
150
141
|
|
|
151
|
-
canvas .width = $canvas .width ()
|
|
152
|
-
canvas .height = $canvas .height ()
|
|
142
|
+
canvas .width = $canvas .width ();
|
|
143
|
+
canvas .height = $canvas .height ();
|
|
153
144
|
|
|
154
|
-
context .clearRect (0, 0, canvas .width, canvas .height)
|
|
145
|
+
context .clearRect (0, 0, canvas .width, canvas .height);
|
|
155
146
|
|
|
156
147
|
switch (field .getAccessType ())
|
|
157
148
|
{
|
|
158
149
|
case X3D .X3DConstants .initializeOnly:
|
|
159
150
|
{
|
|
160
|
-
break
|
|
151
|
+
break;
|
|
161
152
|
}
|
|
162
153
|
case X3D .X3DConstants .inputOnly:
|
|
163
154
|
{
|
|
@@ -165,12 +156,12 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
165
156
|
{
|
|
166
157
|
if (this .hasSourceField (fields, field))
|
|
167
158
|
{
|
|
168
|
-
context .strokeStyle = this .haveSelectedRoute (field .getInputRoutes ()) ? routeSelectedColor : routeColor
|
|
159
|
+
context .strokeStyle = this .haveSelectedRoute (field .getInputRoutes ()) ? routeSelectedColor : routeColor;
|
|
169
160
|
|
|
170
|
-
context .beginPath ()
|
|
171
|
-
context .moveTo (26, 3.5)
|
|
172
|
-
context .lineTo (canvas .width + 1, 3.5)
|
|
173
|
-
context .stroke ()
|
|
161
|
+
context .beginPath ();
|
|
162
|
+
context .moveTo (26, 3.5);
|
|
163
|
+
context .lineTo (canvas .width + 1, 3.5);
|
|
164
|
+
context .stroke ();
|
|
174
165
|
}
|
|
175
166
|
}
|
|
176
167
|
|
|
@@ -182,12 +173,12 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
182
173
|
{
|
|
183
174
|
if (this .hasDestinationField (fields, field))
|
|
184
175
|
{
|
|
185
|
-
context .strokeStyle = this .haveSelectedRoute (field .getOutputRoutes ()) ? routeSelectedColor : routeColor
|
|
176
|
+
context .strokeStyle = this .haveSelectedRoute (field .getOutputRoutes ()) ? routeSelectedColor : routeColor;
|
|
186
177
|
|
|
187
|
-
context .beginPath ()
|
|
188
|
-
context .moveTo (26, 8.5)
|
|
189
|
-
context .lineTo (canvas .width + 1, 8.5)
|
|
190
|
-
context .stroke ()
|
|
178
|
+
context .beginPath ();
|
|
179
|
+
context .moveTo (26, 8.5);
|
|
180
|
+
context .lineTo (canvas .width + 1, 8.5);
|
|
181
|
+
context .stroke ();
|
|
191
182
|
}
|
|
192
183
|
}
|
|
193
184
|
|
|
@@ -199,12 +190,12 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
199
190
|
{
|
|
200
191
|
if (this .hasSourceField (fields, field))
|
|
201
192
|
{
|
|
202
|
-
context .strokeStyle = this .haveSelectedRoute (field .getInputRoutes ()) ? routeSelectedColor : routeColor
|
|
193
|
+
context .strokeStyle = this .haveSelectedRoute (field .getInputRoutes ()) ? routeSelectedColor : routeColor;
|
|
203
194
|
|
|
204
|
-
context .beginPath ()
|
|
205
|
-
context .moveTo (40, 3.5)
|
|
206
|
-
context .lineTo (canvas .width + 1, 3.5)
|
|
207
|
-
context .stroke ()
|
|
195
|
+
context .beginPath ();
|
|
196
|
+
context .moveTo (40, 3.5);
|
|
197
|
+
context .lineTo (canvas .width + 1, 3.5);
|
|
198
|
+
context .stroke ();
|
|
208
199
|
}
|
|
209
200
|
}
|
|
210
201
|
|
|
@@ -212,16 +203,16 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
212
203
|
{
|
|
213
204
|
if (this .hasDestinationField (fields, field))
|
|
214
205
|
{
|
|
215
|
-
context .strokeStyle = this .haveSelectedRoute (field .getOutputRoutes ()) ? routeSelectedColor : routeColor
|
|
206
|
+
context .strokeStyle = this .haveSelectedRoute (field .getOutputRoutes ()) ? routeSelectedColor : routeColor;
|
|
216
207
|
|
|
217
|
-
context .beginPath ()
|
|
218
|
-
context .moveTo (field .getInputRoutes () .size ? 54 : 40, 8.5)
|
|
219
|
-
context .lineTo (canvas .width + 1, 8.5)
|
|
220
|
-
context .stroke ()
|
|
208
|
+
context .beginPath ();
|
|
209
|
+
context .moveTo (field .getInputRoutes () .size ? 54 : 40, 8.5);
|
|
210
|
+
context .lineTo (canvas .width + 1, 8.5);
|
|
211
|
+
context .stroke ();
|
|
221
212
|
}
|
|
222
213
|
}
|
|
223
214
|
|
|
224
|
-
break
|
|
215
|
+
break;
|
|
225
216
|
}
|
|
226
217
|
}
|
|
227
218
|
}
|
|
@@ -235,14 +226,14 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
235
226
|
type = element .attr ("route-type"),
|
|
236
227
|
parent = $canvas .parent (),
|
|
237
228
|
canvas = $canvas .get (0),
|
|
238
|
-
context = canvas .getContext ("2d")
|
|
229
|
+
context = canvas .getContext ("2d");
|
|
239
230
|
|
|
240
|
-
$canvas .height (Math .ceil (parent .height ()))
|
|
231
|
+
$canvas .height (Math .ceil (parent .height ()));
|
|
241
232
|
|
|
242
|
-
canvas .width = $canvas .width ()
|
|
243
|
-
canvas .height = $canvas .height ()
|
|
233
|
+
canvas .width = $canvas .width ();
|
|
234
|
+
canvas .height = $canvas .height ();
|
|
244
235
|
|
|
245
|
-
context .clearRect (0, 0, canvas .width, canvas .height)
|
|
236
|
+
context .clearRect (0, 0, canvas .width, canvas .height);
|
|
246
237
|
|
|
247
238
|
switch (type)
|
|
248
239
|
{
|
|
@@ -250,41 +241,41 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
250
241
|
{
|
|
251
242
|
const
|
|
252
243
|
field = this .getField (element),
|
|
253
|
-
route = this .getRoute (element, field .getInputRoutes ())
|
|
244
|
+
route = this .getRoute (element, field .getInputRoutes ());
|
|
254
245
|
|
|
255
246
|
if (!route)
|
|
256
|
-
break
|
|
247
|
+
break;
|
|
257
248
|
|
|
258
249
|
if (!fields .has (route .getSourceNode () .getField (route .sourceField)))
|
|
259
|
-
break
|
|
250
|
+
break;
|
|
260
251
|
|
|
261
|
-
context .strokeStyle = this .selectedRoutes .has (route .getId ()) ? routeSelectedColor : routeColor
|
|
252
|
+
context .strokeStyle = this .selectedRoutes .has (route .getId ()) ? routeSelectedColor : routeColor;
|
|
262
253
|
|
|
263
|
-
context .beginPath ()
|
|
264
|
-
context .moveTo (26, 3.5)
|
|
265
|
-
context .lineTo (canvas .width + 1, 3.5)
|
|
266
|
-
context .stroke ()
|
|
267
|
-
break
|
|
254
|
+
context .beginPath ();
|
|
255
|
+
context .moveTo (26, 3.5);
|
|
256
|
+
context .lineTo (canvas .width + 1, 3.5);
|
|
257
|
+
context .stroke ();
|
|
258
|
+
break;
|
|
268
259
|
}
|
|
269
260
|
case "output":
|
|
270
261
|
{
|
|
271
262
|
const
|
|
272
263
|
field = this .getField (element),
|
|
273
|
-
route = this .getRoute (element, field .getOutputRoutes ())
|
|
264
|
+
route = this .getRoute (element, field .getOutputRoutes ());
|
|
274
265
|
|
|
275
266
|
if (!route)
|
|
276
|
-
break
|
|
267
|
+
break;
|
|
277
268
|
|
|
278
269
|
if (!fields .has (route .getDestinationNode () .getField (route .destinationField)))
|
|
279
|
-
break
|
|
270
|
+
break;
|
|
280
271
|
|
|
281
|
-
context .strokeStyle = this .selectedRoutes .has (route .getId ()) ? routeSelectedColor : routeColor
|
|
272
|
+
context .strokeStyle = this .selectedRoutes .has (route .getId ()) ? routeSelectedColor : routeColor;
|
|
282
273
|
|
|
283
|
-
context .beginPath ()
|
|
284
|
-
context .moveTo (26, 8.5)
|
|
285
|
-
context .lineTo (canvas .width + 1, 8.5)
|
|
286
|
-
context .stroke ()
|
|
287
|
-
break
|
|
274
|
+
context .beginPath ();
|
|
275
|
+
context .moveTo (26, 8.5);
|
|
276
|
+
context .lineTo (canvas .width + 1, 8.5);
|
|
277
|
+
context .stroke ();
|
|
278
|
+
break;
|
|
288
279
|
}
|
|
289
280
|
}
|
|
290
281
|
}
|
|
@@ -299,95 +290,104 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
299
290
|
canvas1 = $(canvases [i]),
|
|
300
291
|
canvas2 = $(canvases [i + 1]),
|
|
301
292
|
rect1 = canvas1 [0] .getBoundingClientRect (),
|
|
302
|
-
rect2 = canvas2 [0] .getBoundingClientRect ()
|
|
293
|
+
rect2 = canvas2 [0] .getBoundingClientRect ();
|
|
303
294
|
|
|
304
|
-
canvas1 .height (Math .ceil (rect2 .y - rect1 .y))
|
|
295
|
+
canvas1 .height (Math .ceil (rect2 .y - rect1 .y));
|
|
305
296
|
|
|
306
|
-
canvas1 [0] .width = canvas1 .width ()
|
|
307
|
-
canvas1 [0] .height = canvas1 .height ()
|
|
297
|
+
canvas1 [0] .width = canvas1 .width ();
|
|
298
|
+
canvas1 [0] .height = canvas1 .height ();
|
|
308
299
|
}
|
|
309
300
|
|
|
310
301
|
// Draw arcs or vertical lines.
|
|
311
302
|
|
|
312
|
-
const routes = new Set ()
|
|
303
|
+
const routes = new Set ();
|
|
313
304
|
|
|
314
|
-
canvases .each (
|
|
305
|
+
canvases .each ((i, canvas) =>
|
|
315
306
|
{
|
|
316
307
|
const
|
|
317
308
|
element = $(canvas) .closest ("li", this .sceneGraph),
|
|
318
|
-
context = canvas .getContext ("2d")
|
|
309
|
+
context = canvas .getContext ("2d");
|
|
319
310
|
|
|
320
311
|
// Clear canvases.
|
|
321
312
|
|
|
322
|
-
context .clearRect (0, 0, canvas .width, canvas .height)
|
|
313
|
+
context .clearRect (0, 0, canvas .width, canvas .height);
|
|
323
314
|
|
|
324
|
-
const selectedRoutes = new Set (routes)
|
|
315
|
+
const selectedRoutes = new Set (routes);
|
|
325
316
|
|
|
326
317
|
if (element .length && (element .hasClass ("field") && !element .data ("full-expanded")) || element .hasClass ("route"))
|
|
327
318
|
{
|
|
328
319
|
const
|
|
329
|
-
field
|
|
330
|
-
routeId
|
|
331
|
-
selectedInputRoutes = this .haveSelectedRoute (field .getInputRoutes (), routeId),
|
|
332
|
-
selectedOutputRoutes = this .haveSelectedRoute (field .getOutputRoutes (), routeId)
|
|
320
|
+
field = this .getField (element),
|
|
321
|
+
routeId = element .attr ("route-id") !== undefined ? parseInt (element .attr ("route-id")) : undefined;
|
|
333
322
|
|
|
334
323
|
let
|
|
335
|
-
inputAdds
|
|
336
|
-
inputDeletes
|
|
337
|
-
outputAdds
|
|
338
|
-
outputDeletes
|
|
339
|
-
|
|
340
|
-
|
|
324
|
+
inputAdds = 0,
|
|
325
|
+
inputDeletes = 0,
|
|
326
|
+
outputAdds = 0,
|
|
327
|
+
outputDeletes = 0,
|
|
328
|
+
selectedInputRoutesUp = false,
|
|
329
|
+
selectedInputRoutesDown = false,
|
|
330
|
+
selectedOutputRoutesUp = false,
|
|
331
|
+
selectedOutputRoutesDown = false;
|
|
332
|
+
|
|
333
|
+
field .getInputRoutes () .forEach (route =>
|
|
341
334
|
{
|
|
342
335
|
if (routeId !== undefined && route .getId () !== routeId)
|
|
343
|
-
return
|
|
336
|
+
return;
|
|
344
337
|
|
|
345
338
|
if (!fields .has (route .getSourceNode () .getField (route .sourceField)))
|
|
346
|
-
return
|
|
339
|
+
return;
|
|
347
340
|
|
|
348
341
|
if (routes .has (route))
|
|
349
342
|
{
|
|
350
|
-
++ inputDeletes
|
|
351
|
-
|
|
352
|
-
|
|
343
|
+
++ inputDeletes;
|
|
344
|
+
selectedInputRoutesUp = this .selectedRoutes .has (route .getId ());
|
|
345
|
+
|
|
346
|
+
routes .delete (route);
|
|
347
|
+
selectedRoutes .delete (route);
|
|
353
348
|
}
|
|
354
349
|
else
|
|
355
350
|
{
|
|
356
|
-
++ inputAdds
|
|
357
|
-
|
|
351
|
+
++ inputAdds;
|
|
352
|
+
selectedInputRoutesDown = this .selectedRoutes .has (route .getId ());
|
|
353
|
+
|
|
354
|
+
routes .add (route);
|
|
358
355
|
}
|
|
359
356
|
},
|
|
360
357
|
this)
|
|
361
358
|
|
|
362
|
-
field .getOutputRoutes () .forEach (
|
|
359
|
+
field .getOutputRoutes () .forEach (route =>
|
|
363
360
|
{
|
|
364
361
|
if (routeId !== undefined && route .getId () !== routeId)
|
|
365
|
-
return
|
|
362
|
+
return;
|
|
366
363
|
|
|
367
364
|
if (!fields .has (route .getDestinationNode () .getField (route .destinationField)))
|
|
368
|
-
return
|
|
365
|
+
return;
|
|
369
366
|
|
|
370
367
|
if (routes .has (route))
|
|
371
368
|
{
|
|
372
|
-
++ outputDeletes
|
|
373
|
-
|
|
374
|
-
|
|
369
|
+
++ outputDeletes;
|
|
370
|
+
selectedOutputRoutesUp = this .selectedRoutes .has (route .getId ());
|
|
371
|
+
|
|
372
|
+
routes .delete (route);
|
|
373
|
+
selectedRoutes .delete (route);
|
|
375
374
|
}
|
|
376
375
|
else
|
|
377
376
|
{
|
|
378
|
-
++ outputAdds
|
|
379
|
-
|
|
377
|
+
++ outputAdds;
|
|
378
|
+
selectedOutputRoutesDown = this .selectedRoutes .has (route .getId ());
|
|
379
|
+
|
|
380
|
+
routes .add (route);
|
|
380
381
|
}
|
|
381
|
-
}
|
|
382
|
-
this)
|
|
382
|
+
});
|
|
383
383
|
|
|
384
384
|
// Determine vertical selected lines.
|
|
385
385
|
|
|
386
|
-
const verticalSelectedRoute = this .haveSelectedRoute (selectedRoutes)
|
|
386
|
+
const verticalSelectedRoute = this .haveSelectedRoute (selectedRoutes);
|
|
387
387
|
|
|
388
388
|
function draw (state, selected) { return (state === "normal" && !selected) || (state === "selected" && selected) }
|
|
389
389
|
|
|
390
|
-
["normal", "selected"] .forEach (
|
|
390
|
+
["normal", "selected"] .forEach (state =>
|
|
391
391
|
{
|
|
392
392
|
// Draw curve up.
|
|
393
393
|
|
|
@@ -395,14 +395,14 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
395
395
|
{
|
|
396
396
|
// Input curve up.
|
|
397
397
|
|
|
398
|
-
if (draw (state,
|
|
398
|
+
if (draw (state, selectedInputRoutesUp))
|
|
399
399
|
{
|
|
400
|
-
context .strokeStyle =
|
|
400
|
+
context .strokeStyle = selectedInputRoutesUp ? routeSelectedColor : routeColor;
|
|
401
401
|
|
|
402
|
-
context .beginPath ()
|
|
403
|
-
context .arc (0, 0, 9.5, 1/2 * Math .PI, 2 * Math .PI, true)
|
|
404
|
-
context .lineTo (9.5, 0)
|
|
405
|
-
context .stroke ()
|
|
402
|
+
context .beginPath ();
|
|
403
|
+
context .arc (0, 0, 9.5, 1/2 * Math .PI, 2 * Math .PI, true);
|
|
404
|
+
context .lineTo (9.5, 0);
|
|
405
|
+
context .stroke ();
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
408
|
|
|
@@ -410,14 +410,14 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
410
410
|
{
|
|
411
411
|
// Output curve up.
|
|
412
412
|
|
|
413
|
-
if (draw (state,
|
|
413
|
+
if (draw (state, selectedOutputRoutesUp))
|
|
414
414
|
{
|
|
415
|
-
context .strokeStyle =
|
|
415
|
+
context .strokeStyle = selectedOutputRoutesUp ? routeSelectedColor : routeColor;
|
|
416
416
|
|
|
417
|
-
context .beginPath ()
|
|
418
|
-
context .arc (0, 5, 9.5, 1/2 * Math .PI, 2 * Math .PI, true)
|
|
419
|
-
context .lineTo (9.5, 0)
|
|
420
|
-
context .stroke ()
|
|
417
|
+
context .beginPath ();
|
|
418
|
+
context .arc (0, 5, 9.5, 1/2 * Math .PI, 2 * Math .PI, true);
|
|
419
|
+
context .lineTo (9.5, 0);
|
|
420
|
+
context .stroke ();
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
|
|
@@ -427,14 +427,14 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
427
427
|
{
|
|
428
428
|
// Input curve down.
|
|
429
429
|
|
|
430
|
-
if (draw (state,
|
|
430
|
+
if (draw (state, selectedInputRoutesDown))
|
|
431
431
|
{
|
|
432
|
-
context .strokeStyle =
|
|
432
|
+
context .strokeStyle = selectedInputRoutesDown ? routeSelectedColor : routeColor;
|
|
433
433
|
|
|
434
|
-
context .beginPath ()
|
|
435
|
-
context .arc (0, 19, 9.5, 3/2 * Math .PI, 2 * Math .PI)
|
|
436
|
-
context .lineTo (9.5, canvas .height + 1)
|
|
437
|
-
context .stroke ()
|
|
434
|
+
context .beginPath ();
|
|
435
|
+
context .arc (0, 19, 9.5, 3/2 * Math .PI, 2 * Math .PI);
|
|
436
|
+
context .lineTo (9.5, canvas .height + 1);
|
|
437
|
+
context .stroke ();
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
|
|
@@ -442,14 +442,14 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
442
442
|
{
|
|
443
443
|
// Output curve down.
|
|
444
444
|
|
|
445
|
-
if (draw (state,
|
|
445
|
+
if (draw (state, selectedOutputRoutesDown))
|
|
446
446
|
{
|
|
447
|
-
context .strokeStyle =
|
|
447
|
+
context .strokeStyle = selectedOutputRoutesDown ? routeSelectedColor : routeColor;
|
|
448
448
|
|
|
449
|
-
context .beginPath ()
|
|
450
|
-
context .arc (0, 24, 9.5, 3/2 * Math .PI, 2 * Math .PI)
|
|
451
|
-
context .lineTo (9.5, canvas .height + 1)
|
|
452
|
-
context .stroke ()
|
|
449
|
+
context .beginPath ();
|
|
450
|
+
context .arc (0, 24, 9.5, 3/2 * Math .PI, 2 * Math .PI);
|
|
451
|
+
context .lineTo (9.5, canvas .height + 1);
|
|
452
|
+
context .stroke ();
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
455
|
|
|
@@ -459,16 +459,15 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
459
459
|
{
|
|
460
460
|
if (draw (state, verticalSelectedRoute))
|
|
461
461
|
{
|
|
462
|
-
context .strokeStyle = verticalSelectedRoute ? routeSelectedColor : routeColor
|
|
462
|
+
context .strokeStyle = verticalSelectedRoute ? routeSelectedColor : routeColor;
|
|
463
463
|
|
|
464
|
-
context .beginPath ()
|
|
465
|
-
context .moveTo (9.5, 0)
|
|
466
|
-
context .lineTo (9.5, canvas .height + 1)
|
|
467
|
-
context .stroke ()
|
|
464
|
+
context .beginPath ();
|
|
465
|
+
context .moveTo (9.5, 0);
|
|
466
|
+
context .lineTo (9.5, canvas .height + 1);
|
|
467
|
+
context .stroke ();
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
}
|
|
471
|
-
this)
|
|
470
|
+
})
|
|
472
471
|
}
|
|
473
472
|
else
|
|
474
473
|
{
|
|
@@ -476,16 +475,15 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
476
475
|
|
|
477
476
|
if (routes .size)
|
|
478
477
|
{
|
|
479
|
-
context .strokeStyle = this .haveSelectedRoute (routes) ? routeSelectedColor : routeColor
|
|
478
|
+
context .strokeStyle = this .haveSelectedRoute (routes) ? routeSelectedColor : routeColor;
|
|
480
479
|
|
|
481
|
-
context .beginPath ()
|
|
482
|
-
context .moveTo (9.5, 0)
|
|
483
|
-
context .lineTo (9.5, canvas .height + 1)
|
|
484
|
-
context .stroke ()
|
|
480
|
+
context .beginPath ();
|
|
481
|
+
context .moveTo (9.5, 0);
|
|
482
|
+
context .lineTo (9.5, canvas .height + 1);
|
|
483
|
+
context .stroke ();
|
|
485
484
|
}
|
|
486
485
|
}
|
|
487
|
-
}
|
|
488
|
-
.bind (this))
|
|
486
|
+
})
|
|
489
487
|
}
|
|
490
488
|
|
|
491
489
|
hasSourceField (fields, field)
|
|
@@ -493,10 +491,10 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
493
491
|
for (const route of field .getInputRoutes ())
|
|
494
492
|
{
|
|
495
493
|
if (fields .has (route .getSourceNode () .getField (route .sourceField)))
|
|
496
|
-
return true
|
|
494
|
+
return true;
|
|
497
495
|
}
|
|
498
496
|
|
|
499
|
-
return false
|
|
497
|
+
return false;
|
|
500
498
|
}
|
|
501
499
|
|
|
502
500
|
hasDestinationField (fields, field)
|
|
@@ -504,27 +502,20 @@ module .exports = class OutlineRouteGraph extends OutlineView
|
|
|
504
502
|
for (const route of field .getOutputRoutes ())
|
|
505
503
|
{
|
|
506
504
|
if (fields .has (route .getDestinationNode () .getField (route .destinationField)))
|
|
507
|
-
return true
|
|
505
|
+
return true;
|
|
508
506
|
}
|
|
509
507
|
|
|
510
|
-
return false
|
|
508
|
+
return false;
|
|
511
509
|
}
|
|
512
510
|
|
|
513
|
-
haveSelectedRoute (routes
|
|
511
|
+
haveSelectedRoute (routes)
|
|
514
512
|
{
|
|
515
|
-
|
|
516
|
-
{
|
|
517
|
-
for (const route of routes)
|
|
518
|
-
{
|
|
519
|
-
if (this .selectedRoutes .has (route .getId ()))
|
|
520
|
-
return true
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
else
|
|
513
|
+
for (const route of routes)
|
|
524
514
|
{
|
|
525
|
-
|
|
515
|
+
if (this .selectedRoutes .has (route .getId ()))
|
|
516
|
+
return true;
|
|
526
517
|
}
|
|
527
518
|
|
|
528
|
-
return false
|
|
519
|
+
return false;
|
|
529
520
|
}
|
|
530
|
-
}
|
|
521
|
+
};
|