@shopware-ag/dive 1.17.1 → 1.17.2

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 CHANGED
@@ -337,40 +337,7 @@ var init_TransformTool = __esm({
337
337
  super(scene, controller);
338
338
  this.isTransformTool = true;
339
339
  this.name = "DIVETransformTool";
340
- this._gizmo = new import_TransformControls.TransformControls(
341
- this._controller.object,
342
- this._controller.domElement
343
- );
344
- this._gizmo.mode = "translate";
345
- this._gizmo.addEventListener("mouseDown", () => {
346
- controller.enabled = false;
347
- if (!implementsInterface(
348
- this._gizmo.object,
349
- "isMovable"
350
- ))
351
- return;
352
- if (!this._gizmo.object.onMoveStart) return;
353
- this._gizmo.object.onMoveStart();
354
- });
355
- this._gizmo.addEventListener("objectChange", () => {
356
- if (!implementsInterface(
357
- this._gizmo.object,
358
- "isMovable"
359
- ))
360
- return;
361
- if (!this._gizmo.object.onMove) return;
362
- this._gizmo.object.onMove();
363
- });
364
- this._gizmo.addEventListener("mouseUp", () => {
365
- controller.enabled = true;
366
- if (!implementsInterface(
367
- this._gizmo.object,
368
- "isMovable"
369
- ))
370
- return;
371
- if (!this._gizmo.object.onMoveEnd) return;
372
- this._gizmo.object.onMoveEnd();
373
- });
340
+ this._gizmo = this.initGizmo();
374
341
  this._scene.add(this._gizmo);
375
342
  }
376
343
  Activate() {
@@ -382,19 +349,58 @@ var init_TransformTool = __esm({
382
349
  const contains = this._scene.children.includes(this._gizmo);
383
350
  if (active && !contains) {
384
351
  this._scene.add(this._gizmo);
352
+ if ("isTransformControls" in this._gizmo) {
353
+ this._gizmo.getRaycaster().layers.enableAll();
354
+ }
385
355
  } else if (!active && contains) {
386
356
  this._scene.remove(this._gizmo);
357
+ if ("isTransformControls" in this._gizmo) {
358
+ this._gizmo.getRaycaster().layers.disableAll();
359
+ }
387
360
  }
388
361
  }
362
+ // only used for optimizing pointer events with DIVEGizmo
389
363
  // public onPointerDown(e: PointerEvent): void {
390
364
  // super.onPointerDown(e);
391
- // // if (this._hovered) {
392
- // // this._dragRaycastOnObjects = this._gizmo.gizmoPlane.children;
393
- // // }
365
+ // if (this._hovered) {
366
+ // this._dragRaycastOnObjects = (
367
+ // this._gizmo as DIVEGizmo
368
+ // ).gizmoPlane?.children;
369
+ // }
394
370
  // }
371
+ // only used for optimizing pointer events with DIVEGizmo
395
372
  // protected raycast(): Intersection[] {
396
- // return super.raycast(this._gizmo.gizmoNode.children);
373
+ // return super.raycast((this._gizmo as DIVEGizmo).gizmoNode.children);
397
374
  // }
375
+ initGizmo() {
376
+ const g = new import_TransformControls.TransformControls(
377
+ // this._controller,
378
+ this._controller.object,
379
+ this._controller.domElement
380
+ );
381
+ g.mode = "translate";
382
+ g.addEventListener("mouseDown", () => {
383
+ this._controller.enabled = false;
384
+ if (!implementsInterface(g.object, "isMovable"))
385
+ return;
386
+ if (!g.object.onMoveStart) return;
387
+ g.object.onMoveStart();
388
+ });
389
+ g.addEventListener("objectChange", () => {
390
+ if (!implementsInterface(g.object, "isMovable"))
391
+ return;
392
+ if (!g.object.onMove) return;
393
+ g.object.onMove();
394
+ });
395
+ g.addEventListener("mouseUp", () => {
396
+ this._controller.enabled = true;
397
+ if (!implementsInterface(g.object, "isMovable"))
398
+ return;
399
+ if (!g.object.onMoveEnd) return;
400
+ g.object.onMoveEnd();
401
+ });
402
+ return g;
403
+ }
398
404
  };
399
405
  }
400
406
  });
@@ -4428,7 +4434,7 @@ init_Info();
4428
4434
  // package.json
4429
4435
  var package_default = {
4430
4436
  name: "@shopware-ag/dive",
4431
- version: "1.17.1",
4437
+ version: "1.17.2",
4432
4438
  description: "Shopware Spatial Framework",
4433
4439
  type: "module",
4434
4440
  main: "./build/dive.cjs",
@@ -4472,6 +4478,7 @@ var package_default = {
4472
4478
  globals: "^15.0.0",
4473
4479
  jest: "^29.7.0",
4474
4480
  "jest-environment-jsdom": "^29.7.0",
4481
+ "jest-junit": "^16.0.0",
4475
4482
  jsdom: "^24.0.0",
4476
4483
  prettier: "^3.3.3",
4477
4484
  "prettier-plugin-multiline-arrays": "^3.0.6",