@shopware-ag/dive 1.16.3 → 1.16.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 +61 -31
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +4 -2
- package/build/dive.d.ts +4 -2
- package/build/dive.js +61 -32
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/com/Communication.ts +5 -0
- package/src/com/__test__/Communication.test.ts +7 -1
- package/src/com/types/COMGeometry.ts +3 -1
- package/src/com/types/COMGeometryType.ts +9 -0
- package/src/com/types/index.ts +2 -0
- package/src/dive.ts +3 -1
- package/src/io/IO.ts +19 -42
- package/src/io/__test__/IO.test.ts +32 -15
- package/src/primitive/Primitive.ts +8 -4
- package/src/primitive/__test__/Primitive.test.ts +17 -2
- package/src/renderer/__test__/Renderer.test.ts +3 -2
- package/src/scene/root/Root.ts +20 -0
- package/src/scene/root/__test__/Root.test.ts +54 -1
- package/src/toolbox/BaseTool.ts +11 -3
- package/src/toolbox/Toolbox.ts +1 -1
- package/src/toolbox/__test__/BaseTool.test.ts +37 -1
- package/src/toolbox/__test__/Toolbox.test.ts +18 -18
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
|
-
|
|
153
|
+
}
|
|
154
|
+
case 1: {
|
|
154
155
|
this._pointerMiddleDown = true;
|
|
155
156
|
break;
|
|
156
|
-
|
|
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
|
-
|
|
611
|
+
console.error("DIVEIO.Import: Unsupported file type: " + type);
|
|
612
|
+
return Promise.reject();
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
|
|
616
|
+
Export(type) {
|
|
617
617
|
switch (type) {
|
|
618
618
|
case "glb": {
|
|
619
|
-
return
|
|
620
|
-
this.
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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.
|
|
2882
|
+
version: "1.16.5",
|
|
2855
2883
|
description: "Shopware Spatial Framework",
|
|
2856
2884
|
type: "module",
|
|
2857
2885
|
main: "./build/dive.cjs",
|
|
@@ -3134,7 +3162,9 @@ var DIVE = class _DIVE {
|
|
|
3134
3162
|
console.log(this.scene);
|
|
3135
3163
|
}
|
|
3136
3164
|
};
|
|
3137
|
-
console.log(
|
|
3165
|
+
console.log(
|
|
3166
|
+
`DIVE ${package_default.version} initialized ${process.env.NODE_ENV === "development" ? "in development mode" : ""}`
|
|
3167
|
+
);
|
|
3138
3168
|
}
|
|
3139
3169
|
Dispose() {
|
|
3140
3170
|
var _a;
|