@shopware-ag/dive 1.6.1 → 1.6.3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/dive",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "Shopware Spatial Framework",
5
5
  "type": "module",
6
6
  "main": "./build/dive.cjs",
@@ -53,7 +53,7 @@ export default class DIVECommunication {
53
53
  private _mediaGenerator: DIVEMediaCreator | null;
54
54
  private get mediaGenerator(): DIVEMediaCreator {
55
55
  if (!this._mediaGenerator) {
56
- const DIVEMediaCreator = require('../mediacreator/MediaCreator.ts').default as typeof import('../mediacreator/MediaCreator.ts').DIVEMediaCreator;
56
+ const DIVEMediaCreator = require('../mediacreator/MediaCreator.ts').DIVEMediaCreator as typeof import('../mediacreator/MediaCreator.ts').DIVEMediaCreator;
57
57
  this._mediaGenerator = new DIVEMediaCreator(this.renderer, this.scene, this.controller);
58
58
  }
59
59
  return this._mediaGenerator;
@@ -166,6 +166,10 @@ export default class DIVECommunication {
166
166
  returnValue = this.setGizmoVisibility(payload as Actions['SET_GIZMO_VISIBILITY']['PAYLOAD']);
167
167
  break;
168
168
  }
169
+ case 'USE_TOOL': {
170
+ returnValue = this.useTool(payload as Actions['USE_TOOL']['PAYLOAD']);
171
+ break;
172
+ }
169
173
  case 'MODEL_LOADED': {
170
174
  returnValue = this.modelLoaded(payload as Actions['MODEL_LOADED']['PAYLOAD']);
171
175
  break;
@@ -420,6 +424,11 @@ export default class DIVECommunication {
420
424
  return payload;
421
425
  }
422
426
 
427
+ private useTool(payload: Actions['USE_TOOL']['PAYLOAD']): Actions['USE_TOOL']['RETURN'] {
428
+ this.toolbox.UseTool(payload.tool);
429
+ return true;
430
+ }
431
+
423
432
  private modelLoaded(payload: Actions['MODEL_LOADED']['PAYLOAD']): Actions['MODEL_LOADED']['RETURN'] {
424
433
  (this.registered.get(payload.id) as COMModel).loaded = true;
425
434
  return true;
@@ -28,7 +28,6 @@ import type DIVEOrbitControls from '../../controls/OrbitControls';
28
28
  import { type DIVERenderer } from '../../renderer/Renderer';
29
29
  import { type COMLight, type COMModel, type COMPov } from '../types';
30
30
  import { type Object3D } from 'three';
31
- import { DIVESelectTool, isSelectTool } from '../../toolbox/select/SelectTool';
32
31
 
33
32
  jest.mock('three/src/math/MathUtils', () => {
34
33
  return {
@@ -38,7 +37,7 @@ jest.mock('three/src/math/MathUtils', () => {
38
37
 
39
38
  jest.mock('../../mediacreator/MediaCreator', () => {
40
39
  return {
41
- default: jest.fn(function () {
40
+ DIVEMediaCreator: jest.fn(function () {
42
41
  this.GenerateMedia = jest.fn();
43
42
 
44
43
  return this;
@@ -21,6 +21,7 @@ import GET_CAMERA_TRANSFORM from "./camera/getcameratransform.ts";
21
21
  import DROP_IT from "./object/model/dropit.ts";
22
22
  import SET_GIZMO_VISIBILITY from "./toolbox/transform/setgizmovisible.js";
23
23
  import COMPUTE_ENCOMPASSING_VIEW from "./camera/computeencompassingview.ts";
24
+ import USE_TOOL from "./toolbox/usetool.ts";
24
25
 
25
26
  export type Actions = {
26
27
  GET_ALL_SCENE_DATA: GET_ALL_SCENE_DATA,
@@ -43,6 +44,7 @@ export type Actions = {
43
44
  ZOOM_CAMERA: ZOOM_CAMERA,
44
45
  SET_GIZMO_MODE: SET_GIZMO_MODE,
45
46
  SET_GIZMO_VISIBILITY: SET_GIZMO_VISIBILITY,
47
+ USE_TOOL: USE_TOOL,
46
48
  MODEL_LOADED: MODEL_LOADED,
47
49
  UPDATE_SCENE: UPDATE_SCENE,
48
50
  GENERATE_MEDIA: GENERATE_MEDIA,
@@ -0,0 +1,6 @@
1
+ import { type ToolType } from "../../../toolbox/Toolbox";
2
+
3
+ export default interface USE_TOOL {
4
+ 'PAYLOAD': { tool: ToolType },
5
+ 'RETURN': boolean,
6
+ }