@shopware-ag/dive 1.17.0 → 1.17.1
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 +45 -7
- package/build/dive.cjs.map +1 -1
- package/build/dive.js +45 -7
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/com/Communication.ts +41 -0
- package/src/model/Model.ts +7 -2
- package/src/model/__test__/Model.test.ts +48 -73
- package/src/primitive/Primitive.ts +7 -2
- package/src/primitive/__test__/Primitive.test.ts +25 -18
package/build/dive.cjs
CHANGED
|
@@ -2550,6 +2550,22 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
2550
2550
|
deleteObject(payload) {
|
|
2551
2551
|
const deletedObject = this.registered.get(payload.id);
|
|
2552
2552
|
if (!deletedObject) return false;
|
|
2553
|
+
if (deletedObject.parentId) {
|
|
2554
|
+
this.setParent({
|
|
2555
|
+
object: { id: deletedObject.id },
|
|
2556
|
+
parent: null
|
|
2557
|
+
});
|
|
2558
|
+
}
|
|
2559
|
+
if (deletedObject.entityType === "group") {
|
|
2560
|
+
this.registered.forEach((object) => {
|
|
2561
|
+
if (object.parentId === deletedObject.id) {
|
|
2562
|
+
this.updateObject({
|
|
2563
|
+
id: object.id,
|
|
2564
|
+
parentId: null
|
|
2565
|
+
});
|
|
2566
|
+
}
|
|
2567
|
+
});
|
|
2568
|
+
}
|
|
2553
2569
|
Object.assign(payload, deletedObject);
|
|
2554
2570
|
this.registered.delete(payload.id);
|
|
2555
2571
|
Array.from(this.registered.values()).forEach((object) => {
|
|
@@ -2712,6 +2728,10 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
2712
2728
|
if (!sceneObject) return false;
|
|
2713
2729
|
if (payload.parent === null) {
|
|
2714
2730
|
this.scene.Root.attach(sceneObject);
|
|
2731
|
+
this.updateObject({
|
|
2732
|
+
id: object.id,
|
|
2733
|
+
parentId: null
|
|
2734
|
+
});
|
|
2715
2735
|
return true;
|
|
2716
2736
|
}
|
|
2717
2737
|
if (payload.object.id === payload.parent.id) {
|
|
@@ -2720,14 +2740,26 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
2720
2740
|
const parent = this.registered.get(payload.parent.id);
|
|
2721
2741
|
if (!parent) {
|
|
2722
2742
|
this.scene.Root.attach(sceneObject);
|
|
2743
|
+
this.updateObject({
|
|
2744
|
+
id: object.id,
|
|
2745
|
+
parentId: null
|
|
2746
|
+
});
|
|
2723
2747
|
return true;
|
|
2724
2748
|
}
|
|
2725
2749
|
const parentObject = this.scene.GetSceneObject(parent);
|
|
2726
2750
|
if (!parentObject) {
|
|
2727
2751
|
this.scene.Root.attach(sceneObject);
|
|
2752
|
+
this.updateObject({
|
|
2753
|
+
id: object.id,
|
|
2754
|
+
parentId: null
|
|
2755
|
+
});
|
|
2728
2756
|
return true;
|
|
2729
2757
|
}
|
|
2730
2758
|
parentObject.attach(sceneObject);
|
|
2759
|
+
this.updateObject({
|
|
2760
|
+
id: object.id,
|
|
2761
|
+
parentId: parent.id
|
|
2762
|
+
});
|
|
2731
2763
|
return true;
|
|
2732
2764
|
}
|
|
2733
2765
|
exportScene(payload) {
|
|
@@ -3002,12 +3034,15 @@ var DIVEModel = class extends DIVENode {
|
|
|
3002
3034
|
}
|
|
3003
3035
|
}
|
|
3004
3036
|
PlaceOnFloor() {
|
|
3005
|
-
var _a;
|
|
3037
|
+
var _a, _b, _c, _d, _e;
|
|
3006
3038
|
const worldPos = this.getWorldPosition(this._positionWorldBuffer);
|
|
3007
3039
|
const oldWorldPos = worldPos.clone();
|
|
3008
|
-
|
|
3040
|
+
(_b = (_a = this._mesh) == null ? void 0 : _a.geometry) == null ? void 0 : _b.computeBoundingBox();
|
|
3041
|
+
const meshBB = (_d = (_c = this._mesh) == null ? void 0 : _c.geometry) == null ? void 0 : _d.boundingBox;
|
|
3042
|
+
if (!meshBB || !this._mesh) return;
|
|
3043
|
+
worldPos.y = worldPos.y - this._mesh.localToWorld(meshBB.min.clone()).y;
|
|
3009
3044
|
if (worldPos.y === oldWorldPos.y) return;
|
|
3010
|
-
(
|
|
3045
|
+
(_e = DIVECommunication.get(this.userData.id)) == null ? void 0 : _e.PerformAction(
|
|
3011
3046
|
"UPDATE_OBJECT",
|
|
3012
3047
|
{
|
|
3013
3048
|
id: this.userData.id,
|
|
@@ -3139,12 +3174,15 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
3139
3174
|
if (this._mesh) this._mesh.material = primitiveMaterial;
|
|
3140
3175
|
}
|
|
3141
3176
|
PlaceOnFloor() {
|
|
3142
|
-
var _a;
|
|
3177
|
+
var _a, _b, _c, _d, _e;
|
|
3143
3178
|
const worldPos = this.getWorldPosition(this._positionWorldBuffer);
|
|
3144
3179
|
const oldWorldPos = worldPos.clone();
|
|
3145
|
-
|
|
3180
|
+
(_b = (_a = this._mesh) == null ? void 0 : _a.geometry) == null ? void 0 : _b.computeBoundingBox();
|
|
3181
|
+
const meshBB = (_d = (_c = this._mesh) == null ? void 0 : _c.geometry) == null ? void 0 : _d.boundingBox;
|
|
3182
|
+
if (!meshBB || !this._mesh) return;
|
|
3183
|
+
worldPos.y = worldPos.y - this._mesh.localToWorld(meshBB.min.clone()).y;
|
|
3146
3184
|
if (worldPos.y === oldWorldPos.y) return;
|
|
3147
|
-
(
|
|
3185
|
+
(_e = DIVECommunication.get(this.userData.id)) == null ? void 0 : _e.PerformAction(
|
|
3148
3186
|
"UPDATE_OBJECT",
|
|
3149
3187
|
{
|
|
3150
3188
|
id: this.userData.id,
|
|
@@ -4390,7 +4428,7 @@ init_Info();
|
|
|
4390
4428
|
// package.json
|
|
4391
4429
|
var package_default = {
|
|
4392
4430
|
name: "@shopware-ag/dive",
|
|
4393
|
-
version: "1.17.
|
|
4431
|
+
version: "1.17.1",
|
|
4394
4432
|
description: "Shopware Spatial Framework",
|
|
4395
4433
|
type: "module",
|
|
4396
4434
|
main: "./build/dive.cjs",
|