sunrize 1.8.0 → 1.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sunrize",
3
3
  "productName": "Sunrize X3D Editor",
4
- "version": "1.8.0",
4
+ "version": "1.8.1",
5
5
  "description": "A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -109,7 +109,7 @@
109
109
  "string-similarity": "^4.0.4",
110
110
  "tweakpane": "^3.1.10",
111
111
  "update-electron-app": "^3.1.1",
112
- "x_ite": "^11.5.1",
112
+ "x_ite": "^11.5.2",
113
113
  "x3d-traverse": "^1.0.11"
114
114
  }
115
115
  }
@@ -789,6 +789,10 @@ module .exports = class Application
789
789
  label: _("Center Snap Target in Selection"),
790
790
  click: () => this .mainWindow .webContents .send ("center-snap-target-in-selection"),
791
791
  },
792
+ {
793
+ label: _("Center Snap Source in Selection"),
794
+ click: () => this .mainWindow .webContents .send ("center-snap-source-in-selection"),
795
+ },
792
796
  {
793
797
  label: _("Move Selection to Snap Target"),
794
798
  accelerator: "CmdOrCtrl+M",
@@ -117,6 +117,7 @@ module .exports = class Document extends Interface
117
117
  electron .ipcRenderer .on ("activate-snap-target", (event, visible) => this .activateSnapTarget (visible));
118
118
  electron .ipcRenderer .on ("activate-snap-source", (event, visible) => this .activateSnapSource (visible));
119
119
  electron .ipcRenderer .on ("center-snap-target-in-selection", () => this .centerSnapTargetInSelection ());
120
+ electron .ipcRenderer .on ("center-snap-source-in-selection", () => this .centerSnapSourceInSelection ());
120
121
  electron .ipcRenderer .on ("move-selection-to-snap-target", () => this .moveSelectionToSnapTarget ());
121
122
  electron .ipcRenderer .on ("move-selection-center-to-snap-target", () => this .moveSelectionCenterToSnapTarget ());
122
123
 
@@ -1155,6 +1156,28 @@ Viewpoint {
1155
1156
  UndoManager .shared .endUndo ();
1156
1157
  }
1157
1158
 
1159
+ async centerSnapSourceInSelection ()
1160
+ {
1161
+ this .activateSnapSource (true);
1162
+
1163
+ const
1164
+ selection = require ("./Selection"),
1165
+ source = await this .#snapSource .getToolInstance (),
1166
+ executionContext = this .browser .currentScene,
1167
+ layerNode = this .browser .getActiveLayer (),
1168
+ nodes = selection .nodes,
1169
+ [values, bbox] = Editor .getModelMatricesAndBBoxes (executionContext, layerNode, nodes);
1170
+
1171
+ if (!bbox .size .magnitude ())
1172
+ return;
1173
+
1174
+ UndoManager .shared .beginUndo (_("Center SnapSource in Selection"));
1175
+
1176
+ Editor .setFieldValue (executionContext, source .getValue (), source .position, bbox .center);
1177
+
1178
+ UndoManager .shared .endUndo ();
1179
+ }
1180
+
1158
1181
  async moveSelectionToSnapTarget ()
1159
1182
  {
1160
1183
  const
@@ -105,6 +105,7 @@ module .exports = new class Tabs
105
105
  this .forwardToActiveTab ("activate-snap-target");
106
106
  this .forwardToActiveTab ("activate-snap-source");
107
107
  this .forwardToActiveTab ("center-snap-target-in-selection");
108
+ this .forwardToActiveTab ("center-snap-source-in-selection");
108
109
  this .forwardToActiveTab ("move-selection-to-snap-target");
109
110
  this .forwardToActiveTab ("move-selection-center-to-snap-target");
110
111
 
@@ -2,7 +2,8 @@
2
2
 
3
3
  const
4
4
  X3DSnapNodeTool = require ("./X3DSnapNodeTool"),
5
- ActionKeys = require ("../../Application/ActionKeys");
5
+ ActionKeys = require ("../../Application/ActionKeys"),
6
+ X3D = require ("../../X3D");
6
7
 
7
8
  class SnapSource extends X3DSnapNodeTool
8
9
  {
@@ -12,7 +13,8 @@ class SnapSource extends X3DSnapNodeTool
12
13
  {
13
14
  await super .initializeTool ();
14
15
 
15
- this .tool .type = "SNAP_SOURCE";
16
+ this .tool .normal = new X3D .Vector3 (0, -1, 0);
17
+ this .tool .type = "SNAP_SOURCE";
16
18
  }
17
19
  }
18
20
 
@@ -19,7 +19,7 @@
19
19
  <field accessType='inputOutput' type='SFString' name='type' value='SNAP_TARGET'/>
20
20
  <field accessType='inputOutput' type='SFBool' name='snapToCenter' value='true'/>
21
21
  <field accessType='inputOutput' type='SFVec3f' name='position'/>
22
- <field accessType='inputOutput' type='SFVec3f' name='normal' value='0 0 1'/>
22
+ <field accessType='inputOutput' type='SFVec3f' name='normal' value='0 1 0'/>
23
23
  <field accessType='inputOutput' type='SFBool' name='snapped'/>
24
24
  </ProtoInterface>
25
25
  <ProtoBody>