sunrize 2.4.0 → 2.5.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/package.json +7 -7
- package/src/Application/Application.js +21 -2
- package/src/Application/Dashboard.js +21 -19
- package/src/Application/DataStorage.js +10 -37
- package/src/Application/Document.js +149 -22
- package/src/Application/Footer.js +62 -16
- package/src/Application/Hierarchy.js +1 -1
- package/src/Application/Interface.js +1 -1
- package/src/Application/Sidebar.js +12 -9
- package/src/Application/Tabs.js +79 -11
- package/src/Controls/Splitter.js +146 -19
- package/src/Controls/Tabs.js +17 -12
- package/src/Editors/AnimationEditor.js +203 -194
- package/src/Editors/AnimationMemberList.js +37 -6
- package/src/Editors/BrowserFrame.js +17 -10
- package/src/Editors/Console.js +9 -13
- package/src/Editors/MediaRecorder.js +27 -0
- package/src/Editors/NodeList.js +35 -0
- package/src/Editors/OutlineEditor.js +20 -20
- package/src/Editors/OutlineView.js +85 -61
- package/src/Editors/Panel.js +6 -3
- package/src/Editors/RouteGraph.js +72 -102
- package/src/Editors/SceneProperties.js +4 -4
- package/src/Editors/ScriptEditor.js +37 -23
- package/src/Tools/Core/X3DBaseTool.js +11 -10
- package/src/Tools/Core/X3DImportedNodeInstanceTool.js +52 -0
- package/src/Tools/Core/X3DPrototypeInstanceTool.js +6 -6
- package/src/Tools/Grids/GridTool.js +6 -2
- package/src/Tools/Grids/X3DGridNodeTool.js +1 -1
- package/src/Tools.js +0 -3
- package/src/Undo/Editor.js +19 -16
- package/src/Undo/UndoManager.js +1 -1
- package/src/assets/fonts/Roboto/OFL.txt +93 -0
- package/src/assets/fonts/Roboto/README.txt +118 -0
- package/src/assets/fonts/Roboto/Roboto-Italic-VariableFont_wdth,wght.ttf +0 -0
- package/src/assets/fonts/Roboto/Roboto-VariableFont_wdth,wght.ttf +0 -0
- package/src/assets/fonts/Roboto_Mono/OFL.txt +93 -0
- package/src/assets/fonts/Roboto_Mono/README.txt +77 -0
- package/src/assets/fonts/Roboto_Mono/RobotoMono-Italic-VariableFont_wght.ttf +0 -0
- package/src/assets/fonts/Roboto_Mono/RobotoMono-VariableFont_wght.ttf +0 -0
- package/src/assets/html/application.html +34 -9
- package/src/assets/html/window.html +6 -7
- package/src/assets/themes/default.css +133 -156
- package/src/assets/themes/{system-colors.css → definitions.css} +50 -7
- package/src/assets/themes/media-template.css +3 -2
- package/src/assets/themes/media.css +3 -2
- package/src/assets/themes/prompt-template.css +4 -1
- package/src/assets/themes/prompt.css +4 -1
- package/src/assets/html/application-template.html +0 -164
- package/src/assets/html/window-template.html +0 -39
|
@@ -58,12 +58,14 @@ module .exports = class RouteGraph extends Interface
|
|
|
58
58
|
.on ("sortupdate", (event, ui) => this .reorderPages (ui .item))
|
|
59
59
|
.appendTo (this .top);
|
|
60
60
|
|
|
61
|
+
// Toolbar
|
|
62
|
+
|
|
61
63
|
this .toolbar = $("<div></div>")
|
|
62
64
|
.addClass (["toolbar", "vertical-toolbar", "secondary-toolbar", "routing-toolbar"])
|
|
63
65
|
.appendTo (this .editor);
|
|
64
66
|
|
|
65
67
|
this .addPageButton = $("<span></span>")
|
|
66
|
-
.addClass ("material-
|
|
68
|
+
.addClass ("material-symbols-outlined")
|
|
67
69
|
.attr ("title", _("Add new logic page."))
|
|
68
70
|
.text ("add")
|
|
69
71
|
.appendTo (this .toolbar)
|
|
@@ -74,7 +76,7 @@ module .exports = class RouteGraph extends Interface
|
|
|
74
76
|
this .snapToGridButton = $("<span></span>")
|
|
75
77
|
.addClass ("material-symbols-outlined")
|
|
76
78
|
.attr ("title", _("Toggle snap to grid."))
|
|
77
|
-
.css (
|
|
79
|
+
.css ("scale", "0.9")
|
|
78
80
|
.text ("grid_4x4")
|
|
79
81
|
.appendTo (this .toolbar)
|
|
80
82
|
.on ("click", () => this .setSnapToGrid (!this .config .global .snapToGrid));
|
|
@@ -84,7 +86,7 @@ module .exports = class RouteGraph extends Interface
|
|
|
84
86
|
this .addConnectedNodesButton = $("<span></span>")
|
|
85
87
|
.addClass ("material-symbols-outlined")
|
|
86
88
|
.attr ("title", _("Toggle add connected nodes."))
|
|
87
|
-
.css (
|
|
89
|
+
.css ("scale", "0.8")
|
|
88
90
|
.text ("hub")
|
|
89
91
|
.appendTo (this .toolbar)
|
|
90
92
|
.on ("click", () => this .setAddConnectedNodes (!this .config .global .addConnectedNodes));
|
|
@@ -92,38 +94,29 @@ module .exports = class RouteGraph extends Interface
|
|
|
92
94
|
$("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
|
|
93
95
|
|
|
94
96
|
this .zoomOutIcon = $("<span></span>")
|
|
95
|
-
.addClass ("material-
|
|
96
|
-
.attr ("title", _("Zoom
|
|
97
|
-
.css ("transform", "scale(1.5)")
|
|
98
|
-
.css ("margin-top", "13px")
|
|
99
|
-
.css ("margin-bottom", "15px")
|
|
97
|
+
.addClass ("material-symbols-outlined")
|
|
98
|
+
.attr ("title", _("Zoom timeline out. (-)"))
|
|
100
99
|
.text ("zoom_out")
|
|
101
100
|
.appendTo (this .toolbar)
|
|
102
101
|
.on ("click", () => this .zoomOut ());
|
|
103
102
|
|
|
104
103
|
this .zoomInIcon = $("<span></span>")
|
|
105
|
-
.addClass ("material-
|
|
106
|
-
.attr ("title", _("Zoom
|
|
107
|
-
.css ("transform", "scale(1.5)")
|
|
108
|
-
.css ("margin-bottom", "15px")
|
|
104
|
+
.addClass ("material-symbols-outlined")
|
|
105
|
+
.attr ("title", _("Zoom timeline in. (+)"))
|
|
109
106
|
.text ("zoom_in")
|
|
110
107
|
.appendTo (this .toolbar)
|
|
111
108
|
.on ("click", () => this .zoomIn ());
|
|
112
109
|
|
|
113
110
|
this .zoomFitIcon = $("<span></span>")
|
|
114
|
-
.addClass ("material-
|
|
115
|
-
.attr ("title", _("Zoom
|
|
116
|
-
.css ("transform", "scale(1.4)")
|
|
117
|
-
.css ("margin-bottom", "15px")
|
|
111
|
+
.addClass ("material-symbols-outlined")
|
|
112
|
+
.attr ("title", _("Zoom timeline to fit in window. (0)"))
|
|
118
113
|
.text ("fit_screen")
|
|
119
114
|
.appendTo (this .toolbar)
|
|
120
115
|
.on ("click", () => this .zoomFit ());
|
|
121
116
|
|
|
122
117
|
this .zoom100Icon = $("<span></span>")
|
|
123
|
-
.addClass ("material-
|
|
124
|
-
.attr ("title", _("Default
|
|
125
|
-
.css ("transform", "scale(1.4)")
|
|
126
|
-
.css ("margin-bottom", "15px")
|
|
118
|
+
.addClass ("material-symbols-outlined")
|
|
119
|
+
.attr ("title", _("Default timeline zoom. (1)"))
|
|
127
120
|
.text ("1x_mobiledata")
|
|
128
121
|
.appendTo (this .toolbar)
|
|
129
122
|
.on ("click", () => this .zoom100 ());
|
|
@@ -332,7 +325,7 @@ module .exports = class RouteGraph extends Interface
|
|
|
332
325
|
.attr ("title", title)
|
|
333
326
|
.text (title))
|
|
334
327
|
.append ($("<span></span>")
|
|
335
|
-
.addClass (["material-
|
|
328
|
+
.addClass (["material-symbols-outlined", "button"])
|
|
336
329
|
.text ("close")
|
|
337
330
|
.on ("click", () => this .closePage (index)))
|
|
338
331
|
.appendTo (this .tabs);
|
|
@@ -496,7 +489,7 @@ module .exports = class RouteGraph extends Interface
|
|
|
496
489
|
{
|
|
497
490
|
path .push (i);
|
|
498
491
|
|
|
499
|
-
this .getPathsFromNode (importedNode .
|
|
492
|
+
this .getPathsFromNode (importedNode .getInstance (), false, ids, path, paths, seen);
|
|
500
493
|
|
|
501
494
|
path .pop ();
|
|
502
495
|
}
|
|
@@ -645,7 +638,7 @@ module .exports = class RouteGraph extends Interface
|
|
|
645
638
|
{
|
|
646
639
|
path .push (i);
|
|
647
640
|
|
|
648
|
-
this .getIdsFromNode (importedNode .
|
|
641
|
+
this .getIdsFromNode (importedNode .getInstance (), false, paths, path, ids, seen);
|
|
649
642
|
|
|
650
643
|
path .pop ();
|
|
651
644
|
}
|
|
@@ -1124,11 +1117,11 @@ module .exports = class RouteGraph extends Interface
|
|
|
1124
1117
|
if (node .getExecutionContext () !== executionContext)
|
|
1125
1118
|
return;
|
|
1126
1119
|
|
|
1127
|
-
this .setNode (node);
|
|
1128
|
-
|
|
1129
1120
|
nodes .add (node);
|
|
1130
1121
|
columns .getOrInsert (index, [ ]) .push (node);
|
|
1131
1122
|
|
|
1123
|
+
this .setNode (node);
|
|
1124
|
+
|
|
1132
1125
|
for (const field of node .getFields ())
|
|
1133
1126
|
{
|
|
1134
1127
|
for (const route of field .getInputRoutes ())
|
|
@@ -1155,7 +1148,7 @@ module .exports = class RouteGraph extends Interface
|
|
|
1155
1148
|
node .getPredefinedFields () .addInterest ("updateNodeElement", this, id);
|
|
1156
1149
|
node .getUserDefinedFields () .addInterest ("updateNodeElement", this, id);
|
|
1157
1150
|
|
|
1158
|
-
if (node instanceof X3D .
|
|
1151
|
+
if (node instanceof X3D .X3DImportedNodeInstance)
|
|
1159
1152
|
{
|
|
1160
1153
|
// These events are connected and must never be removed.
|
|
1161
1154
|
node .getImportedNode () .getInlineNode () .getLoadState () .addInterest ("updateNodeElement", this, id);
|
|
@@ -1181,7 +1174,7 @@ module .exports = class RouteGraph extends Interface
|
|
|
1181
1174
|
if (selected)
|
|
1182
1175
|
element .addClass ("selected");
|
|
1183
1176
|
|
|
1184
|
-
if (node instanceof X3D .
|
|
1177
|
+
if (node instanceof X3D .X3DImportedNodeInstance)
|
|
1185
1178
|
element .addClass ("imported-node");
|
|
1186
1179
|
|
|
1187
1180
|
const header = $("<div></div>")
|
|
@@ -1192,7 +1185,7 @@ module .exports = class RouteGraph extends Interface
|
|
|
1192
1185
|
.addClass ("icon")
|
|
1193
1186
|
.appendTo (header);
|
|
1194
1187
|
|
|
1195
|
-
if (node instanceof X3D .
|
|
1188
|
+
if (node instanceof X3D .X3DImportedNodeInstance)
|
|
1196
1189
|
icon .attr ("src", "../images/OutlineEditor/Node/ImportedNode.svg");
|
|
1197
1190
|
else
|
|
1198
1191
|
icon .attr ("src", "../images/OutlineEditor/Node/X3DBaseNode.svg");
|
|
@@ -1325,10 +1318,10 @@ module .exports = class RouteGraph extends Interface
|
|
|
1325
1318
|
for (const field of node .getFields ())
|
|
1326
1319
|
{
|
|
1327
1320
|
for (const route of field .getInputRoutes ())
|
|
1328
|
-
this .
|
|
1321
|
+
this .removeRouteSelection (route);
|
|
1329
1322
|
|
|
1330
1323
|
for (const route of field .getOutputRoutes ())
|
|
1331
|
-
this .
|
|
1324
|
+
this .removeRouteSelection (route);
|
|
1332
1325
|
}
|
|
1333
1326
|
}
|
|
1334
1327
|
|
|
@@ -1448,35 +1441,7 @@ module .exports = class RouteGraph extends Interface
|
|
|
1448
1441
|
|
|
1449
1442
|
findNode (id, add)
|
|
1450
1443
|
{
|
|
1451
|
-
|
|
1452
|
-
node = this .getNode (id),
|
|
1453
|
-
outlineEditor = this .outlineEditor;
|
|
1454
|
-
|
|
1455
|
-
outlineEditor .expandTo (node, { expandObject: true, expandInlineNodes: true, expandAll: true });
|
|
1456
|
-
|
|
1457
|
-
const elements = Array .from (outlineEditor .sceneGraph .find (`.node[node-id=${id}], .imported-node[node-id=${id}]`));
|
|
1458
|
-
|
|
1459
|
-
if (!elements .length)
|
|
1460
|
-
return;
|
|
1461
|
-
|
|
1462
|
-
for (const [i, element] of elements .entries ())
|
|
1463
|
-
{
|
|
1464
|
-
if ($(element) .is (".node"))
|
|
1465
|
-
outlineEditor .selectNodeElement ($(element), { add: add || i > 0, target: true });
|
|
1466
|
-
|
|
1467
|
-
else if ($(element) .is (".imported-node"))
|
|
1468
|
-
outlineEditor .selectPrimaryElement ($(element), { add: add || i > 0, target: true });
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
// Scroll element into view.
|
|
1472
|
-
// Hide scrollbars during scroll to prevent overlay issue.
|
|
1473
|
-
|
|
1474
|
-
outlineEditor .treeView .css ("overflow", "hidden");
|
|
1475
|
-
|
|
1476
|
-
elements [0] ?.scrollIntoView ({ block: "center", inline: "start", behavior: "smooth" });
|
|
1477
|
-
$(window) .scrollTop (0);
|
|
1478
|
-
|
|
1479
|
-
setTimeout (() => outlineEditor .treeView .css ("overflow", ""), 1000);
|
|
1444
|
+
this .outlineEditor .findNode (this .getNode (id), add);
|
|
1480
1445
|
}
|
|
1481
1446
|
|
|
1482
1447
|
selectNode (event, id)
|
|
@@ -1580,7 +1545,7 @@ module .exports = class RouteGraph extends Interface
|
|
|
1580
1545
|
node = this .getNode (id),
|
|
1581
1546
|
executionContext = node .getExecutionContext ();
|
|
1582
1547
|
|
|
1583
|
-
if (executionContext .importedNodes .find (importedNode => importedNode .
|
|
1548
|
+
if (executionContext .importedNodes .find (importedNode => importedNode .getInstance () === node))
|
|
1584
1549
|
continue;
|
|
1585
1550
|
|
|
1586
1551
|
this .removeNode (id);
|
|
@@ -1872,20 +1837,24 @@ module .exports = class RouteGraph extends Interface
|
|
|
1872
1837
|
}
|
|
1873
1838
|
|
|
1874
1839
|
#pointer = new X3D .Vector2 ();
|
|
1840
|
+
#pointerState = false;
|
|
1875
1841
|
|
|
1876
1842
|
mouseMove (event)
|
|
1877
1843
|
{
|
|
1878
1844
|
this .#pointer = this .getRelativePosition (event, false);
|
|
1879
1845
|
|
|
1880
|
-
|
|
1881
|
-
this .updateCanvas ();
|
|
1882
|
-
}
|
|
1846
|
+
const state = this .#input || this .#output || this .findRoute (event);
|
|
1883
1847
|
|
|
1884
|
-
|
|
1885
|
-
{
|
|
1886
|
-
if (event .button !== 0)
|
|
1848
|
+
if (!(state || this .#pointerState))
|
|
1887
1849
|
return;
|
|
1888
1850
|
|
|
1851
|
+
this .#pointerState = state;
|
|
1852
|
+
|
|
1853
|
+
this .updateCanvas ();
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
findRoute (event)
|
|
1857
|
+
{
|
|
1889
1858
|
const
|
|
1890
1859
|
page = this .page,
|
|
1891
1860
|
scale = page .scale,
|
|
@@ -1932,39 +1901,48 @@ module .exports = class RouteGraph extends Interface
|
|
|
1932
1901
|
arrow = this .getRouteArrow (new X3D .Vector2 (x0, y0), new X3D .Vector2 (x3, y3), arrowRotation, scale);
|
|
1933
1902
|
|
|
1934
1903
|
if (X3D .Triangle2 .isPointInTriangle (pointer, ... arrow))
|
|
1935
|
-
|
|
1936
|
-
if (deleteRoute)
|
|
1937
|
-
{
|
|
1938
|
-
Editor .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField);
|
|
1939
|
-
|
|
1940
|
-
this .removeRouteSelection (route);
|
|
1941
|
-
}
|
|
1942
|
-
else
|
|
1943
|
-
{
|
|
1944
|
-
if (event .shiftKey)
|
|
1945
|
-
{
|
|
1946
|
-
if (this .isRouteSelected (route))
|
|
1947
|
-
this .removeRouteSelection (route);
|
|
1948
|
-
else
|
|
1949
|
-
this .addRouteSelection (route);
|
|
1950
|
-
}
|
|
1951
|
-
else
|
|
1952
|
-
{
|
|
1953
|
-
this .setRouteSelection (route);
|
|
1954
|
-
}
|
|
1955
|
-
}
|
|
1956
|
-
|
|
1957
|
-
// Only select or delete one route.
|
|
1958
|
-
return;
|
|
1959
|
-
}
|
|
1904
|
+
return route;
|
|
1960
1905
|
}
|
|
1961
1906
|
}
|
|
1962
1907
|
}
|
|
1963
1908
|
}
|
|
1964
1909
|
|
|
1910
|
+
selectRoute (event)
|
|
1911
|
+
{
|
|
1912
|
+
if (event .button !== 0)
|
|
1913
|
+
return;
|
|
1914
|
+
|
|
1915
|
+
const route = this .findRoute (event);
|
|
1916
|
+
|
|
1917
|
+
if (!route)
|
|
1918
|
+
return;
|
|
1919
|
+
|
|
1920
|
+
if (event .shiftKey)
|
|
1921
|
+
{
|
|
1922
|
+
if (this .isRouteSelected (route))
|
|
1923
|
+
this .removeRouteSelection (route);
|
|
1924
|
+
else
|
|
1925
|
+
this .addRouteSelection (route);
|
|
1926
|
+
}
|
|
1927
|
+
else
|
|
1928
|
+
{
|
|
1929
|
+
this .setRouteSelection (route);
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1965
1933
|
deleteRoute (event)
|
|
1966
1934
|
{
|
|
1967
|
-
|
|
1935
|
+
if (event .button !== 0)
|
|
1936
|
+
return;
|
|
1937
|
+
|
|
1938
|
+
const route = this .findRoute (event);
|
|
1939
|
+
|
|
1940
|
+
if (!route)
|
|
1941
|
+
return;
|
|
1942
|
+
|
|
1943
|
+
this .removeRouteSelection (route);
|
|
1944
|
+
|
|
1945
|
+
Editor .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField);
|
|
1968
1946
|
}
|
|
1969
1947
|
|
|
1970
1948
|
selectAllRoutes ()
|
|
@@ -1996,7 +1974,7 @@ module .exports = class RouteGraph extends Interface
|
|
|
1996
1974
|
{
|
|
1997
1975
|
UndoManager .shared .beginUndo (_("Delete Selected Routes"));
|
|
1998
1976
|
|
|
1999
|
-
for (const route of this .#selectedRoutes)
|
|
1977
|
+
for (const route of Array .from (this .#selectedRoutes))
|
|
2000
1978
|
{
|
|
2001
1979
|
Editor .deleteRoute (route .getExecutionContext (), route .sourceNode, route .sourceField, route .destinationNode, route .destinationField);
|
|
2002
1980
|
}
|
|
@@ -2230,15 +2208,7 @@ module .exports = class RouteGraph extends Interface
|
|
|
2230
2208
|
{
|
|
2231
2209
|
context .fillStyle = selectedColor;
|
|
2232
2210
|
|
|
2233
|
-
|
|
2234
|
-
? route .getSourceNode () .getName ()
|
|
2235
|
-
: route .getSourceNode () .getImportedName ();
|
|
2236
|
-
|
|
2237
|
-
const destinationNodeName = route .getDestinationNode () instanceof X3D .X3DNode
|
|
2238
|
-
? route .getDestinationNode () .getName ()
|
|
2239
|
-
: route .getDestinationNode () .getImportedName ();
|
|
2240
|
-
|
|
2241
|
-
this .nodes .attr ("title", util .format (_("Route from %s<%s>.%s to %s<%s>.%s"), route .getSourceNode () .getTypeName (), sourceNodeName || _("unnamed"), route .sourceField, route .getDestinationNode () .getTypeName (), destinationNodeName || _("unnamed"), route .destinationField));
|
|
2211
|
+
this .nodes .attr ("title", util .format (_("Route from %s<%s>.%s to %s<%s>.%s"), route .getSourceNode () .getTypeName (), route .getSourceNode () .getName () || _("unnamed"), route .sourceField, route .getDestinationNode () .getTypeName (), route .getDestinationNode () .getName () || _("unnamed"), route .destinationField));
|
|
2242
2212
|
}
|
|
2243
2213
|
|
|
2244
2214
|
context .beginPath ();
|
|
@@ -228,7 +228,7 @@ module .exports = new class SceneProperties extends Dialog
|
|
|
228
228
|
.append ($("<span></span>") .text (_("Key")))
|
|
229
229
|
.append ($("<span></span>")
|
|
230
230
|
.attr ("title", "Sort column alphabetically.")
|
|
231
|
-
.addClass (["material-
|
|
231
|
+
.addClass (["material-symbols-outlined", "sort-key"])
|
|
232
232
|
.addClass (this .config .file .sortMetaData ? ["active"] : [ ])
|
|
233
233
|
.css ("font-size", "inherit")
|
|
234
234
|
.text ("sort_by_alpha"))
|
|
@@ -487,7 +487,7 @@ module .exports = new class SceneProperties extends Dialog
|
|
|
487
487
|
.append ($("<span></span>")
|
|
488
488
|
.attr ("title", _("Drag to move key/value pair."))
|
|
489
489
|
.css ("font-size", "120%")
|
|
490
|
-
.addClass (["material-
|
|
490
|
+
.addClass (["material-symbols-outlined", "button", "drag"])
|
|
491
491
|
.addClass (this .config .file .sortMetaData ? ["disabled"] : [ ])
|
|
492
492
|
.text ("drag_handle")))
|
|
493
493
|
.append ($("<td></td>")
|
|
@@ -508,7 +508,7 @@ module .exports = new class SceneProperties extends Dialog
|
|
|
508
508
|
.append ($("<span></span>")
|
|
509
509
|
.attr ("title", _("Delete key/value pair."))
|
|
510
510
|
.css ("font-size", "120%")
|
|
511
|
-
.addClass (["material-
|
|
511
|
+
.addClass (["material-symbols-outlined", "button"])
|
|
512
512
|
.text ("delete_forever")
|
|
513
513
|
.on ("click", (event) => this .removeMetaData (event, key))));
|
|
514
514
|
|
|
@@ -526,7 +526,7 @@ module .exports = new class SceneProperties extends Dialog
|
|
|
526
526
|
.addClass ("open-link")
|
|
527
527
|
.attr ("title", _("Open link in web browser."))
|
|
528
528
|
.css ("font-size", "120%")
|
|
529
|
-
.addClass (["material-
|
|
529
|
+
.addClass (["material-symbols-outlined", "button"])
|
|
530
530
|
.text ("open_in_new")
|
|
531
531
|
.appendTo (column)
|
|
532
532
|
.on ("click", () => electron .shell .openExternal (match [1]));
|
|
@@ -24,10 +24,14 @@ monacoLoader .require .config ({
|
|
|
24
24
|
|
|
25
25
|
module .exports = class ScriptEditor extends Interface
|
|
26
26
|
{
|
|
27
|
+
maximizeSeparator = false;
|
|
28
|
+
|
|
27
29
|
constructor (element)
|
|
28
30
|
{
|
|
29
31
|
super (`Sunrize.ScriptEditor.${element .attr ("id")}.`);
|
|
30
32
|
|
|
33
|
+
const darwin = process .platform === "darwin";
|
|
34
|
+
|
|
31
35
|
this .scriptEditor = element;
|
|
32
36
|
|
|
33
37
|
this .verticalSplitter = $("<div></div>")
|
|
@@ -36,6 +40,7 @@ module .exports = class ScriptEditor extends Interface
|
|
|
36
40
|
.appendTo (this .scriptEditor);
|
|
37
41
|
|
|
38
42
|
this .verticalSplitterLeft = $("<div></div>")
|
|
43
|
+
.attr ("id", "script-editor-horizontal")
|
|
39
44
|
.addClass ("vertical-splitter-left")
|
|
40
45
|
.css ("width", "30%")
|
|
41
46
|
.appendTo (this .verticalSplitter);
|
|
@@ -47,14 +52,18 @@ module .exports = class ScriptEditor extends Interface
|
|
|
47
52
|
|
|
48
53
|
this .vSplitter = new Splitter (this .verticalSplitter, "vertical");
|
|
49
54
|
|
|
50
|
-
this .
|
|
55
|
+
this .vSplitter .snapToBorder = true;
|
|
56
|
+
|
|
57
|
+
this .vSplitter .handle .on ("position", () => this .splitterPosition ());
|
|
58
|
+
|
|
59
|
+
// Toolbar
|
|
51
60
|
|
|
52
61
|
this .toolbar = $("<div></div>")
|
|
53
62
|
.addClass (["toolbar", "vertical-toolbar", "secondary-toolbar", "script-editor-toolbar"])
|
|
54
63
|
.appendTo (this .scriptEditor);
|
|
55
64
|
|
|
56
65
|
this .toggleSidebarButton = $("<span></span>")
|
|
57
|
-
.addClass (
|
|
66
|
+
.addClass ("material-symbols-outlined")
|
|
58
67
|
.attr ("title", _("Toggle sidebar."))
|
|
59
68
|
.text ("dock_to_right")
|
|
60
69
|
.appendTo (this .toolbar)
|
|
@@ -63,15 +72,18 @@ module .exports = class ScriptEditor extends Interface
|
|
|
63
72
|
$("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
|
|
64
73
|
|
|
65
74
|
this .createButton = $("<span></span>")
|
|
66
|
-
.addClass ("material-
|
|
67
|
-
.attr ("title", _("Create new Script
|
|
75
|
+
.addClass ("material-symbols-outlined")
|
|
76
|
+
.attr ("title", _("Create new Script or ComposedShader node."))
|
|
68
77
|
.text ("add")
|
|
69
78
|
.appendTo (this .toolbar)
|
|
70
79
|
.on ("click", () => this .create ());
|
|
71
80
|
|
|
72
81
|
this .applyButton = $("<span></span>")
|
|
73
|
-
.addClass ("material-
|
|
74
|
-
.
|
|
82
|
+
.addClass ("material-symbols-outlined")
|
|
83
|
+
.css ("scale", "0.8")
|
|
84
|
+
.attr ("title", darwin
|
|
85
|
+
? _("Save source code in url field. (⌘S)")
|
|
86
|
+
: _("Save source code in url field. (Ctrl+S)"))
|
|
75
87
|
.text ("check_circle")
|
|
76
88
|
.appendTo (this .toolbar)
|
|
77
89
|
.on ("click", () => this .apply (true));
|
|
@@ -79,23 +91,26 @@ module .exports = class ScriptEditor extends Interface
|
|
|
79
91
|
$("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
|
|
80
92
|
|
|
81
93
|
this .directOutputButton = $("<span></span>")
|
|
82
|
-
.addClass ("material-
|
|
94
|
+
.addClass ("material-symbols-outlined")
|
|
95
|
+
.css ("scale", "0.8")
|
|
83
96
|
.attr ("title", _("Toggle direct output."))
|
|
84
97
|
.text ("radio_button_checked")
|
|
85
98
|
.appendTo (this .toolbar)
|
|
86
99
|
.on ("click", () => this .toggleDirectOutput ());
|
|
87
100
|
|
|
88
101
|
this .mustEvaluateButton = $("<span></span>")
|
|
89
|
-
.addClass ("material-
|
|
102
|
+
.addClass ("material-symbols-outlined")
|
|
103
|
+
.css ("scale", "0.8")
|
|
90
104
|
.attr ("title", _("Toggle must evaluate."))
|
|
91
105
|
.text ("priority_high")
|
|
92
106
|
.appendTo (this .toolbar)
|
|
93
107
|
.on ("click", () => this .toggleMustEvaluate ());
|
|
94
108
|
|
|
95
109
|
this .shaderTypeButton = $("<span></span>")
|
|
96
|
-
.addClass ("material-
|
|
110
|
+
.addClass ("material-symbols-outlined")
|
|
111
|
+
.css ("scale", "0.9")
|
|
97
112
|
.attr ("title", _("Change shader type."))
|
|
98
|
-
.text ("
|
|
113
|
+
.text ("change_history")
|
|
99
114
|
.appendTo (this .toolbar)
|
|
100
115
|
.on ("click", () => this .changeShaderType ());
|
|
101
116
|
|
|
@@ -843,7 +858,7 @@ module .exports = class ScriptEditor extends Interface
|
|
|
843
858
|
args: ["createScript"],
|
|
844
859
|
},
|
|
845
860
|
{
|
|
846
|
-
label: _("Create New
|
|
861
|
+
label: _("Create New ComposedShader"),
|
|
847
862
|
args: ["createShader"],
|
|
848
863
|
},
|
|
849
864
|
];
|
|
@@ -1035,10 +1050,14 @@ main ()
|
|
|
1035
1050
|
const menu = [
|
|
1036
1051
|
{
|
|
1037
1052
|
label: "VERTEX",
|
|
1053
|
+
type: "radio",
|
|
1054
|
+
checked: !this .node ._type .equals ("FRAGMENT"),
|
|
1038
1055
|
args: ["changeShaderTypeTo", "VERTEX"],
|
|
1039
1056
|
},
|
|
1040
1057
|
{
|
|
1041
1058
|
label: "FRAGMENT",
|
|
1059
|
+
type: "radio",
|
|
1060
|
+
checked: this .node ._type .equals ("FRAGMENT"),
|
|
1042
1061
|
args: ["changeShaderTypeTo", "FRAGMENT"],
|
|
1043
1062
|
},
|
|
1044
1063
|
];
|
|
@@ -1057,35 +1076,30 @@ main ()
|
|
|
1057
1076
|
{
|
|
1058
1077
|
case "VERTEX":
|
|
1059
1078
|
{
|
|
1060
|
-
this .shaderTypeButton .text ("
|
|
1079
|
+
this .shaderTypeButton .text ("change_history");
|
|
1061
1080
|
break;
|
|
1062
1081
|
}
|
|
1063
1082
|
case "FRAGMENT":
|
|
1064
1083
|
{
|
|
1065
|
-
this .shaderTypeButton .text ("
|
|
1084
|
+
this .shaderTypeButton .text ("grain");
|
|
1066
1085
|
break;
|
|
1067
1086
|
}
|
|
1068
1087
|
}
|
|
1069
1088
|
}
|
|
1070
1089
|
|
|
1071
|
-
|
|
1090
|
+
splitterPosition ()
|
|
1072
1091
|
{
|
|
1073
1092
|
if (this .vSplitter .position)
|
|
1074
|
-
this .toggleSidebarButton .addClass ("active");
|
|
1093
|
+
this .toggleSidebarButton .addClass (["active", "fill"]);
|
|
1075
1094
|
else
|
|
1076
|
-
this .toggleSidebarButton .removeClass ("active");
|
|
1095
|
+
this .toggleSidebarButton .removeClass (["active", "fill"]);
|
|
1077
1096
|
}
|
|
1078
1097
|
|
|
1079
1098
|
toggleSidebar ()
|
|
1080
1099
|
{
|
|
1081
1100
|
if (this .vSplitter .position)
|
|
1082
|
-
|
|
1083
|
-
this .config .file .vSplitterPosition = this .vSplitter .position;
|
|
1084
|
-
this .vSplitter .position = 0;
|
|
1085
|
-
}
|
|
1101
|
+
this .vSplitter .toggle ("minimize");
|
|
1086
1102
|
else
|
|
1087
|
-
|
|
1088
|
-
this .vSplitter .position = this .config .file .vSplitterPosition;
|
|
1089
|
-
}
|
|
1103
|
+
this .vSplitter .toggle ("restore");
|
|
1090
1104
|
}
|
|
1091
1105
|
};
|
|
@@ -4,8 +4,8 @@ const handler =
|
|
|
4
4
|
{
|
|
5
5
|
get (target, key)
|
|
6
6
|
{
|
|
7
|
-
if (
|
|
8
|
-
return target
|
|
7
|
+
if (Reflect .has (target, key))
|
|
8
|
+
return Reflect .get (target, key);
|
|
9
9
|
|
|
10
10
|
const property = target .node [key];
|
|
11
11
|
|
|
@@ -16,24 +16,25 @@ const handler =
|
|
|
16
16
|
},
|
|
17
17
|
set (target, key, value)
|
|
18
18
|
{
|
|
19
|
-
if (
|
|
20
|
-
target
|
|
21
|
-
else
|
|
22
|
-
target .node [key] = value;
|
|
19
|
+
if (Reflect .has (target, key))
|
|
20
|
+
return Reflect .set (target, key, value);
|
|
23
21
|
|
|
24
|
-
return
|
|
22
|
+
return Reflect .set (target .node, key, value);
|
|
25
23
|
},
|
|
26
24
|
has (target, key)
|
|
27
25
|
{
|
|
28
|
-
return
|
|
26
|
+
return Reflect .has (target, key)
|
|
27
|
+
|| Reflect .has (target .node, key);
|
|
29
28
|
},
|
|
30
29
|
ownKeys (target)
|
|
31
30
|
{
|
|
32
|
-
return
|
|
31
|
+
return Array .from (new Set (Reflect .ownKeys (target)
|
|
32
|
+
.concat (Reflect .ownKeys (target .node))));
|
|
33
33
|
},
|
|
34
34
|
getOwnPropertyDescriptor (target, key)
|
|
35
35
|
{
|
|
36
|
-
return
|
|
36
|
+
return Reflect .getOwnPropertyDescriptor (target, key)
|
|
37
|
+
?? Reflect .getOwnPropertyDescriptor (target .node, key);
|
|
37
38
|
},
|
|
38
39
|
getPrototypeOf (target)
|
|
39
40
|
{
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const X3DNodeTool = require ("./X3DNodeTool");
|
|
4
|
+
|
|
5
|
+
class X3DImportedNodeInstanceTool extends X3DNodeTool
|
|
6
|
+
{
|
|
7
|
+
#tool;
|
|
8
|
+
|
|
9
|
+
constructor (node)
|
|
10
|
+
{
|
|
11
|
+
super (node);
|
|
12
|
+
|
|
13
|
+
node .typeName_changed .addInterest ("updateTool", this);
|
|
14
|
+
|
|
15
|
+
this .updateTool ();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
updateTool ()
|
|
19
|
+
{
|
|
20
|
+
try
|
|
21
|
+
{
|
|
22
|
+
this .#tool = this .node .getInnerNode () .addTool ();
|
|
23
|
+
|
|
24
|
+
this .#tool .toolPointing = false;
|
|
25
|
+
}
|
|
26
|
+
catch
|
|
27
|
+
{
|
|
28
|
+
this .#tool = null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
disposeTool ()
|
|
33
|
+
{
|
|
34
|
+
try
|
|
35
|
+
{
|
|
36
|
+
this .node .typeName_changed .removeInterest ("updateTool", this);
|
|
37
|
+
|
|
38
|
+
this .node .getInnerNode () .removeTool ();
|
|
39
|
+
}
|
|
40
|
+
catch
|
|
41
|
+
{ }
|
|
42
|
+
|
|
43
|
+
super .disposeTool ();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
getInnerNode ()
|
|
47
|
+
{
|
|
48
|
+
return this .#tool;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module .exports = X3DImportedNodeInstanceTool;
|
|
@@ -10,13 +10,13 @@ class X3DPrototypeInstanceTool extends X3DNodeTool
|
|
|
10
10
|
{
|
|
11
11
|
super (node);
|
|
12
12
|
|
|
13
|
-
node .getProtoNode () ._updateInstances .addInterest ("
|
|
14
|
-
node .getBody ()
|
|
13
|
+
node .getProtoNode () ._updateInstances .addInterest ("updateTool", this);
|
|
14
|
+
node .getBody () .rootNodes .addInterest ("updateTool", this);
|
|
15
15
|
|
|
16
|
-
this .
|
|
16
|
+
this .updateTool ();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
updateTool ()
|
|
20
20
|
{
|
|
21
21
|
try
|
|
22
22
|
{
|
|
@@ -34,8 +34,8 @@ class X3DPrototypeInstanceTool extends X3DNodeTool
|
|
|
34
34
|
{
|
|
35
35
|
try
|
|
36
36
|
{
|
|
37
|
-
this .node .getProtoNode () ._updateInstances .removeInterest ("
|
|
38
|
-
this .node .getBody ()
|
|
37
|
+
this .node .getProtoNode () ._updateInstances .removeInterest ("updateTool", this);
|
|
38
|
+
this .node .getBody () .rootNodes .removeInterest ("updateTool", this);
|
|
39
39
|
|
|
40
40
|
this .node .getInnerNode () .removeTool ();
|
|
41
41
|
}
|
|
@@ -37,11 +37,15 @@ class GridTool extends X3DGridNodeTool
|
|
|
37
37
|
|
|
38
38
|
getSnapPositionWithNormal (position, direction)
|
|
39
39
|
{
|
|
40
|
+
const snapDistance = Math .abs (this .tool .snapDistance);
|
|
41
|
+
|
|
40
42
|
for (let i = 0; i < 3; ++ i)
|
|
41
43
|
{
|
|
42
|
-
const
|
|
44
|
+
const
|
|
45
|
+
translation = this .getSnapPositionWithNormalForAxis (i, position, direction),
|
|
46
|
+
distance = translation .distance (position);
|
|
43
47
|
|
|
44
|
-
if (
|
|
48
|
+
if (distance > snapDistance / 1000 && distance < snapDistance)
|
|
45
49
|
return translation;
|
|
46
50
|
}
|
|
47
51
|
|