sunrize 2.1.11 → 2.1.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sunrize",
3
3
  "productName": "Sunrize X3D Editor",
4
- "version": "2.1.11",
4
+ "version": "2.1.12",
5
5
  "description": "Sunrize — A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -99,7 +99,7 @@
99
99
  "@vscode/codicons": "^0.0.45",
100
100
  "capitalize": "^2.0.4",
101
101
  "console": "^0.7.2",
102
- "electron": "^43.0.0",
102
+ "electron": "^43.1.0",
103
103
  "electron-prompt": "^1.7.0",
104
104
  "electron-squirrel-startup": "^1.0.1",
105
105
  "electron-tabs": "^1.0.4",
@@ -108,7 +108,7 @@
108
108
  "jquery-ui-dist": "^1.13.3",
109
109
  "jstree": "^3.3.17",
110
110
  "material-icons": "^1.13.14",
111
- "material-symbols": "^0.45.5",
111
+ "material-symbols": "^0.45.7",
112
112
  "md5": "^2.3.0",
113
113
  "mime-types": "^3.0.2",
114
114
  "monaco-editor": "^0.55.1",
@@ -118,7 +118,7 @@
118
118
  "string-similarity": "^4.0.4",
119
119
  "tweakpane": "^4.0.5",
120
120
  "update-electron-app": "^3.3.0",
121
- "x_ite": "^15.1.10",
121
+ "x_ite": "^15.1.11",
122
122
  "x_ite-off-parser": "^1.2.4",
123
123
  "x_ite-sog-parser": "^2.0.0",
124
124
  "x_ite-spz-parser": "^2.0.0",
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ const
4
+ Editor = require("../Undo/Editor"),
5
+ UndoManager = require ("../Undo/UndoManager"),
6
+ X3D = require ("../X3D"),
7
+ $ = require ("jquery"),
8
+ _ = require ("../Application/GetText");
9
+
10
+ require ("./Popover");
11
+
12
+ $.fn.setOrientationPopover = function (executionContext, textureProjectorNode)
13
+ {
14
+ // Create content.
15
+
16
+ const content = $("<div></div>");
17
+
18
+ $("<span></span>")
19
+ .text (_("Orientation"))
20
+ .appendTo (content);
21
+
22
+ const orientationInput = $("<input></input>")
23
+ .attr ("placeholder", _("Enter orientation values"))
24
+ .appendTo (content);
25
+
26
+ // Create tooltip.
27
+
28
+ const tooltip = this .popover ({
29
+ content: content,
30
+ extension: {
31
+ wide: true,
32
+ },
33
+ events: {
34
+ show: (event, api) =>
35
+ {
36
+ orientationInput .on ("keydown.setOrientationPopover", event =>
37
+ {
38
+ if (event .key !== "Enter")
39
+ return;
40
+
41
+ event .preventDefault ();
42
+
43
+ const orientation = new X3D .SFRotation ();
44
+
45
+ try
46
+ {
47
+ orientation .fromString (orientationInput .val ());
48
+ }
49
+ catch
50
+ {
51
+ return;
52
+ }
53
+
54
+ api .toggle (false);
55
+
56
+ const
57
+ upVector = orientation .multVec (X3D .SFVec3f .Y_AXIS),
58
+ direction = orientation .multVec (X3D .SFVec3f .NEGATIVE_Z_AXIS);
59
+
60
+ UndoManager .shared .beginUndo (_("Set Orientation of %s"), textureProjectorNode .getTypeName ());
61
+
62
+ Editor .setFieldValue (executionContext, textureProjectorNode, textureProjectorNode ._upVector, upVector);
63
+ Editor .setFieldValue (executionContext, textureProjectorNode, textureProjectorNode ._direction, direction);
64
+
65
+ UndoManager .shared .endUndo ();
66
+ });
67
+
68
+ setTimeout (() => orientationInput .trigger ("select"), 1);
69
+ },
70
+ },
71
+ });
72
+
73
+ return this;
74
+ };
75
+
@@ -409,6 +409,15 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
409
409
 
410
410
  continue;
411
411
  }
412
+ case X3D .X3DConstants .X3DTextureProjectorNode:
413
+ {
414
+ menu .push ({
415
+ label: _("Set Orientation..."),
416
+ args: ["setOrientation", element .attr ("id"), executionContext .getId (), node .getId ()],
417
+ });
418
+
419
+ continue;
420
+ }
412
421
  case X3D .X3DConstants .X3DTransformNode:
413
422
  {
414
423
  menu .push ({
@@ -1344,6 +1353,18 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1344
1353
  UndoManager .shared .endUndo ();
1345
1354
  }
1346
1355
 
1356
+ setOrientation (id, executionContextId, nodeId)
1357
+ {
1358
+ const
1359
+ element = $(`#${id}`),
1360
+ executionContext = this .objects .get (executionContextId),
1361
+ textureProjectorNode = this .objects .get (nodeId);
1362
+
1363
+ require ("../Controls/SetOrientationPopover");
1364
+
1365
+ element .find ("> .item") .setOrientationPopover (executionContext, textureProjectorNode);
1366
+ }
1367
+
1347
1368
  transformToZero (id, executionContextId, nodeId)
1348
1369
  {
1349
1370
  const
@@ -216,20 +216,24 @@ class X3DNodeTool extends X3DBaseTool
216
216
  X3DNodeTool .tools .delete (this);
217
217
  X3DNodeTool .processToolInterests ();
218
218
 
219
- const nodesToDispose = [ ];
219
+ const nodesToDispose = new Set ();
220
220
 
221
221
  for (const tool of this .#tools)
222
222
  {
223
223
  if (!this [tool])
224
224
  continue;
225
225
 
226
- for (const node of Traverse .traverse (this [tool], Traverse .ROOT_NODES | Traverse .INLINE_SCENE | Traverse .PROTOTYPE_INSTANCES))
227
- {
228
- nodesToDispose .push (node instanceof X3D .SFNode ? node .getValue () : node);
229
- }
226
+ for (const node of Traverse .traverse (this [tool], Traverse .ROOT_NODES | Traverse .PROTOTYPE_INSTANCES))
227
+ nodesToDispose .add (node instanceof X3D .SFNode ? node .getValue () : node);
228
+ }
229
+
230
+ for (const externalNode of this .#externalNodes)
231
+ {
232
+ for (const node of Traverse .traverse (externalNode, Traverse .ROOT_NODES | Traverse .PROTOTYPE_INSTANCES))
233
+ nodesToDispose .delete (node instanceof X3D .SFNode ? node .getValue () : node);
230
234
  }
231
235
 
232
- for (const node of nodesToDispose .filter (node => !this .#externalNodes .has (node)))
236
+ for (const node of nodesToDispose)
233
237
  node .dispose ();
234
238
 
235
239
  for (const field of this .#externalNodes .values ())