@shopware-ag/dive 1.18.5 → 1.19.0
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 +8 -0
- package/build/dive.cjs +196 -196
- package/build/dive.cjs.map +1 -1
- package/build/dive.js +9208 -8363
- package/build/dive.js.map +1 -1
- package/build/src/com/actions/index.d.ts +2 -0
- package/build/src/com/actions/renderer/startrender.d.ts +5 -0
- package/build/src/dive.d.ts +1 -0
- package/package.json +1 -1
- package/src/com/Communication.ts +5 -0
- package/src/com/__test__/Communication.test.ts +7 -0
- package/src/com/actions/index.ts +2 -0
- package/src/com/actions/renderer/startrender.ts +5 -0
- package/src/dive.ts +7 -3
- package/src/toolbox/Toolbox.ts +1 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { default as START_RENDER } from './renderer/startrender.ts';
|
|
1
2
|
import { default as SET_BACKGROUND } from './scene/setbackground.ts';
|
|
2
3
|
import { default as RESET_CAMERA } from './camera/resetcamera.ts';
|
|
3
4
|
import { default as SET_CAMERA_LAYER } from './camera/setcameralayer.ts';
|
|
@@ -27,6 +28,7 @@ import { default as SET_PARENT } from './object/setparent.ts';
|
|
|
27
28
|
import { default as EXPORT_SCENE } from './scene/exportscene.ts';
|
|
28
29
|
import { default as LAUNCH_AR } from './scene/launchar.ts';
|
|
29
30
|
export interface Actions {
|
|
31
|
+
START_RENDER: START_RENDER;
|
|
30
32
|
GET_ALL_SCENE_DATA: GET_ALL_SCENE_DATA;
|
|
31
33
|
GET_ALL_OBJECTS: GET_ALL_OBJECTS;
|
|
32
34
|
GET_OBJECTS: GET_OBJECTS;
|
package/build/src/dive.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { DIVECommunication } from './com/Communication.ts';
|
|
|
5
5
|
import { DIVEInfo } from './info/Info.ts';
|
|
6
6
|
export type DIVESettings = {
|
|
7
7
|
autoResize: boolean;
|
|
8
|
+
autoStart: boolean;
|
|
8
9
|
displayAxes: boolean;
|
|
9
10
|
renderer: Partial<DIVERendererSettings>;
|
|
10
11
|
perspectiveCamera: Partial<DIVEPerspectiveCameraSettings>;
|
package/package.json
CHANGED
package/src/com/Communication.ts
CHANGED
|
@@ -120,6 +120,11 @@ export class DIVECommunication {
|
|
|
120
120
|
let returnValue: Actions[Action]['RETURN'] = false;
|
|
121
121
|
|
|
122
122
|
switch (action) {
|
|
123
|
+
case 'START_RENDER': {
|
|
124
|
+
this.renderer.StartRenderer(this.scene, this.controller.object);
|
|
125
|
+
returnValue = true;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
123
128
|
case 'GET_ALL_SCENE_DATA': {
|
|
124
129
|
returnValue = this.getAllSceneData(
|
|
125
130
|
payload as Actions['GET_ALL_SCENE_DATA']['PAYLOAD'],
|
|
@@ -92,6 +92,7 @@ jest.mock('../../toolbox/select/SelectTool', () => {
|
|
|
92
92
|
const mockRenderer = {
|
|
93
93
|
render: jest.fn(),
|
|
94
94
|
OnResize: jest.fn(),
|
|
95
|
+
StartRenderer: jest.fn(),
|
|
95
96
|
} as unknown as DIVERenderer;
|
|
96
97
|
|
|
97
98
|
const mockScene = {
|
|
@@ -288,6 +289,12 @@ describe('dive/communication/DIVECommunication', () => {
|
|
|
288
289
|
).not.toThrow();
|
|
289
290
|
});
|
|
290
291
|
|
|
292
|
+
it('should perform action START_RENDER', () => {
|
|
293
|
+
const success = testCom.PerformAction('START_RENDER');
|
|
294
|
+
expect(mockRenderer.StartRenderer).toHaveBeenCalledTimes(1);
|
|
295
|
+
expect(success).toBe(true);
|
|
296
|
+
});
|
|
297
|
+
|
|
291
298
|
it('should perform action ADD_OBJECT', () => {
|
|
292
299
|
const payload = {
|
|
293
300
|
entityType: 'light',
|
package/src/com/actions/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import START_RENDER from './renderer/startrender.ts';
|
|
1
2
|
import SET_BACKGROUND from './scene/setbackground.ts';
|
|
2
3
|
import RESET_CAMERA from './camera/resetcamera.ts';
|
|
3
4
|
import SET_CAMERA_LAYER from './camera/setcameralayer.ts';
|
|
@@ -28,6 +29,7 @@ import EXPORT_SCENE from './scene/exportscene.ts';
|
|
|
28
29
|
import LAUNCH_AR from './scene/launchar.ts';
|
|
29
30
|
|
|
30
31
|
export interface Actions {
|
|
32
|
+
START_RENDER: START_RENDER;
|
|
31
33
|
GET_ALL_SCENE_DATA: GET_ALL_SCENE_DATA;
|
|
32
34
|
GET_ALL_OBJECTS: GET_ALL_OBJECTS;
|
|
33
35
|
GET_OBJECTS: GET_OBJECTS;
|
package/src/dive.ts
CHANGED
|
@@ -23,6 +23,7 @@ import pkgjson from '../package.json';
|
|
|
23
23
|
|
|
24
24
|
export type DIVESettings = {
|
|
25
25
|
autoResize: boolean;
|
|
26
|
+
autoStart: boolean;
|
|
26
27
|
displayAxes: boolean;
|
|
27
28
|
renderer: Partial<DIVERendererSettings>;
|
|
28
29
|
perspectiveCamera: Partial<DIVEPerspectiveCameraSettings>;
|
|
@@ -31,6 +32,7 @@ export type DIVESettings = {
|
|
|
31
32
|
|
|
32
33
|
export const DIVEDefaultSettings: DIVESettings = {
|
|
33
34
|
autoResize: true,
|
|
35
|
+
autoStart: true,
|
|
34
36
|
displayAxes: false,
|
|
35
37
|
renderer: DIVERendererDefaultSettings,
|
|
36
38
|
perspectiveCamera: DIVEPerspectiveCameraDefaultSettings,
|
|
@@ -266,9 +268,6 @@ export default class DIVE {
|
|
|
266
268
|
this.addResizeObserver();
|
|
267
269
|
}
|
|
268
270
|
|
|
269
|
-
// whene everything is done, start the renderer
|
|
270
|
-
this.renderer.StartRenderer(this.scene, this.perspectiveCamera);
|
|
271
|
-
|
|
272
271
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
273
272
|
(window as any).DIVE = {
|
|
274
273
|
PrintScene: () => {
|
|
@@ -307,6 +306,11 @@ export default class DIVE {
|
|
|
307
306
|
@@@@@@@ @@@@@@
|
|
308
307
|
|
|
309
308
|
`);
|
|
309
|
+
|
|
310
|
+
if (this._settings.autoStart) {
|
|
311
|
+
// when everything is done, start the renderer
|
|
312
|
+
this.renderer.StartRenderer(this.scene, this.perspectiveCamera);
|
|
313
|
+
}
|
|
310
314
|
}
|
|
311
315
|
|
|
312
316
|
public Dispose(): void {
|
package/src/toolbox/Toolbox.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type DIVEOrbitControls from '../controls/OrbitControls.ts';
|
|
2
2
|
import { type DIVEScene } from '../scene/Scene.ts';
|
|
3
3
|
import { type DIVEBaseTool } from './BaseTool.ts';
|
|
4
|
-
import {
|
|
4
|
+
import { DIVESelectTool } from './select/SelectTool.ts';
|
|
5
5
|
|
|
6
6
|
export type ToolType = 'select' | 'none';
|
|
7
7
|
|
|
@@ -22,8 +22,6 @@ export default class DIVEToolbox {
|
|
|
22
22
|
private _selectTool: DIVESelectTool | null;
|
|
23
23
|
public get selectTool(): DIVESelectTool {
|
|
24
24
|
if (!this._selectTool) {
|
|
25
|
-
const DIVESelectTool = require('./select/SelectTool.ts')
|
|
26
|
-
.DIVESelectTool as typeof import('./select/SelectTool.ts').DIVESelectTool;
|
|
27
25
|
this._selectTool = new DIVESelectTool(
|
|
28
26
|
this._scene,
|
|
29
27
|
this._controller,
|