@shopware-ag/dive
Advanced tools
Comparing version 1.15.5 to 1.16.0
@@ -7,2 +7,3 @@ import { ShadowMapType, ToneMapping, WebGLRenderer, Scene, Camera, PerspectiveCamera, Box3, Vector3Like, Texture, Object3D, Color, Mesh, ColorRepresentation, Intersection, Vector2, Raycaster, Vector3 } from 'three'; | ||
import { TransformControls as TransformControls$2 } from 'three/examples/jsm/Addons'; | ||
import { GLTF as GLTF$1 } from 'three/examples/jsm/loaders/GLTFLoader'; | ||
@@ -570,2 +571,6 @@ type DIVERendererSettings = { | ||
type DIVESceneFileType = { | ||
'glb': GLTF$1; | ||
}; | ||
/** | ||
@@ -814,2 +819,9 @@ * A basic scene node to hold grid, floor and all lower level roots. | ||
interface EXPORT_SCENE { | ||
'PAYLOAD': { | ||
type: keyof DIVESceneFileType; | ||
}; | ||
'RETURN': Promise<string | null>; | ||
} | ||
type Actions = { | ||
@@ -841,2 +853,3 @@ GET_ALL_SCENE_DATA: GET_ALL_SCENE_DATA; | ||
SET_PARENT: SET_PARENT; | ||
EXPORT_SCENE: EXPORT_SCENE; | ||
}; | ||
@@ -876,2 +889,4 @@ | ||
private get mediaGenerator(); | ||
private _io; | ||
private get io(); | ||
private registered; | ||
@@ -909,2 +924,3 @@ private listeners; | ||
private setParent; | ||
private exportScene; | ||
} | ||
@@ -911,0 +927,0 @@ |
{ | ||
"name": "@shopware-ag/dive", | ||
"version": "1.15.5", | ||
"version": "1.16.0", | ||
"description": "Shopware Spatial Framework", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -47,2 +47,12 @@ import { DIVECommunication } from '../Communication'; | ||
jest.mock('../../io/IO', () => { | ||
return { | ||
DIVEIO: jest.fn(function () { | ||
this.Import = jest.fn(); | ||
this.Export = jest.fn(); | ||
return this; | ||
}), | ||
} | ||
}); | ||
jest.mock('../../toolbox/select/SelectTool', () => { | ||
@@ -850,2 +860,13 @@ return { | ||
}); | ||
it('should perform action EXPORT_SCENE', async () => { | ||
const url = 'https://example.com'; | ||
jest.spyOn(testCom['io'], 'Export').mockResolvedValueOnce(url); | ||
const result = await testCom.PerformAction('EXPORT_SCENE', { | ||
type: 'glb', | ||
}); | ||
expect(result).toBe(url); | ||
}); | ||
}); |
@@ -26,2 +26,3 @@ import SET_BACKGROUND from "./scene/setbackground.ts"; | ||
import SET_PARENT from "./object/setparent.ts"; | ||
import EXPORT_SCENE from "./scene/exportscene.ts"; | ||
@@ -54,2 +55,3 @@ export type Actions = { | ||
SET_PARENT: SET_PARENT, | ||
EXPORT_SCENE: EXPORT_SCENE, | ||
}; |
@@ -16,3 +16,5 @@ import { Actions } from "./actions/index.ts"; | ||
import { type DIVESelectable } from "../interface/Selectable.ts"; | ||
import { type DIVEIO } from "../io/IO.ts"; | ||
type EventListener<Action extends keyof Actions> = (payload: Actions[Action]['PAYLOAD']) => void; | ||
@@ -70,2 +72,11 @@ | ||
private _io: DIVEIO | null; | ||
private get io(): DIVEIO { | ||
if (!this._io) { | ||
const DIVEIO = require('../io/IO.ts').DIVEIO as typeof import('../io/IO.ts').DIVEIO; | ||
this._io = new DIVEIO(this.scene); | ||
} | ||
return this._io; | ||
} | ||
private registered: Map<string, COMEntity> = new Map(); | ||
@@ -83,2 +94,3 @@ | ||
this._mediaGenerator = null; | ||
this._io = null; | ||
@@ -199,2 +211,6 @@ DIVECommunication.__instances.push(this); | ||
} | ||
case 'EXPORT_SCENE': { | ||
returnValue = this.exportScene(payload as Actions['EXPORT_SCENE']['PAYLOAD']); | ||
break; | ||
} | ||
} | ||
@@ -530,4 +546,8 @@ | ||
} | ||
private exportScene(payload: Actions['EXPORT_SCENE']['PAYLOAD']): Actions['EXPORT_SCENE']['RETURN'] { | ||
return this.io.Export(payload.type); | ||
} | ||
} | ||
export type { Actions } from './actions/index.ts'; |
import { type DIVESceneObject } from "./SceneObjects"; | ||
import { type DIVESceneFileType } from "./SceneType"; | ||
export { | ||
type DIVESceneObject, | ||
type DIVESceneFileType, | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
993030
147
15735