@shopware-ag/dive 1.15.4 → 1.15.5
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/build/dive.cjs +84 -20
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +1 -3
- package/build/dive.d.ts +1 -3
- package/build/dive.js +84 -20
- package/build/dive.js.map +1 -1
- package/package.json +3 -1
- package/src/com/Communication.ts +3 -2
- package/src/com/__test__/Communication.test.ts +6 -6
- package/src/com/types/COMBaseEntity.ts +1 -1
- package/src/dive.ts +2 -1
- package/src/primitive/Primitive.ts +5 -3
- package/src/primitive/__test__/Primitive.test.ts +4 -2
- package/src/scene/root/Root.ts +12 -16
- package/src/scene/root/__test__/Root.test.ts +9 -9
package/build/dive.cjs
CHANGED
|
@@ -673,6 +673,7 @@ var import_three5 = require("three");
|
|
|
673
673
|
// src/com/Communication.ts
|
|
674
674
|
var import_MathUtils = require("three/src/math/MathUtils");
|
|
675
675
|
init_SelectTool();
|
|
676
|
+
var import_lodash = require("lodash");
|
|
676
677
|
var _DIVECommunication = class _DIVECommunication {
|
|
677
678
|
constructor(renderer, scene, controls, toolbox) {
|
|
678
679
|
this.registered = /* @__PURE__ */ new Map();
|
|
@@ -867,7 +868,7 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
867
868
|
}
|
|
868
869
|
addObject(payload) {
|
|
869
870
|
if (this.registered.get(payload.id)) return false;
|
|
870
|
-
if (payload.
|
|
871
|
+
if (payload.parentId === void 0) payload.parentId = null;
|
|
871
872
|
this.registered.set(payload.id, payload);
|
|
872
873
|
this.scene.AddSceneObject(payload);
|
|
873
874
|
return true;
|
|
@@ -875,7 +876,7 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
875
876
|
updateObject(payload) {
|
|
876
877
|
const objectToUpdate = this.registered.get(payload.id);
|
|
877
878
|
if (!objectToUpdate) return false;
|
|
878
|
-
this.registered.set(payload.id,
|
|
879
|
+
this.registered.set(payload.id, (0, import_lodash.merge)(objectToUpdate, payload));
|
|
879
880
|
const updatedObject = this.registered.get(payload.id);
|
|
880
881
|
this.scene.UpdateSceneObject(__spreadProps(__spreadValues({}, payload), { id: updatedObject.id, entityType: updatedObject.entityType }));
|
|
881
882
|
Object.assign(payload, updatedObject);
|
|
@@ -1385,7 +1386,7 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1385
1386
|
DropIt() {
|
|
1386
1387
|
var _a;
|
|
1387
1388
|
if (!this.parent) {
|
|
1388
|
-
console.warn("
|
|
1389
|
+
console.warn("DIVEPrimitive: DropIt() called on a model that is not in the scene.", this);
|
|
1389
1390
|
return;
|
|
1390
1391
|
}
|
|
1391
1392
|
const bottomY = this._boundingBox.min.y * this.scale.y;
|
|
@@ -1407,7 +1408,7 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1407
1408
|
}
|
|
1408
1409
|
}
|
|
1409
1410
|
assembleGeometry(geometry) {
|
|
1410
|
-
switch (geometry.name) {
|
|
1411
|
+
switch (geometry.name.toLowerCase()) {
|
|
1411
1412
|
case "cylinder":
|
|
1412
1413
|
return this.createCylinderGeometry(geometry);
|
|
1413
1414
|
case "sphere":
|
|
@@ -1422,8 +1423,10 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1422
1423
|
return this.createWallGeometry(geometry);
|
|
1423
1424
|
case "plane":
|
|
1424
1425
|
return this.createPlaneGeometry(geometry);
|
|
1425
|
-
default:
|
|
1426
|
+
default: {
|
|
1427
|
+
console.warn("DIVEPrimitive: Invalid geometry type:", geometry.name.toLowerCase());
|
|
1426
1428
|
return new import_three9.BufferGeometry();
|
|
1429
|
+
}
|
|
1427
1430
|
}
|
|
1428
1431
|
}
|
|
1429
1432
|
createCylinderGeometry(geometry) {
|
|
@@ -1706,7 +1709,7 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1706
1709
|
break;
|
|
1707
1710
|
}
|
|
1708
1711
|
default: {
|
|
1709
|
-
console.warn(`
|
|
1712
|
+
console.warn(`DIVERoot.updateLight: Unknown light type: ${light.type}`);
|
|
1710
1713
|
return;
|
|
1711
1714
|
}
|
|
1712
1715
|
}
|
|
@@ -1719,7 +1722,7 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1719
1722
|
if (light.enabled !== void 0 && light.enabled !== null) sceneObject.SetEnabled(light.enabled);
|
|
1720
1723
|
if (light.color !== void 0 && light.color !== null) sceneObject.SetColor(new import_three11.Color(light.color));
|
|
1721
1724
|
if (light.visible !== void 0 && light.visible !== null) sceneObject.visible = light.visible;
|
|
1722
|
-
if (light.
|
|
1725
|
+
if (light.parentId !== void 0) this.setParent(__spreadProps(__spreadValues({}, light), { parentId: light.parentId }));
|
|
1723
1726
|
}
|
|
1724
1727
|
updateModel(model) {
|
|
1725
1728
|
let sceneObject = this.GetSceneObject(model);
|
|
@@ -1742,7 +1745,7 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1742
1745
|
if (model.scale !== void 0) sceneObject.SetScale(model.scale);
|
|
1743
1746
|
if (model.visible !== void 0) sceneObject.SetVisibility(model.visible);
|
|
1744
1747
|
if (model.material !== void 0) sceneObject.SetMaterial(model.material);
|
|
1745
|
-
if (model.
|
|
1748
|
+
if (model.parentId !== void 0) this.setParent(__spreadProps(__spreadValues({}, model), { parentId: model.parentId }));
|
|
1746
1749
|
}
|
|
1747
1750
|
updatePrimitive(primitive) {
|
|
1748
1751
|
let sceneObject = this.GetSceneObject(primitive);
|
|
@@ -1759,7 +1762,7 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1759
1762
|
if (primitive.scale !== void 0) sceneObject.SetScale(primitive.scale);
|
|
1760
1763
|
if (primitive.visible !== void 0) sceneObject.SetVisibility(primitive.visible);
|
|
1761
1764
|
if (primitive.material !== void 0) sceneObject.SetMaterial(primitive.material);
|
|
1762
|
-
if (primitive.
|
|
1765
|
+
if (primitive.parentId !== void 0) this.setParent(__spreadProps(__spreadValues({}, primitive), { parentId: primitive.parentId }));
|
|
1763
1766
|
}
|
|
1764
1767
|
updateGroup(group) {
|
|
1765
1768
|
let sceneObject = this.GetSceneObject(group);
|
|
@@ -1775,12 +1778,12 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1775
1778
|
if (group.scale !== void 0) sceneObject.SetScale(group.scale);
|
|
1776
1779
|
if (group.visible !== void 0) sceneObject.SetVisibility(group.visible);
|
|
1777
1780
|
if (group.bbVisible !== void 0) sceneObject.SetLinesVisibility(group.bbVisible);
|
|
1778
|
-
if (group.
|
|
1781
|
+
if (group.parentId !== void 0) this.setParent(__spreadProps(__spreadValues({}, group), { parentId: group.parentId }));
|
|
1779
1782
|
}
|
|
1780
1783
|
deleteLight(light) {
|
|
1781
1784
|
const sceneObject = this.GetSceneObject(light);
|
|
1782
1785
|
if (!sceneObject) {
|
|
1783
|
-
console.warn(`
|
|
1786
|
+
console.warn(`DIVERoot.deleteLight: Light with id ${light.id} not found`);
|
|
1784
1787
|
return;
|
|
1785
1788
|
}
|
|
1786
1789
|
this.detachTransformControls(sceneObject);
|
|
@@ -1789,7 +1792,7 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1789
1792
|
deleteModel(model) {
|
|
1790
1793
|
const sceneObject = this.GetSceneObject(model);
|
|
1791
1794
|
if (!sceneObject) {
|
|
1792
|
-
console.warn(`
|
|
1795
|
+
console.warn(`DIVERoot.deleteModel: Model with id ${model.id} not found`);
|
|
1793
1796
|
return;
|
|
1794
1797
|
}
|
|
1795
1798
|
this.detachTransformControls(sceneObject);
|
|
@@ -1798,7 +1801,7 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1798
1801
|
deletePrimitive(primitive) {
|
|
1799
1802
|
const sceneObject = this.GetSceneObject(primitive);
|
|
1800
1803
|
if (!sceneObject) {
|
|
1801
|
-
console.warn(`
|
|
1804
|
+
console.warn(`DIVERoot.deletePrimitive: Primitive with id ${primitive.id} not found`);
|
|
1802
1805
|
return;
|
|
1803
1806
|
}
|
|
1804
1807
|
this.detachTransformControls(sceneObject);
|
|
@@ -1807,7 +1810,7 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1807
1810
|
deleteGroup(group) {
|
|
1808
1811
|
const sceneObject = this.GetSceneObject(group);
|
|
1809
1812
|
if (!sceneObject) {
|
|
1810
|
-
console.warn(`
|
|
1813
|
+
console.warn(`DIVERoot.deleteGroup: Group with id ${group.id} not found`);
|
|
1811
1814
|
return;
|
|
1812
1815
|
}
|
|
1813
1816
|
this.detachTransformControls(sceneObject);
|
|
@@ -1824,11 +1827,8 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1824
1827
|
setParent(object) {
|
|
1825
1828
|
const sceneObject = this.GetSceneObject(object);
|
|
1826
1829
|
if (!sceneObject) return;
|
|
1827
|
-
if (
|
|
1828
|
-
|
|
1829
|
-
}
|
|
1830
|
-
if (object.parent !== null) {
|
|
1831
|
-
const parent = this.GetSceneObject(object.parent);
|
|
1830
|
+
if (object.parentId !== null) {
|
|
1831
|
+
const parent = this.GetSceneObject({ id: object.parentId });
|
|
1832
1832
|
if (!parent) return;
|
|
1833
1833
|
parent.attach(sceneObject);
|
|
1834
1834
|
} else {
|
|
@@ -2376,6 +2376,70 @@ var DIVEInfo = class {
|
|
|
2376
2376
|
};
|
|
2377
2377
|
DIVEInfo._supportsWebXR = null;
|
|
2378
2378
|
|
|
2379
|
+
// package.json
|
|
2380
|
+
var package_default = {
|
|
2381
|
+
name: "@shopware-ag/dive",
|
|
2382
|
+
version: "1.15.5",
|
|
2383
|
+
description: "Shopware Spatial Framework",
|
|
2384
|
+
type: "module",
|
|
2385
|
+
main: "./build/dive.cjs",
|
|
2386
|
+
module: "./build/dive.js",
|
|
2387
|
+
types: "./build/dive.d.ts",
|
|
2388
|
+
files: [
|
|
2389
|
+
"build",
|
|
2390
|
+
"LICENSE",
|
|
2391
|
+
"package.json",
|
|
2392
|
+
"README.md",
|
|
2393
|
+
"src"
|
|
2394
|
+
],
|
|
2395
|
+
keywords: [
|
|
2396
|
+
"dive",
|
|
2397
|
+
"shopware",
|
|
2398
|
+
"sw6",
|
|
2399
|
+
"three",
|
|
2400
|
+
"three.js",
|
|
2401
|
+
"3d",
|
|
2402
|
+
"typescript"
|
|
2403
|
+
],
|
|
2404
|
+
repository: "git@github.com:shopware/dive.git",
|
|
2405
|
+
author: "ffrank <f.frank@shopware.com>",
|
|
2406
|
+
license: "MIT",
|
|
2407
|
+
browserslist: [
|
|
2408
|
+
"> 1%, not dead, not ie 11, not op_mini all"
|
|
2409
|
+
],
|
|
2410
|
+
dependencies: {
|
|
2411
|
+
"@tweenjs/tween.js": "^23.1.1",
|
|
2412
|
+
lodash: "^4.17.21",
|
|
2413
|
+
three: "^0.163.0",
|
|
2414
|
+
"three-spritetext": "^1.8.2"
|
|
2415
|
+
},
|
|
2416
|
+
devDependencies: {
|
|
2417
|
+
"@eslint/js": "^9.1.1",
|
|
2418
|
+
"@types/jest": "^29.5.12",
|
|
2419
|
+
"@types/lodash": "^4.17.12",
|
|
2420
|
+
"@types/node": "^20.12.7",
|
|
2421
|
+
"@types/three": "^0.163.0",
|
|
2422
|
+
eslint: "^9.1.1",
|
|
2423
|
+
globals: "^15.0.0",
|
|
2424
|
+
jest: "^29.7.0",
|
|
2425
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
2426
|
+
jsdom: "^24.0.0",
|
|
2427
|
+
"ts-jest": "^29.1.2",
|
|
2428
|
+
"ts-node": "^10.9.2",
|
|
2429
|
+
tsup: "^8.0.2",
|
|
2430
|
+
typescript: "^5.4.5",
|
|
2431
|
+
"typescript-eslint": "^7.7.1"
|
|
2432
|
+
},
|
|
2433
|
+
scripts: {
|
|
2434
|
+
build: "tsup && yarn genmd",
|
|
2435
|
+
watch: "tsup --watch",
|
|
2436
|
+
lint: "eslint",
|
|
2437
|
+
unit: "jest",
|
|
2438
|
+
coverage: "jest --coverage",
|
|
2439
|
+
genmd: "node ./scripts/genmd.js"
|
|
2440
|
+
}
|
|
2441
|
+
};
|
|
2442
|
+
|
|
2379
2443
|
// src/math/helper/shift.ts
|
|
2380
2444
|
function shift(value, exponent) {
|
|
2381
2445
|
const subvalues = (value + "e").split("e");
|
|
@@ -2551,7 +2615,7 @@ var DIVE = class _DIVE {
|
|
|
2551
2615
|
console.log(this.scene);
|
|
2552
2616
|
}
|
|
2553
2617
|
};
|
|
2554
|
-
console.log(
|
|
2618
|
+
console.log(`DIVE ${package_default.version} initialized`);
|
|
2555
2619
|
}
|
|
2556
2620
|
Dispose() {
|
|
2557
2621
|
var _a;
|