@shopware-ag/dive 1.6.4 → 1.6.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 CHANGED
@@ -705,7 +705,7 @@ var _DIVECommunication = class _DIVECommunication {
705
705
  this.registered = /* @__PURE__ */ new Map();
706
706
  // private listeners: { [key: string]: EventListener[] } = {};
707
707
  this.listeners = /* @__PURE__ */ new Map();
708
- this.id = (0, import_MathUtils.generateUUID)();
708
+ this._id = (0, import_MathUtils.generateUUID)();
709
709
  this.renderer = renderer;
710
710
  this.scene = scene;
711
711
  this.controller = controls;
@@ -714,8 +714,13 @@ var _DIVECommunication = class _DIVECommunication {
714
714
  _DIVECommunication.__instances.push(this);
715
715
  }
716
716
  static get(id) {
717
+ const fromComID = this.__instances.find((instance) => instance.id === id);
718
+ if (fromComID) return fromComID;
717
719
  return this.__instances.find((instance) => Array.from(instance.registered.values()).find((object) => object.id === id));
718
720
  }
721
+ get id() {
722
+ return this._id;
723
+ }
719
724
  get mediaGenerator() {
720
725
  if (!this._mediaGenerator) {
721
726
  const DIVEMediaCreator2 = (init_MediaCreator(), __toCommonJS(MediaCreator_exports)).DIVEMediaCreator;
@@ -1586,6 +1591,8 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends import_Addons3.OrbitCo
1586
1591
  };
1587
1592
  this.stopRevertLast = () => {
1588
1593
  };
1594
+ this._removePreRenderCallback = () => {
1595
+ };
1589
1596
  this.preRenderCallback = () => {
1590
1597
  if (this.locked) return;
1591
1598
  this.update();
@@ -1593,12 +1600,19 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends import_Addons3.OrbitCo
1593
1600
  this._animationSystem = animationSystem;
1594
1601
  this.domElement = renderer.domElement;
1595
1602
  this.object = camera;
1596
- renderer.AddPreRenderCallback(() => {
1603
+ const id = renderer.AddPreRenderCallback(() => {
1597
1604
  this.preRenderCallback();
1598
1605
  });
1606
+ this._removePreRenderCallback = () => {
1607
+ renderer.RemovePreRenderCallback(id);
1608
+ };
1599
1609
  this.enableDamping = settings.enableDamping;
1600
1610
  this.dampingFactor = settings.dampingFactor;
1601
1611
  }
1612
+ Dispose() {
1613
+ this._removePreRenderCallback();
1614
+ this.dispose();
1615
+ }
1602
1616
  ComputeEncompassingView(bb) {
1603
1617
  const center = bb.getCenter(new import_three14.Vector3());
1604
1618
  const size = bb.getSize(new import_three14.Vector3());
@@ -2071,6 +2085,7 @@ var DIVE = class _DIVE {
2071
2085
  var _a;
2072
2086
  this.removeResizeObserver();
2073
2087
  this.renderer.Dispose();
2088
+ this.orbitControls.Dispose();
2074
2089
  (_a = this.axisCamera) == null ? void 0 : _a.Dispose();
2075
2090
  this.animationSystem.Dispose();
2076
2091
  this.toolbox.Dispose();