sunrize 1.3.5 → 1.4.1
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/package.json +6 -5
- package/src/Application/Application.js +27 -12
- package/src/Application/Dashboard.js +1 -1
- package/src/Application/Document.js +1 -1
- package/src/Editors/OutlineEditor.js +145 -74
- package/src/Editors/OutlineRouteGraph.js +111 -117
- package/src/Editors/OutlineView.js +455 -312
- package/src/Undo/Editor.js +62 -22
- package/src/assets/html/application-template.html +2 -0
- package/src/assets/html/application.html +2 -0
- package/src/assets/themes/default-template.css +17 -9
- package/src/assets/themes/default.css +17 -9
- package/src/assets/x3duom.xml +43120 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sunrize",
|
|
3
3
|
"productName": "Sunrize X3D Editor",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.1",
|
|
5
5
|
"description": "A Multi-Platform X3D Editor",
|
|
6
6
|
"main": "src/main.js",
|
|
7
7
|
"bin": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"start": "electron .",
|
|
16
16
|
"development": "SUNRISE_ENVIRONMENT=DEVELOPMENT electron .",
|
|
17
17
|
"release": "node build/release.js",
|
|
18
|
+
"x3duom": "sh build/x3duom.sh",
|
|
18
19
|
"download": "node build/download.js",
|
|
19
20
|
"premake": "npm i -D electron",
|
|
20
21
|
"make": "env PATH=\"$(pwd)/build/wine-proxy:$PATH\" electron-forge make",
|
|
@@ -80,16 +81,16 @@
|
|
|
80
81
|
"dependencies": {
|
|
81
82
|
"capitalize": "^2.0.4",
|
|
82
83
|
"console": "^0.7.2",
|
|
83
|
-
"electron": "^28.1.
|
|
84
|
+
"electron": "^28.1.4",
|
|
84
85
|
"electron-prompt": "^1.7.0",
|
|
85
86
|
"electron-squirrel-startup": "^1.0.0",
|
|
86
|
-
"electron-tabs": "^1.0.
|
|
87
|
+
"electron-tabs": "^1.0.4",
|
|
87
88
|
"fullname": "^5.0.0",
|
|
88
89
|
"jquery": "^3.7.1",
|
|
89
90
|
"jquery-ui-dist": "^1.13.2",
|
|
90
91
|
"jstree": "^3.3.16",
|
|
91
92
|
"material-icons": "^1.13.12",
|
|
92
|
-
"material-symbols": "^0.14.
|
|
93
|
+
"material-symbols": "^0.14.5",
|
|
93
94
|
"md5": "^2.3.0",
|
|
94
95
|
"monaco-editor": "^0.45.0",
|
|
95
96
|
"node-clipboardy": "^1.0.3",
|
|
@@ -98,7 +99,7 @@
|
|
|
98
99
|
"spectrum-colorpicker2": "^2.0.10",
|
|
99
100
|
"string-similarity": "^4.0.4",
|
|
100
101
|
"update-electron-app": "^3.0.0",
|
|
101
|
-
"x_ite": "^9.1
|
|
102
|
+
"x_ite": "^9.2.1"
|
|
102
103
|
},
|
|
103
104
|
"config": {
|
|
104
105
|
"forge": {
|
|
@@ -40,6 +40,8 @@ module .exports = class Application
|
|
|
40
40
|
if (process .platform === "win32")
|
|
41
41
|
require ("update-electron-app") .updateElectronApp ();
|
|
42
42
|
|
|
43
|
+
electron .app .commandLine .appendSwitch ("--enable-features", "OverlayScrollbar");
|
|
44
|
+
|
|
43
45
|
new Application ();
|
|
44
46
|
}
|
|
45
47
|
|
|
@@ -92,7 +94,7 @@ module .exports = class Application
|
|
|
92
94
|
electron .ipcMain .on ("change-menu", (event, object) => this .updateMenu (object));
|
|
93
95
|
electron .ipcMain .on ("context-menu", (event, id, menu) => this .contextMenu (id, menu));
|
|
94
96
|
|
|
95
|
-
electron .ipcMain .handle ("file-path", async (event,
|
|
97
|
+
electron .ipcMain .handle ("file-path", async (event, options) => await this .showDialog (options));
|
|
96
98
|
electron .ipcMain .handle ("fullname", async () => await (await import ("fullname")) .default ());
|
|
97
99
|
|
|
98
100
|
await electron .app .whenReady ();
|
|
@@ -191,7 +193,7 @@ module .exports = class Application
|
|
|
191
193
|
},
|
|
192
194
|
},
|
|
193
195
|
{
|
|
194
|
-
label: _ ("Open
|
|
196
|
+
label: _ ("Open Location..."),
|
|
195
197
|
accelerator: "Shift+CmdOrCtrl+O",
|
|
196
198
|
click: async () =>
|
|
197
199
|
{
|
|
@@ -260,7 +262,7 @@ module .exports = class Application
|
|
|
260
262
|
},
|
|
261
263
|
},
|
|
262
264
|
{
|
|
263
|
-
label: _ ("Save Copy
|
|
265
|
+
label: _ ("Save A Copy..."),
|
|
264
266
|
click: async () =>
|
|
265
267
|
{
|
|
266
268
|
const response = await this .showSaveDialog (this .currentFile);
|
|
@@ -758,6 +760,17 @@ module .exports = class Application
|
|
|
758
760
|
return filtered;
|
|
759
761
|
}
|
|
760
762
|
|
|
763
|
+
showDialog (options)
|
|
764
|
+
{
|
|
765
|
+
switch (options .type)
|
|
766
|
+
{
|
|
767
|
+
case "open":
|
|
768
|
+
return this .showOpenDialog (options .defaultPath, options .filters);
|
|
769
|
+
case "save":
|
|
770
|
+
return this .showSaveDialog (options .defaultPath);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
|
|
761
774
|
/**
|
|
762
775
|
*
|
|
763
776
|
* @param {[string]} urls
|
|
@@ -781,7 +794,7 @@ module .exports = class Application
|
|
|
781
794
|
}
|
|
782
795
|
}
|
|
783
796
|
|
|
784
|
-
async showOpenDialog (defaultPath)
|
|
797
|
+
async showOpenDialog (defaultPath, filters)
|
|
785
798
|
{
|
|
786
799
|
this .pushMenu (electron .Menu .buildFromTemplate ([
|
|
787
800
|
{
|
|
@@ -791,12 +804,14 @@ module .exports = class Application
|
|
|
791
804
|
{ role: "editMenu" },
|
|
792
805
|
]));
|
|
793
806
|
|
|
807
|
+
console .log (filters)
|
|
808
|
+
|
|
794
809
|
const response = await electron .dialog .showOpenDialog ({
|
|
795
810
|
defaultPath: defaultPath,
|
|
796
811
|
properties: ["openFile", "multiSelections"],
|
|
797
|
-
filters: [
|
|
812
|
+
filters: filters ?? [
|
|
798
813
|
{
|
|
799
|
-
name: "X3D Document",
|
|
814
|
+
name: _ ("X3D Document"),
|
|
800
815
|
extensions: ["x3d", "x3dz", "x3dj", "x3djz", "x3dv", "x3dvz", "wrl", "wrz", "wrl.gz", "vrml", "gltf", "glb", "obj", "stl", "ply", "svg"],
|
|
801
816
|
},
|
|
802
817
|
],
|
|
@@ -826,12 +841,12 @@ module .exports = class Application
|
|
|
826
841
|
defaultPath: defaultPath,
|
|
827
842
|
properties: ["createDirectory", "showOverwriteConfirmation"],
|
|
828
843
|
filters : [
|
|
829
|
-
{ name: "X3D XML Document", extensions: ["x3d"] },
|
|
830
|
-
{ name: "X3D XML Document GZipped", extensions: ["x3dz"] },
|
|
831
|
-
{ name: "X3D JSON Document", extensions: ["x3dj"] },
|
|
832
|
-
{ name: "X3D JSON Document GZipped", extensions: ["x3djz"] },
|
|
833
|
-
{ name: "X3D VRML Classic Document", extensions: ["x3dv"] },
|
|
834
|
-
{ name: "X3D VRML Classic Document GZipped", extensions: ["x3dvz"] },
|
|
844
|
+
{ name: _ ("X3D XML Document"), extensions: ["x3d"] },
|
|
845
|
+
{ name: _ ("X3D XML Document GZipped"), extensions: ["x3dz"] },
|
|
846
|
+
{ name: _ ("X3D JSON Document"), extensions: ["x3dj"] },
|
|
847
|
+
{ name: _ ("X3D JSON Document GZipped"), extensions: ["x3djz"] },
|
|
848
|
+
{ name: _ ("X3D VRML Classic Document"), extensions: ["x3dv"] },
|
|
849
|
+
{ name: _ ("X3D VRML Classic Document GZipped"), extensions: ["x3dvz"] },
|
|
835
850
|
],
|
|
836
851
|
});
|
|
837
852
|
|
|
@@ -45,7 +45,7 @@ module .exports = class Dashboard extends Interface
|
|
|
45
45
|
|
|
46
46
|
this .viewAllButton = $("<span></span>")
|
|
47
47
|
.addClass (["material-symbols-outlined"])
|
|
48
|
-
.attr ("title", _ ("
|
|
48
|
+
.attr ("title", _ ("Look at selected objects."))
|
|
49
49
|
.text ("center_focus_strong")
|
|
50
50
|
.appendTo (this .toolbar)
|
|
51
51
|
.on ("click", () => this .viewAll ());
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
const
|
|
4
4
|
$ = require ("jquery"),
|
|
5
5
|
electron = require ("electron"),
|
|
6
|
+
path = require ("path"),
|
|
7
|
+
url = require ("url"),
|
|
6
8
|
X3D = require ("../X3D"),
|
|
7
9
|
OutlineRouteGraph = require ("./OutlineRouteGraph"),
|
|
8
10
|
Editor = require ("../Undo/Editor"),
|
|
@@ -1042,7 +1044,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1042
1044
|
const
|
|
1043
1045
|
executionContext = this .objects .get (executionContextId),
|
|
1044
1046
|
proto = this .objects .get (protoNodeId),
|
|
1045
|
-
response = await electron .ipcRenderer .invoke ("file-path", proto .getName ());
|
|
1047
|
+
response = await electron .ipcRenderer .invoke ("file-path", { type: "save", defaultPath: proto .getName () });
|
|
1046
1048
|
|
|
1047
1049
|
if (response .canceled)
|
|
1048
1050
|
return;
|
|
@@ -1073,36 +1075,39 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1073
1075
|
UndoManager .shared .endUndo ();
|
|
1074
1076
|
}
|
|
1075
1077
|
|
|
1076
|
-
addBooleanField (
|
|
1078
|
+
addBooleanField (button)
|
|
1077
1079
|
{
|
|
1078
1080
|
const
|
|
1079
|
-
element =
|
|
1081
|
+
element = button .closest (".field"),
|
|
1080
1082
|
node = this .getNode (element),
|
|
1081
1083
|
field = this .getField (element);
|
|
1082
1084
|
|
|
1083
1085
|
if (field .getAccessType () === X3D .X3DConstants .outputOnly)
|
|
1084
1086
|
return;
|
|
1085
1087
|
|
|
1086
|
-
|
|
1088
|
+
button .addClass ("pointer") .on ("click", event =>
|
|
1087
1089
|
{
|
|
1090
|
+
event .preventDefault ();
|
|
1091
|
+
event .stopImmediatePropagation ();
|
|
1092
|
+
|
|
1088
1093
|
Editor .setFieldValue (node .getExecutionContext (), node, field, !field .getValue ());
|
|
1089
1094
|
});
|
|
1090
1095
|
}
|
|
1091
1096
|
|
|
1092
|
-
addColorField (
|
|
1097
|
+
addColorField (button)
|
|
1093
1098
|
{
|
|
1094
1099
|
//https://seballot.github.io/spectrum/#skinning-nonInput
|
|
1095
1100
|
require ("spectrum-colorpicker2");
|
|
1096
1101
|
|
|
1097
1102
|
const
|
|
1098
|
-
element =
|
|
1103
|
+
element = button .closest (".field"),
|
|
1099
1104
|
node = this .getNode (element),
|
|
1100
1105
|
field = this .getField (element);
|
|
1101
1106
|
|
|
1102
1107
|
if (field .getAccessType () === X3D .X3DConstants .outputOnly)
|
|
1103
1108
|
return;
|
|
1104
1109
|
|
|
1105
|
-
|
|
1110
|
+
button .addClass ("pointer") .spectrum ({
|
|
1106
1111
|
type: "color",
|
|
1107
1112
|
showAlpha: field .getType () === X3D .X3DConstants .SFColorRGBA,
|
|
1108
1113
|
showInitial: true,
|
|
@@ -1113,7 +1118,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1113
1118
|
})
|
|
1114
1119
|
.on ("beforeShow.spectrum", (event) =>
|
|
1115
1120
|
{
|
|
1116
|
-
|
|
1121
|
+
button .spectrum ("set", button .css ("background-color"));
|
|
1117
1122
|
})
|
|
1118
1123
|
.on("move.spectrum", (event, tinyColor) =>
|
|
1119
1124
|
{
|
|
@@ -1143,27 +1148,89 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1143
1148
|
});
|
|
1144
1149
|
}
|
|
1145
1150
|
|
|
1146
|
-
removeColorField (
|
|
1151
|
+
removeColorField (button)
|
|
1147
1152
|
{
|
|
1148
|
-
|
|
1153
|
+
button .spectrum ?.("destroy");
|
|
1149
1154
|
}
|
|
1150
1155
|
|
|
1151
|
-
addTimeField (
|
|
1156
|
+
addTimeField (button)
|
|
1152
1157
|
{
|
|
1153
1158
|
const
|
|
1154
|
-
element =
|
|
1159
|
+
element = button .closest (".field"),
|
|
1155
1160
|
node = this .getNode (element),
|
|
1156
1161
|
field = this .getField (element);
|
|
1157
1162
|
|
|
1158
1163
|
if (field .getAccessType () === X3D .X3DConstants .outputOnly)
|
|
1159
1164
|
return;
|
|
1160
1165
|
|
|
1161
|
-
|
|
1166
|
+
button .addClass ("pointer") .on ("click", event =>
|
|
1162
1167
|
{
|
|
1168
|
+
event .preventDefault ();
|
|
1169
|
+
event .stopImmediatePropagation ();
|
|
1170
|
+
|
|
1163
1171
|
Editor .setFieldValue (node .getExecutionContext (), node, field, Date .now () / 1000);
|
|
1164
1172
|
});
|
|
1165
1173
|
}
|
|
1166
1174
|
|
|
1175
|
+
addUrlField (button)
|
|
1176
|
+
{
|
|
1177
|
+
const
|
|
1178
|
+
element = button .closest (".field, .special"),
|
|
1179
|
+
node = this .getNode (element),
|
|
1180
|
+
field = this .getField (element);
|
|
1181
|
+
|
|
1182
|
+
button .addClass ("pointer") .on ("click", async event =>
|
|
1183
|
+
{
|
|
1184
|
+
event .preventDefault ();
|
|
1185
|
+
event .stopImmediatePropagation ();
|
|
1186
|
+
|
|
1187
|
+
switch (node .getTypeName ())
|
|
1188
|
+
{
|
|
1189
|
+
case "X3DExternProtoDeclaration":
|
|
1190
|
+
case "Inline":
|
|
1191
|
+
{
|
|
1192
|
+
var filters = undefined;
|
|
1193
|
+
break;
|
|
1194
|
+
}
|
|
1195
|
+
default:
|
|
1196
|
+
{
|
|
1197
|
+
var filters = [
|
|
1198
|
+
{ name: _ ("All Files"), extensions: ["*"] },
|
|
1199
|
+
];
|
|
1200
|
+
|
|
1201
|
+
break;
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
const response = await electron .ipcRenderer .invoke ("file-path",
|
|
1206
|
+
{
|
|
1207
|
+
type: "open",
|
|
1208
|
+
filters: filters,
|
|
1209
|
+
});
|
|
1210
|
+
|
|
1211
|
+
if (response .canceled)
|
|
1212
|
+
return;
|
|
1213
|
+
|
|
1214
|
+
const
|
|
1215
|
+
worldURL = node .getExecutionContext () .getWorldURL (),
|
|
1216
|
+
value = field .copy ();
|
|
1217
|
+
|
|
1218
|
+
for (const filePath of response .filePaths .reverse ())
|
|
1219
|
+
{
|
|
1220
|
+
try
|
|
1221
|
+
{
|
|
1222
|
+
value .unshift (path .relative (path .dirname (url .fileURLToPath (worldURL)), filePath));
|
|
1223
|
+
}
|
|
1224
|
+
catch
|
|
1225
|
+
{
|
|
1226
|
+
value .unshift (url .pathToFileURL (filePath));
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
Editor .setFieldValue (node .getExecutionContext (), node, field, value);
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1167
1234
|
/*
|
|
1168
1235
|
* Change field value.
|
|
1169
1236
|
*/
|
|
@@ -1452,14 +1519,13 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1452
1519
|
const
|
|
1453
1520
|
element = $(event .currentTarget) .closest (".field", this .sceneGraph),
|
|
1454
1521
|
node = this .getNode (element),
|
|
1455
|
-
field = this .getField (element)
|
|
1522
|
+
field = this .getField (element);
|
|
1456
1523
|
|
|
1457
|
-
|
|
1458
|
-
event .
|
|
1459
|
-
event .stopImmediatePropagation ()
|
|
1524
|
+
event .preventDefault ();
|
|
1525
|
+
event .stopImmediatePropagation ();
|
|
1460
1526
|
|
|
1461
1527
|
if (!this .isEditable (element .parent ()))
|
|
1462
|
-
return
|
|
1528
|
+
return;
|
|
1463
1529
|
|
|
1464
1530
|
if (event .ctrlKey || event .metaKey)
|
|
1465
1531
|
{
|
|
@@ -1467,7 +1533,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1467
1533
|
{
|
|
1468
1534
|
case "input":
|
|
1469
1535
|
{
|
|
1470
|
-
const routes = field .getInputRoutes ()
|
|
1536
|
+
const routes = field .getInputRoutes ();
|
|
1471
1537
|
|
|
1472
1538
|
switch (routes .size)
|
|
1473
1539
|
{
|
|
@@ -1481,16 +1547,16 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1481
1547
|
{
|
|
1482
1548
|
// Delete route.
|
|
1483
1549
|
|
|
1484
|
-
Editor .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField)
|
|
1550
|
+
Editor .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField);
|
|
1485
1551
|
}
|
|
1486
1552
|
|
|
1487
|
-
break
|
|
1553
|
+
break;
|
|
1488
1554
|
}
|
|
1489
1555
|
default:
|
|
1490
1556
|
{
|
|
1491
|
-
element .data ("full-expanded", true)
|
|
1492
|
-
element .jstree ("open_node", element)
|
|
1493
|
-
break
|
|
1557
|
+
element .data ("full-expanded", true);
|
|
1558
|
+
element .jstree ("open_node", element);
|
|
1559
|
+
break;
|
|
1494
1560
|
}
|
|
1495
1561
|
}
|
|
1496
1562
|
|
|
@@ -1498,7 +1564,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1498
1564
|
}
|
|
1499
1565
|
case "output":
|
|
1500
1566
|
{
|
|
1501
|
-
const routes = field .getOutputRoutes ()
|
|
1567
|
+
const routes = field .getOutputRoutes ();
|
|
1502
1568
|
|
|
1503
1569
|
switch (routes .size)
|
|
1504
1570
|
{
|
|
@@ -1512,20 +1578,20 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1512
1578
|
{
|
|
1513
1579
|
// Delete route.
|
|
1514
1580
|
|
|
1515
|
-
Editor .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField)
|
|
1581
|
+
Editor .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField);
|
|
1516
1582
|
}
|
|
1517
1583
|
|
|
1518
|
-
break
|
|
1584
|
+
break;
|
|
1519
1585
|
}
|
|
1520
1586
|
default:
|
|
1521
1587
|
{
|
|
1522
|
-
element .data ("full-expanded", true)
|
|
1523
|
-
element .jstree ("open_node", element)
|
|
1524
|
-
break
|
|
1588
|
+
element .data ("full-expanded", true);
|
|
1589
|
+
element .jstree ("open_node", element);
|
|
1590
|
+
break;
|
|
1525
1591
|
}
|
|
1526
1592
|
}
|
|
1527
1593
|
|
|
1528
|
-
break
|
|
1594
|
+
break;
|
|
1529
1595
|
}
|
|
1530
1596
|
}
|
|
1531
1597
|
}
|
|
@@ -1533,7 +1599,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1533
1599
|
{
|
|
1534
1600
|
const
|
|
1535
1601
|
sceneElement = element .closest (".scene", this .sceneGraph),
|
|
1536
|
-
executionContext = this .getNode (sceneElement)
|
|
1602
|
+
executionContext = this .getNode (sceneElement);
|
|
1537
1603
|
|
|
1538
1604
|
switch (type)
|
|
1539
1605
|
{
|
|
@@ -1542,29 +1608,32 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1542
1608
|
if (this .connector)
|
|
1543
1609
|
{
|
|
1544
1610
|
if (this .connector .type === type)
|
|
1545
|
-
break
|
|
1611
|
+
break;
|
|
1546
1612
|
|
|
1547
1613
|
if (this .connector .executionContext !== executionContext)
|
|
1548
|
-
break
|
|
1614
|
+
break;
|
|
1549
1615
|
|
|
1550
1616
|
if (this .connector .field .getType () !== field .getType ())
|
|
1551
|
-
break
|
|
1617
|
+
break;
|
|
1618
|
+
|
|
1619
|
+
if (this .connector .node .getField (this .connector .field .getName ()) .getFieldInterests () .has (node .getField (field .getName ())))
|
|
1620
|
+
break;
|
|
1552
1621
|
|
|
1553
1622
|
// Add route.
|
|
1554
1623
|
|
|
1555
|
-
Editor .addRoute (executionContext, this .connector .node, this .connector .field .getName (), node, field .getName ())
|
|
1624
|
+
Editor .addRoute (executionContext, this .connector .node, this .connector .field .getName (), node, field .getName ());
|
|
1556
1625
|
|
|
1557
1626
|
if (event .shiftKey)
|
|
1558
|
-
break
|
|
1627
|
+
break;
|
|
1559
1628
|
|
|
1560
1629
|
this .connector .element .find (".access-type img.active.output.activated")
|
|
1561
|
-
.removeClass ("activated")
|
|
1630
|
+
.removeClass ("activated");
|
|
1562
1631
|
|
|
1563
|
-
delete this .connector
|
|
1632
|
+
delete this .connector;
|
|
1564
1633
|
}
|
|
1565
1634
|
else
|
|
1566
1635
|
{
|
|
1567
|
-
this .connector = { type
|
|
1636
|
+
this .connector = { type, executionContext, node, field, element };
|
|
1568
1637
|
}
|
|
1569
1638
|
|
|
1570
1639
|
break
|
|
@@ -1574,32 +1643,35 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1574
1643
|
if (this .connector)
|
|
1575
1644
|
{
|
|
1576
1645
|
if (this .connector .type === type)
|
|
1577
|
-
break
|
|
1646
|
+
break;
|
|
1578
1647
|
|
|
1579
1648
|
if (this .connector .executionContext !== executionContext)
|
|
1580
|
-
break
|
|
1649
|
+
break;
|
|
1581
1650
|
|
|
1582
1651
|
if (this .connector .field .getType () !== field .getType ())
|
|
1583
|
-
break
|
|
1652
|
+
break;
|
|
1653
|
+
|
|
1654
|
+
if (node .getField (field .getName ()) .getFieldInterests () .has (this .connector .node .getField (this .connector .field .getName ())))
|
|
1655
|
+
break;
|
|
1584
1656
|
|
|
1585
1657
|
// Add route.
|
|
1586
1658
|
|
|
1587
|
-
Editor .addRoute (executionContext, node, field .getName (), this .connector .node, this .connector .field .getName ())
|
|
1659
|
+
Editor .addRoute (executionContext, node, field .getName (), this .connector .node, this .connector .field .getName ());
|
|
1588
1660
|
|
|
1589
1661
|
if (event .shiftKey)
|
|
1590
|
-
break
|
|
1662
|
+
break;
|
|
1591
1663
|
|
|
1592
1664
|
this .connector .element .find (".access-type img.active.input.activated")
|
|
1593
|
-
.removeClass ("activated")
|
|
1665
|
+
.removeClass ("activated");
|
|
1594
1666
|
|
|
1595
|
-
delete this .connector
|
|
1667
|
+
delete this .connector;
|
|
1596
1668
|
}
|
|
1597
1669
|
else
|
|
1598
1670
|
{
|
|
1599
|
-
this .connector = { type
|
|
1671
|
+
this .connector = { type, executionContext, node, field, element };
|
|
1600
1672
|
}
|
|
1601
1673
|
|
|
1602
|
-
break
|
|
1674
|
+
break;
|
|
1603
1675
|
}
|
|
1604
1676
|
}
|
|
1605
1677
|
}
|
|
@@ -1611,19 +1683,18 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1611
1683
|
|
|
1612
1684
|
const
|
|
1613
1685
|
element = $(event .currentTarget) .closest (".route", this .sceneGraph),
|
|
1614
|
-
field = this .getField (element)
|
|
1686
|
+
field = this .getField (element);
|
|
1615
1687
|
|
|
1616
|
-
|
|
1617
|
-
event .
|
|
1618
|
-
event .stopImmediatePropagation ()
|
|
1688
|
+
event .preventDefault ();
|
|
1689
|
+
event .stopImmediatePropagation ();
|
|
1619
1690
|
|
|
1620
1691
|
if (!this .isEditable (element .parent ()))
|
|
1621
|
-
return
|
|
1692
|
+
return;
|
|
1622
1693
|
|
|
1623
1694
|
if (!(event .ctrlKey || event .metaKey))
|
|
1624
|
-
return
|
|
1695
|
+
return;
|
|
1625
1696
|
|
|
1626
|
-
element .hide ()
|
|
1697
|
+
element .hide ();
|
|
1627
1698
|
|
|
1628
1699
|
switch (type)
|
|
1629
1700
|
{
|
|
@@ -1631,15 +1702,15 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1631
1702
|
{
|
|
1632
1703
|
const route = this .getRoute (element, field .getInputRoutes ())
|
|
1633
1704
|
|
|
1634
|
-
Editor .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField)
|
|
1635
|
-
break
|
|
1705
|
+
Editor .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField);
|
|
1706
|
+
break;
|
|
1636
1707
|
}
|
|
1637
1708
|
case "output":
|
|
1638
1709
|
{
|
|
1639
|
-
const route = this .getRoute (element, field .getOutputRoutes ())
|
|
1710
|
+
const route = this .getRoute (element, field .getOutputRoutes ());
|
|
1640
1711
|
|
|
1641
|
-
Editor .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField)
|
|
1642
|
-
break
|
|
1712
|
+
Editor .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField);
|
|
1713
|
+
break;
|
|
1643
1714
|
}
|
|
1644
1715
|
}
|
|
1645
1716
|
}
|
|
@@ -1654,11 +1725,11 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1654
1725
|
element = $(event .target) .closest (".externproto", this .sceneGraph),
|
|
1655
1726
|
selected = this .sceneGraph .find (".externproto.selected"),
|
|
1656
1727
|
selection = selected .filter (element) .length ? selected : element,
|
|
1657
|
-
ids = selection .map (function () { return this .id }) .get ()
|
|
1728
|
+
ids = selection .map (function () { return this .id }) .get ();
|
|
1658
1729
|
|
|
1659
|
-
this .selectPrimaryElement (element)
|
|
1730
|
+
this .selectPrimaryElement (element);
|
|
1660
1731
|
|
|
1661
|
-
event .originalEvent .dataTransfer .setData ("sunrize/externproto", ids .join (","))
|
|
1732
|
+
event .originalEvent .dataTransfer .setData ("sunrize/externproto", ids .join (","));
|
|
1662
1733
|
}
|
|
1663
1734
|
|
|
1664
1735
|
onDragStartProto (event)
|
|
@@ -1667,11 +1738,11 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1667
1738
|
element = $(event .target) .closest (".proto", this .sceneGraph),
|
|
1668
1739
|
selected = this .sceneGraph .find (".proto.selected"),
|
|
1669
1740
|
selection = selected .filter (element) .length ? selected : element,
|
|
1670
|
-
ids = selection .map (function () { return this .id }) .get ()
|
|
1741
|
+
ids = selection .map (function () { return this .id }) .get ();
|
|
1671
1742
|
|
|
1672
|
-
this .selectPrimaryElement (element)
|
|
1743
|
+
this .selectPrimaryElement (element);
|
|
1673
1744
|
|
|
1674
|
-
event .originalEvent .dataTransfer .setData ("sunrize/proto", ids .join (","))
|
|
1745
|
+
event .originalEvent .dataTransfer .setData ("sunrize/proto", ids .join (","));
|
|
1675
1746
|
}
|
|
1676
1747
|
|
|
1677
1748
|
onDragStartNode (event)
|
|
@@ -1680,11 +1751,11 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1680
1751
|
element = $(event .target) .closest (".node", this .sceneGraph),
|
|
1681
1752
|
selected = this .sceneGraph .find (".node.manually.selected"),
|
|
1682
1753
|
selection = selected .filter (element) .length ? selected : element,
|
|
1683
|
-
ids = selection .map (function () { return this .id }) .get ()
|
|
1754
|
+
ids = selection .map (function () { return this .id }) .get ();
|
|
1684
1755
|
|
|
1685
|
-
this .selectPrimaryElement (element)
|
|
1756
|
+
this .selectPrimaryElement (element);
|
|
1686
1757
|
|
|
1687
|
-
event .originalEvent .dataTransfer .setData ("sunrize/nodes", ids .join (","))
|
|
1758
|
+
event .originalEvent .dataTransfer .setData ("sunrize/nodes", ids .join (","));
|
|
1688
1759
|
}
|
|
1689
1760
|
|
|
1690
1761
|
onDragStartField (event)
|
|
@@ -1933,16 +2004,16 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1933
2004
|
|
|
1934
2005
|
onDragLeave (event)
|
|
1935
2006
|
{
|
|
1936
|
-
event .preventDefault ()
|
|
1937
|
-
event .stopPropagation ()
|
|
2007
|
+
event .preventDefault ();
|
|
2008
|
+
event .stopPropagation ();
|
|
1938
2009
|
|
|
1939
2010
|
// Hide drop indicator.
|
|
1940
2011
|
|
|
1941
2012
|
const element = $(event .target)
|
|
1942
|
-
.closest ("li, .scene-graph", this .sceneGraph)
|
|
2013
|
+
.closest ("li, .scene-graph", this .sceneGraph);
|
|
1943
2014
|
|
|
1944
2015
|
element .find ("> .item") .addBack ()
|
|
1945
|
-
.removeClass (["drag-before", "drag-into", "drag-after"])
|
|
2016
|
+
.removeClass (["drag-before", "drag-into", "drag-after"]);
|
|
1946
2017
|
}
|
|
1947
2018
|
|
|
1948
2019
|
async onDrop (event)
|