@shopware-ag/dive 1.16.2 → 1.16.4

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/README.md CHANGED
@@ -219,7 +219,7 @@ DIVECommunication class via
219
219
  </tr>
220
220
  <tr>
221
221
  <td>
222
- <a href=".undefined"> ADD_OBJECT </a>
222
+ <a href="src/com/actions/object/addobject.ts"> ADD_OBJECT </a>
223
223
  </td>
224
224
  <td>
225
225
  Adds an object to the scene.
@@ -227,7 +227,7 @@ DIVECommunication class via
227
227
  </tr>
228
228
  <tr>
229
229
  <td>
230
- <a href=".undefined"> COMPUTE_ENCOMPASSING_VIEW </a>
230
+ <a href="src/com/actions/camera/computeencompassingview.ts"> COMPUTE_ENCOMPASSING_VIEW </a>
231
231
  </td>
232
232
  <td>
233
233
  Calculates the camera position and target to view the whole scene. (experimental)
@@ -235,7 +235,7 @@ DIVECommunication class via
235
235
  </tr>
236
236
  <tr>
237
237
  <td>
238
- <a href=".undefined"> DELETE_OBJECT </a>
238
+ <a href="src/com/actions/object/deleteobject.ts"> DELETE_OBJECT </a>
239
239
  </td>
240
240
  <td>
241
241
  Deletes an object from the scene.
@@ -243,7 +243,7 @@ DIVECommunication class via
243
243
  </tr>
244
244
  <tr>
245
245
  <td>
246
- <a href=".undefined"> DESELECT_OBJECT </a>
246
+ <a href="src/com/actions/object/deselectobject.ts"> DESELECT_OBJECT </a>
247
247
  </td>
248
248
  <td>
249
249
  Deselects an existing object.
@@ -251,7 +251,7 @@ DIVECommunication class via
251
251
  </tr>
252
252
  <tr>
253
253
  <td>
254
- <a href=".undefined"> DROP_IT </a>
254
+ <a href="src/com/actions/object/model/dropit.ts"> DROP_IT </a>
255
255
  </td>
256
256
  <td>
257
257
  Places an object on top of an underlying object or the floor.
@@ -259,7 +259,7 @@ DIVECommunication class via
259
259
  </tr>
260
260
  <tr>
261
261
  <td>
262
- <a href=".undefined"> EXPORT_SCENE </a>
262
+ <a href="src/com/actions/scene/exportscene.ts"> EXPORT_SCENE </a>
263
263
  </td>
264
264
  <td>
265
265
  Exports the current scene to a blob and returns the URL.
@@ -267,7 +267,7 @@ DIVECommunication class via
267
267
  </tr>
268
268
  <tr>
269
269
  <td>
270
- <a href=".undefined"> GENERATE_MEDIA </a>
270
+ <a href="src/com/actions/media/generatemedia.ts"> GENERATE_MEDIA </a>
271
271
  </td>
272
272
  <td>
273
273
  Generates a screenshot, stores it in a Blob and writes the URL into the payload.
@@ -275,7 +275,7 @@ DIVECommunication class via
275
275
  </tr>
276
276
  <tr>
277
277
  <td>
278
- <a href=".undefined"> GET_ALL_OBJECTS </a>
278
+ <a href="src/com/actions/object/getallobjects.ts"> GET_ALL_OBJECTS </a>
279
279
  </td>
280
280
  <td>
281
281
  Retrieves all objects in the scene.
@@ -283,7 +283,7 @@ DIVECommunication class via
283
283
  </tr>
284
284
  <tr>
285
285
  <td>
286
- <a href=".undefined"> GET_ALL_SCENE_DATA </a>
286
+ <a href="src/com/actions/scene/getallscenedata.ts"> GET_ALL_SCENE_DATA </a>
287
287
  </td>
288
288
  <td>
289
289
  Retrieves all current scene data.
@@ -291,7 +291,7 @@ DIVECommunication class via
291
291
  </tr>
292
292
  <tr>
293
293
  <td>
294
- <a href=".undefined"> GET_CAMERA_TRANSFORM </a>
294
+ <a href="src/com/actions/camera/getcameratransform.ts"> GET_CAMERA_TRANSFORM </a>
295
295
  </td>
296
296
  <td>
297
297
  Returns the current camera position and target.
@@ -299,7 +299,7 @@ DIVECommunication class via
299
299
  </tr>
300
300
  <tr>
301
301
  <td>
302
- <a href=".undefined"> GET_OBJECTS </a>
302
+ <a href="src/com/actions/object/getobjects.ts"> GET_OBJECTS </a>
303
303
  </td>
304
304
  <td>
305
305
  Returns a list of objects of given IDs.
@@ -307,7 +307,7 @@ DIVECommunication class via
307
307
  </tr>
308
308
  <tr>
309
309
  <td>
310
- <a href=".undefined"> MODEL_LOADED </a>
310
+ <a href="src/com/actions/object/model/modelloaded.ts"> MODEL_LOADED </a>
311
311
  </td>
312
312
  <td>
313
313
  Is triggered when a model is loaded.
@@ -315,7 +315,7 @@ DIVECommunication class via
315
315
  </tr>
316
316
  <tr>
317
317
  <td>
318
- <a href=".undefined"> MOVE_CAMERA </a>
318
+ <a href="src/com/actions/camera/movecamera.ts"> MOVE_CAMERA </a>
319
319
  </td>
320
320
  <td>
321
321
  Moves the camera to a new position and target.
@@ -323,7 +323,7 @@ DIVECommunication class via
323
323
  </tr>
324
324
  <tr>
325
325
  <td>
326
- <a href=".undefined"> PLACE_ON_FLOOR </a>
326
+ <a href="src/com/actions/object/model/placeonfloor.ts"> PLACE_ON_FLOOR </a>
327
327
  </td>
328
328
  <td>
329
329
  Places an object on the floor.
@@ -331,7 +331,7 @@ DIVECommunication class via
331
331
  </tr>
332
332
  <tr>
333
333
  <td>
334
- <a href=".undefined"> RESET_CAMERA </a>
334
+ <a href="src/com/actions/camera/resetcamera.ts"> RESET_CAMERA </a>
335
335
  </td>
336
336
  <td>
337
337
  Reset the camera to its initial position and rotation.
@@ -339,7 +339,7 @@ DIVECommunication class via
339
339
  </tr>
340
340
  <tr>
341
341
  <td>
342
- <a href=".undefined"> SELECT_OBJECT </a>
342
+ <a href="src/com/actions/object/selectobject.ts"> SELECT_OBJECT </a>
343
343
  </td>
344
344
  <td>
345
345
  Selects an existing object.
@@ -347,7 +347,7 @@ DIVECommunication class via
347
347
  </tr>
348
348
  <tr>
349
349
  <td>
350
- <a href=".undefined"> SET_BACKGROUND </a>
350
+ <a href="src/com/actions/scene/setbackground.ts"> SET_BACKGROUND </a>
351
351
  </td>
352
352
  <td>
353
353
  Set the background color of the scene.
@@ -355,7 +355,7 @@ DIVECommunication class via
355
355
  </tr>
356
356
  <tr>
357
357
  <td>
358
- <a href=".undefined"> SET_CAMERA_LAYER </a>
358
+ <a href="src/com/actions/camera/setcameralayer.ts"> SET_CAMERA_LAYER </a>
359
359
  </td>
360
360
  <td>
361
361
  Sets the camera layer to a certain layer.
@@ -363,7 +363,7 @@ DIVECommunication class via
363
363
  </tr>
364
364
  <tr>
365
365
  <td>
366
- <a href=".undefined"> SET_CAMERA_TRANSFORM </a>
366
+ <a href="src/com/actions/camera/setcameratransform.ts"> SET_CAMERA_TRANSFORM </a>
367
367
  </td>
368
368
  <td>
369
369
  Sets the camera position and target.
@@ -371,7 +371,7 @@ DIVECommunication class via
371
371
  </tr>
372
372
  <tr>
373
373
  <td>
374
- <a href=".undefined"> SET_GIZMO_MODE </a>
374
+ <a href="src/com/actions/toolbox/select/setgizmomode.ts"> SET_GIZMO_MODE </a>
375
375
  </td>
376
376
  <td>
377
377
  Sets the gizmo's mode.
@@ -379,7 +379,7 @@ DIVECommunication class via
379
379
  </tr>
380
380
  <tr>
381
381
  <td>
382
- <a href=".undefined"> SET_GIZMO_VISIBILITY </a>
382
+ <a href="src/com/actions/toolbox/transform/setgizmovisible.ts"> SET_GIZMO_VISIBILITY </a>
383
383
  </td>
384
384
  <td>
385
385
  Sets the gizmo's visibility.
@@ -387,7 +387,7 @@ DIVECommunication class via
387
387
  </tr>
388
388
  <tr>
389
389
  <td>
390
- <a href=".undefined"> SET_PARENT </a>
390
+ <a href="src/com/actions/object/setparent.ts"> SET_PARENT </a>
391
391
  </td>
392
392
  <td>
393
393
  Attach an object to another object.
@@ -395,7 +395,7 @@ DIVECommunication class via
395
395
  </tr>
396
396
  <tr>
397
397
  <td>
398
- <a href=".undefined"> UPDATE_OBJECT </a>
398
+ <a href="src/com/actions/object/updateobject.ts"> UPDATE_OBJECT </a>
399
399
  </td>
400
400
  <td>
401
401
  Updates an existing object.
@@ -403,7 +403,7 @@ DIVECommunication class via
403
403
  </tr>
404
404
  <tr>
405
405
  <td>
406
- <a href=".undefined"> UPDATE_SCENE </a>
406
+ <a href="src/com/actions/scene/updatescene.ts"> UPDATE_SCENE </a>
407
407
  </td>
408
408
  <td>
409
409
  Updates global scene data.
@@ -411,7 +411,7 @@ DIVECommunication class via
411
411
  </tr>
412
412
  <tr>
413
413
  <td>
414
- <a href=".undefined"> USE_TOOL </a>
414
+ <a href="src/com/actions/toolbox/usetool.ts"> USE_TOOL </a>
415
415
  </td>
416
416
  <td>
417
417
  Activates a specific tool from the toolbox.
@@ -419,7 +419,7 @@ DIVECommunication class via
419
419
  </tr>
420
420
  <tr>
421
421
  <td>
422
- <a href=".undefined"> ZOOM_CAMERA </a>
422
+ <a href="src/com/actions/camera/zoomcamera.ts"> ZOOM_CAMERA </a>
423
423
  </td>
424
424
  <td>
425
425
  Zooms the camera in or out by a certain amount.
package/build/dive.cjs CHANGED
@@ -147,15 +147,23 @@ var init_BaseTool = __esm({
147
147
  onPointerDown(e) {
148
148
  var _a;
149
149
  switch (e.button) {
150
- case 0:
150
+ case 0: {
151
151
  this._pointerPrimaryDown = true;
152
152
  break;
153
- case 1:
153
+ }
154
+ case 1: {
154
155
  this._pointerMiddleDown = true;
155
156
  break;
156
- case 2:
157
+ }
158
+ case 2: {
157
159
  this._pointerSecondaryDown = true;
158
160
  break;
161
+ }
162
+ default: {
163
+ console.warn(
164
+ "DIVEBaseTool.onPointerDown: Unknown button: " + e.button
165
+ );
166
+ }
159
167
  }
160
168
  this._lastPointerDown.copy(this._pointer);
161
169
  this._draggable = findInterface(
@@ -592,40 +600,32 @@ var init_IO = __esm({
592
600
  this._gltfIO = new DIVEGLTFIO();
593
601
  }
594
602
  Import(type, url) {
595
- return this._importFromURL(type, url).catch((error) => {
596
- console.error(error);
597
- return null;
598
- });
599
- }
600
- Export(type) {
601
- return this._exportToURL(type).catch((error) => {
602
- console.error(error);
603
- return null;
604
- });
605
- }
606
- _importFromURL(type, url) {
607
603
  switch (type) {
608
604
  case "glb": {
609
- return this._gltfIO.Import(url);
605
+ return this._gltfIO.Import(url).catch((error) => {
606
+ console.error(error);
607
+ return null;
608
+ });
610
609
  }
611
610
  default: {
612
- return Promise.reject("Unsupported file type: " + type);
611
+ console.error("DIVEIO.Import: Unsupported file type: " + type);
612
+ return Promise.reject();
613
613
  }
614
614
  }
615
615
  }
616
- _exportToURL(type) {
616
+ Export(type) {
617
617
  switch (type) {
618
618
  case "glb": {
619
- return new Promise((resolve, reject) => {
620
- this._gltfIO.Export(this._scene, true, true).then((data) => {
621
- resolve(this._createBlobURL(data));
622
- }).catch((error) => {
623
- reject(error);
624
- });
619
+ return this._gltfIO.Export(this._scene, true, true).then((data) => {
620
+ return this._createBlobURL(data);
621
+ }).catch((error) => {
622
+ console.error(error);
623
+ return null;
625
624
  });
626
625
  }
627
626
  default: {
628
- return Promise.reject("Unsupported file type: " + type);
627
+ console.error("DIVEIO.Export: Unsupported file type: " + type);
628
+ return Promise.reject();
629
629
  }
630
630
  }
631
631
  }
@@ -1024,6 +1024,11 @@ var _DIVECommunication = class _DIVECommunication {
1024
1024
  );
1025
1025
  break;
1026
1026
  }
1027
+ default: {
1028
+ console.warn(
1029
+ `DIVECommunication.PerformAction: has been executed with unknown Action type ${action}`
1030
+ );
1031
+ }
1027
1032
  }
1028
1033
  this.dispatch(action, payload);
1029
1034
  return returnValue;
@@ -1652,7 +1657,9 @@ var DIVEPrimitive = class extends DIVENode {
1652
1657
  this.add(this._mesh);
1653
1658
  }
1654
1659
  SetGeometry(geometry) {
1655
- this._mesh.geometry = this.assembleGeometry(geometry);
1660
+ const geo = this.assembleGeometry(geometry);
1661
+ if (!geo) return;
1662
+ this._mesh.geometry = geo;
1656
1663
  this._boundingBox.setFromObject(this._mesh);
1657
1664
  }
1658
1665
  SetMaterial(material) {
@@ -1750,6 +1757,7 @@ var DIVEPrimitive = class extends DIVENode {
1750
1757
  return this.createSphereGeometry(geometry);
1751
1758
  case "pyramid":
1752
1759
  return this.createPyramidGeometry(geometry);
1760
+ case "cube":
1753
1761
  case "box":
1754
1762
  return this.createBoxGeometry(geometry);
1755
1763
  case "cone":
@@ -1760,10 +1768,10 @@ var DIVEPrimitive = class extends DIVENode {
1760
1768
  return this.createPlaneGeometry(geometry);
1761
1769
  default: {
1762
1770
  console.warn(
1763
- "DIVEPrimitive: Invalid geometry type:",
1771
+ "DIVEPrimitive.assembleGeometry: Invalid geometry type:",
1764
1772
  geometry.name.toLowerCase()
1765
1773
  );
1766
- return new import_three9.BufferGeometry();
1774
+ return null;
1767
1775
  }
1768
1776
  }
1769
1777
  }
@@ -1996,6 +2004,11 @@ var DIVERoot = class extends import_three11.Object3D {
1996
2004
  this.updateGroup(object);
1997
2005
  break;
1998
2006
  }
2007
+ default: {
2008
+ console.warn(
2009
+ `DIVERoot.AddSceneObject: Unknown entity type: ${object.entityType}`
2010
+ );
2011
+ }
1999
2012
  }
2000
2013
  }
2001
2014
  UpdateSceneObject(object) {
@@ -2019,6 +2032,11 @@ var DIVERoot = class extends import_three11.Object3D {
2019
2032
  this.updateGroup(object);
2020
2033
  break;
2021
2034
  }
2035
+ default: {
2036
+ console.warn(
2037
+ `DIVERoot.UpdateSceneObject: Unknown entity type: ${object.entityType}`
2038
+ );
2039
+ }
2022
2040
  }
2023
2041
  }
2024
2042
  DeleteSceneObject(object) {
@@ -2042,6 +2060,11 @@ var DIVERoot = class extends import_three11.Object3D {
2042
2060
  this.deleteGroup(object);
2043
2061
  break;
2044
2062
  }
2063
+ default: {
2064
+ console.warn(
2065
+ `DIVERoot.DeleteSceneObject: Unknown entity type: ${object.entityType}`
2066
+ );
2067
+ }
2045
2068
  }
2046
2069
  }
2047
2070
  PlaceOnFloor(object) {
@@ -2055,6 +2078,11 @@ var DIVERoot = class extends import_three11.Object3D {
2055
2078
  this.placeOnFloor(object);
2056
2079
  break;
2057
2080
  }
2081
+ default: {
2082
+ console.warn(
2083
+ `DIVERoot.PlaceOnFloor: Unknown entity type: ${object.entityType}`
2084
+ );
2085
+ }
2058
2086
  }
2059
2087
  }
2060
2088
  updateLight(light) {
@@ -2529,7 +2557,7 @@ var DIVEToolbox = class {
2529
2557
  break;
2530
2558
  }
2531
2559
  default: {
2532
- throw new Error(`ToolBox.UseTool: Unknown tool: ${tool}`);
2560
+ console.warn(`DIVEToolBox.UseTool: Unknown tool: ${tool}`);
2533
2561
  }
2534
2562
  }
2535
2563
  }
@@ -2851,7 +2879,7 @@ DIVEInfo._supportsWebXR = null;
2851
2879
  // package.json
2852
2880
  var package_default = {
2853
2881
  name: "@shopware-ag/dive",
2854
- version: "1.16.2",
2882
+ version: "1.16.4",
2855
2883
  description: "Shopware Spatial Framework",
2856
2884
  type: "module",
2857
2885
  main: "./build/dive.cjs",