sunrize 1.5.5 → 1.5.6

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.
Files changed (36) hide show
  1. package/package.json +11 -11
  2. package/src/Application/ActionKeys.js +15 -4
  3. package/src/Application/Application.js +51 -6
  4. package/src/Application/Dashboard.js +25 -34
  5. package/src/Application/Document.js +310 -110
  6. package/src/Application/Interface.js +5 -0
  7. package/src/Application/Tabs.js +24 -14
  8. package/src/Application/Traverse.js +91 -90
  9. package/src/Editors/Library.js +18 -2
  10. package/src/Editors/OutlineEditor.js +18 -5
  11. package/src/Editors/OutlineView.js +6 -6
  12. package/src/Editors/Panel.js +4 -0
  13. package/src/Tools/Core/X3DNodeTool.js +43 -13
  14. package/src/Tools/Grids/AngleGridTool.js +79 -0
  15. package/src/Tools/{Grid → Grids}/AngleGridTool.x3d +5 -3
  16. package/src/Tools/Grids/AxonometricGridTool.js +107 -0
  17. package/src/Tools/{Grid → Grids}/AxonometricGridTool.x3d +7 -5
  18. package/src/Tools/Grids/Barycentric.js +86 -0
  19. package/src/Tools/Grids/GridTool.js +68 -0
  20. package/src/Tools/{Grid → Grids}/GridTool.x3d +5 -3
  21. package/src/Tools/Grids/X3DGridNodeTool.js +503 -0
  22. package/src/Tools/Grouping/X3DTransformNodeTool.js +12 -6
  23. package/src/Tools/Grouping/X3DTransformNodeTool.x3d +144 -5
  24. package/src/Tools/Layering/X3DActiveLayerNodeTool.js +34 -23
  25. package/src/Tools/SnapTool/SnapSourceTool.js +24 -0
  26. package/src/Tools/SnapTool/SnapTargetTool.js +20 -0
  27. package/src/Tools/SnapTool/SnapTool.x3d +156 -0
  28. package/src/Tools/SnapTool/X3DSnapNodeTool.js +123 -0
  29. package/src/Undo/Editor.js +311 -4
  30. package/src/Tools/Grid/AngleGridTool.js +0 -23
  31. package/src/Tools/Grid/AxonometricGridTool.js +0 -25
  32. package/src/Tools/Grid/GridTool.js +0 -23
  33. package/src/Tools/Grid/X3DGridNodeTool.js +0 -20
  34. /package/src/Tools/{Grid → Grids}/AngleGrid.x3d +0 -0
  35. /package/src/Tools/{Grid → Grids}/AxonometricGrid.x3d +0 -0
  36. /package/src/Tools/{Grid → Grids}/Grid.x3d +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sunrize",
3
3
  "productName": "Sunrize X3D Editor",
4
- "version": "1.5.5",
4
+ "version": "1.5.6",
5
5
  "description": "A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -69,19 +69,19 @@
69
69
  }
70
70
  ],
71
71
  "devDependencies": {
72
- "@electron-forge/cli": "^7.2.0",
73
- "@electron-forge/maker-deb": "^7.2.0",
74
- "@electron-forge/maker-dmg": "^7.2.0",
75
- "@electron-forge/maker-rpm": "^7.2.0",
76
- "@electron-forge/maker-squirrel": "^7.2.0",
77
- "@electron-forge/maker-zip": "^7.2.0",
78
- "@electron-forge/publisher-github": "^7.2.0",
72
+ "@electron-forge/cli": "^7.3.0",
73
+ "@electron-forge/maker-deb": "^7.3.0",
74
+ "@electron-forge/maker-dmg": "^7.3.0",
75
+ "@electron-forge/maker-rpm": "^7.3.0",
76
+ "@electron-forge/maker-squirrel": "^7.3.0",
77
+ "@electron-forge/maker-zip": "^7.3.0",
78
+ "@electron-forge/publisher-github": "^7.3.0",
79
79
  "shell-tools": "^1.1.7"
80
80
  },
81
81
  "dependencies": {
82
82
  "capitalize": "^2.0.4",
83
83
  "console": "^0.7.2",
84
- "electron": "^28.2.3",
84
+ "electron": "^29.0.1",
85
85
  "electron-prompt": "^1.7.0",
86
86
  "electron-squirrel-startup": "^1.0.0",
87
87
  "electron-tabs": "^1.0.4",
@@ -90,7 +90,7 @@
90
90
  "jquery-ui-dist": "^1.13.2",
91
91
  "jstree": "^3.3.16",
92
92
  "material-icons": "^1.13.12",
93
- "material-symbols": "^0.14.7",
93
+ "material-symbols": "^0.15.0",
94
94
  "md5": "^2.3.0",
95
95
  "monaco-editor": "^0.46.0",
96
96
  "node-clipboardy": "^1.0.3",
@@ -100,7 +100,7 @@
100
100
  "string-similarity": "^4.0.4",
101
101
  "tweakpane": "^3.1.10",
102
102
  "update-electron-app": "^3.0.0",
103
- "x_ite": "^9.2.6"
103
+ "x_ite": "^9.2.7"
104
104
  },
105
105
  "config": {
106
106
  "forge": {
@@ -4,6 +4,7 @@ const $ = require ("jquery");
4
4
 
5
5
  module .exports = class ActionKeys
6
6
  {
7
+ static None = 0;
7
8
  static Shift = 0b0001;
8
9
  static Control = 0b0010;
9
10
  static Alt = 0b0100;
@@ -17,19 +18,29 @@ module .exports = class ActionKeys
17
18
  this .callback = callback;
18
19
  this .value = 0;
19
20
 
20
- $(window)
21
- .on (`keydown.${id}`, this .onkeydown .bind (this))
22
- .on (`keyup.${id}`, this .onkeyup .bind (this));
21
+ this .connect ();
23
22
  }
24
23
 
25
24
  dispose ()
25
+ {
26
+ this .disconnect ();
27
+ }
28
+
29
+ connect ()
30
+ {
31
+ $(window)
32
+ .on (`keydown.${this .id}`, this .onkeydown .bind (this))
33
+ .on (`keyup.${this .id}`, this .onkeyup .bind (this));
34
+ }
35
+
36
+ disconnect ()
26
37
  {
27
38
  $(window) .off (`.${this .id}`);
28
39
  }
29
40
 
30
41
  onkeydown (event)
31
42
  {
32
- //console .log (event .key)
43
+ // console .log (event .key)
33
44
 
34
45
  const value = this .value;
35
46
 
@@ -87,7 +87,7 @@ module .exports = class Application
87
87
  electron .ipcMain .on ("title", (event, title) => this .title = title);
88
88
  electron .ipcMain .on ("current-file", (event, currentFile) => this .currentFile = currentFile);
89
89
  electron .ipcMain .on ("add-recent-document", (event, filePath) => this .addRecentDocument (filePath));
90
- electron .ipcMain .on ("change-menu", (event, object) => this .updateMenu (object));
90
+ electron .ipcMain .on ("update-menu", (event, object) => this .updateMenu (object));
91
91
  electron .ipcMain .on ("context-menu", (event, id, menu) => this .contextMenu (id, menu));
92
92
 
93
93
  electron .ipcMain .handle ("open-files", async (event, urls) => this .openFiles (urls));
@@ -637,7 +637,6 @@ module .exports = class Application
637
637
  label: _("Grid Layout Tool"),
638
638
  type: "radio",
639
639
  checked: this .menuOptions .GridTool,
640
- visible: process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT",
641
640
  click: () =>
642
641
  {
643
642
  this .mainWindow .webContents .send ("grid-tool", "GridTool", !this .menuOptions .GridTool);
@@ -647,7 +646,6 @@ module .exports = class Application
647
646
  label: _("Angle Grid Layout Tool"),
648
647
  type: "radio",
649
648
  checked: this .menuOptions .AngleGridTool,
650
- visible: process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT",
651
649
  click: () =>
652
650
  {
653
651
  this .mainWindow .webContents .send ("grid-tool", "AngleGridTool", !this .menuOptions .AngleGridTool);
@@ -657,7 +655,6 @@ module .exports = class Application
657
655
  label: _("Axonometric Grid Layout Tool"),
658
656
  type: "radio",
659
657
  checked: this .menuOptions .AxonometricGridTool,
660
- visible: process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT",
661
658
  click: () =>
662
659
  {
663
660
  this .mainWindow .webContents .send ("grid-tool", "AxonometricGridTool", !this .menuOptions .AxonometricGridTool);
@@ -665,15 +662,63 @@ module .exports = class Application
665
662
  },
666
663
  { type: "separator" },
667
664
  {
668
- label: _("Show Grid Tool in Panel..."),
665
+ label: _("Show Grid Tool Options in Panel..."),
669
666
  accelerator: "CmdOrCtrl+G",
670
667
  enabled: this .menuOptions .GridTool || this .menuOptions .AngleGridTool || this .menuOptions .AxonometricGridTool,
671
- visible: process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT",
672
668
  click: () =>
673
669
  {
674
670
  this .mainWindow .webContents .send ("grid-options");
675
671
  },
676
672
  },
673
+ { type: "separator" },
674
+ {
675
+ label: _("Activate Snap Target"),
676
+ type: "checkbox",
677
+ checked: this .menuOptions .SnapTarget,
678
+ visible: process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT",
679
+ click: () =>
680
+ {
681
+ this .mainWindow .webContents .send ("activate-snap-target", !this .menuOptions .SnapTarget);
682
+ },
683
+ },
684
+ {
685
+ label: _("Activate Snap Source"),
686
+ type: "checkbox",
687
+ checked: this .menuOptions .SnapSource,
688
+ visible: process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT",
689
+ click: () =>
690
+ {
691
+ this .mainWindow .webContents .send ("activate-snap-source", !this .menuOptions .SnapSource);
692
+ },
693
+ },
694
+ {
695
+ label: _("Center Snap Target in Selection"),
696
+ visible: process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT",
697
+ click: () =>
698
+ {
699
+ this .mainWindow .webContents .send ("center-snap-target-in-selection");
700
+ },
701
+ },
702
+ {
703
+ label: _("Move Selection to Snap Target"),
704
+ accelerator: "CmdOrCtrl+M",
705
+ enabled: this .menuOptions .SnapTarget,
706
+ visible: process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT",
707
+ click: () =>
708
+ {
709
+ this .mainWindow .webContents .send ("move-selection-to-snap-target");
710
+ },
711
+ },
712
+ {
713
+ label: _("Move Selection Center to Snap Target"),
714
+ accelerator: "Shift+CmdOrCtrl+M",
715
+ enabled: this .menuOptions .SnapTarget,
716
+ visible: process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT",
717
+ click: () =>
718
+ {
719
+ this .mainWindow .webContents .send ("move-selection-center-to-snap-target");
720
+ },
721
+ },
677
722
  ],
678
723
  },
679
724
  {
@@ -4,6 +4,7 @@ const
4
4
  $ = require ("jquery"),
5
5
  X3D = require ("../X3D"),
6
6
  Interface = require ("./Interface"),
7
+ Editor = require("../Undo/Editor"),
7
8
  _ = require ("./GetText");
8
9
 
9
10
  module .exports = class Dashboard extends Interface
@@ -25,10 +26,8 @@ module .exports = class Dashboard extends Interface
25
26
  .appendTo (this .toolbar)
26
27
  .on ("click", () => this .hand ());
27
28
 
28
- this .handButton .addClass ("active");
29
-
30
29
  this .arrowButton = $("<span></span>")
31
- .addClass (["image-icon", "arrow"])
30
+ .addClass (["image-icon", "arrow", "active"])
32
31
  .attr ("title", _("Switch to edit mode."))
33
32
  .appendTo (this .toolbar)
34
33
  .on ("click", () => this .arrow ());
@@ -70,7 +69,7 @@ module .exports = class Dashboard extends Interface
70
69
  configure ()
71
70
  {
72
71
  this .config .file .setDefaultValues ({
73
- pointer: "hand",
72
+ pointer: "arrow",
74
73
  play: false,
75
74
  panel: false,
76
75
  });
@@ -83,26 +82,30 @@ module .exports = class Dashboard extends Interface
83
82
  this .togglePanel (this .config .file .panel);
84
83
  }
85
84
 
86
- hand ()
85
+ arrow ()
87
86
  {
88
- this .config .file .pointer = "hand";
87
+ this .config .file .pointer = "arrow";
89
88
 
90
- if (this .handButton .hasClass ("active"))
89
+ if (this .arrowButton .hasClass ("active"))
91
90
  return;
92
91
 
93
- this .arrowButton .removeClass ("active");
94
- this .handButton .addClass ("active");
92
+ this .handButton .removeClass ("active");
93
+ this .arrowButton .addClass ("active");
94
+
95
+ this .browser .addBrowserEvent ();
95
96
  }
96
97
 
97
- arrow ()
98
+ hand ()
98
99
  {
99
- this .config .file .pointer = "arrow";
100
+ this .config .file .pointer = "hand";
100
101
 
101
- if (this .arrowButton .hasClass ("active"))
102
+ if (this .handButton .hasClass ("active"))
102
103
  return;
103
104
 
104
- this .handButton .removeClass ("active");
105
- this .arrowButton .addClass ("active");
105
+ this .arrowButton .removeClass ("active");
106
+ this .handButton .addClass ("active");
107
+
108
+ this .browser .addBrowserEvent ();
106
109
  }
107
110
 
108
111
  play (value)
@@ -123,31 +126,19 @@ module .exports = class Dashboard extends Interface
123
126
 
124
127
  viewAll ()
125
128
  {
126
- const types = new Set ([X3D .X3DConstants .X3DBoundedObject, X3D .X3DConstants .X3DGeometryNode]);
127
-
128
129
  const
129
- outlineEditor = require ("./Window") .sidebar .outlineEditor,
130
- selection = outlineEditor .sceneGraph .find (".node.selected");
130
+ selection = require ("./Selection"),
131
+ nodes = selection .nodes;
131
132
 
132
- if (selection .length)
133
+ if (nodes .length)
133
134
  {
134
135
  const
135
- layerNode = this .browser .getActiveLayer (),
136
- viewpointNode = this .browser .getActiveViewpoint (),
137
- bbox = new X3D .Box3 (),
138
- straighten = this .browser .getBrowserOption ("StraightenHorizon");
139
-
140
- for (const element of selection)
141
- {
142
- const node = outlineEditor .getNode ($(element)) .getInnerNode ();
143
-
144
- if (!node .getType () .some (type => types .has (type)))
145
- continue;
146
-
147
- const modelMatrix = outlineEditor .getModelMatrix ($(element), false);
136
+ executionContext = this .browser .currentScene,
137
+ layerNode = this .browser .getActiveLayer (),
138
+ viewpointNode = this .browser .getActiveViewpoint (),
139
+ straighten = this .browser .getBrowserOption ("StraightenHorizon");
148
140
 
149
- bbox .add (node .getBBox (new X3D .Box3 ()) .copy () .multRight (modelMatrix));
150
- }
141
+ const [values, bbox] = Editor .getModelMatricesAndBBoxes (executionContext, layerNode, nodes);
151
142
 
152
143
  if (!bbox .size .magnitude ())
153
144
  return;