@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.d.cts CHANGED
@@ -122,7 +122,9 @@ declare class DIVEOrbitControls extends OrbitControls {
122
122
  private stopRevertLast;
123
123
  object: DIVEPerspectiveCamera;
124
124
  domElement: HTMLCanvasElement;
125
+ private _removePreRenderCallback;
125
126
  constructor(camera: DIVEPerspectiveCamera, renderer: DIVERenderer, animationSystem: DIVEAnimationSystem, settings?: DIVEOrbitControlsSettings);
127
+ Dispose(): void;
126
128
  ComputeEncompassingView(bb: Box3): {
127
129
  position: Vector3Like;
128
130
  target: Vector3Like;
@@ -605,7 +607,8 @@ type Unsubscribe = () => boolean;
605
607
  declare class DIVECommunication {
606
608
  private static __instances;
607
609
  static get(id: string): DIVECommunication | undefined;
608
- private id;
610
+ private _id;
611
+ get id(): string;
609
612
  private renderer;
610
613
  private scene;
611
614
  private controller;
package/build/dive.d.ts CHANGED
@@ -122,7 +122,9 @@ declare class DIVEOrbitControls extends OrbitControls {
122
122
  private stopRevertLast;
123
123
  object: DIVEPerspectiveCamera;
124
124
  domElement: HTMLCanvasElement;
125
+ private _removePreRenderCallback;
125
126
  constructor(camera: DIVEPerspectiveCamera, renderer: DIVERenderer, animationSystem: DIVEAnimationSystem, settings?: DIVEOrbitControlsSettings);
127
+ Dispose(): void;
126
128
  ComputeEncompassingView(bb: Box3): {
127
129
  position: Vector3Like;
128
130
  target: Vector3Like;
@@ -605,7 +607,8 @@ type Unsubscribe = () => boolean;
605
607
  declare class DIVECommunication {
606
608
  private static __instances;
607
609
  static get(id: string): DIVECommunication | undefined;
608
- private id;
610
+ private _id;
611
+ get id(): string;
609
612
  private renderer;
610
613
  private scene;
611
614
  private controller;
package/build/dive.js CHANGED
@@ -683,7 +683,7 @@ var _DIVECommunication = class _DIVECommunication {
683
683
  this.registered = /* @__PURE__ */ new Map();
684
684
  // private listeners: { [key: string]: EventListener[] } = {};
685
685
  this.listeners = /* @__PURE__ */ new Map();
686
- this.id = generateUUID();
686
+ this._id = generateUUID();
687
687
  this.renderer = renderer;
688
688
  this.scene = scene;
689
689
  this.controller = controls;
@@ -692,8 +692,13 @@ var _DIVECommunication = class _DIVECommunication {
692
692
  _DIVECommunication.__instances.push(this);
693
693
  }
694
694
  static get(id) {
695
+ const fromComID = this.__instances.find((instance) => instance.id === id);
696
+ if (fromComID) return fromComID;
695
697
  return this.__instances.find((instance) => Array.from(instance.registered.values()).find((object) => object.id === id));
696
698
  }
699
+ get id() {
700
+ return this._id;
701
+ }
697
702
  get mediaGenerator() {
698
703
  if (!this._mediaGenerator) {
699
704
  const DIVEMediaCreator2 = (init_MediaCreator(), __toCommonJS(MediaCreator_exports)).DIVEMediaCreator;
@@ -1564,6 +1569,8 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends OrbitControls {
1564
1569
  };
1565
1570
  this.stopRevertLast = () => {
1566
1571
  };
1572
+ this._removePreRenderCallback = () => {
1573
+ };
1567
1574
  this.preRenderCallback = () => {
1568
1575
  if (this.locked) return;
1569
1576
  this.update();
@@ -1571,12 +1578,19 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends OrbitControls {
1571
1578
  this._animationSystem = animationSystem;
1572
1579
  this.domElement = renderer.domElement;
1573
1580
  this.object = camera;
1574
- renderer.AddPreRenderCallback(() => {
1581
+ const id = renderer.AddPreRenderCallback(() => {
1575
1582
  this.preRenderCallback();
1576
1583
  });
1584
+ this._removePreRenderCallback = () => {
1585
+ renderer.RemovePreRenderCallback(id);
1586
+ };
1577
1587
  this.enableDamping = settings.enableDamping;
1578
1588
  this.dampingFactor = settings.dampingFactor;
1579
1589
  }
1590
+ Dispose() {
1591
+ this._removePreRenderCallback();
1592
+ this.dispose();
1593
+ }
1580
1594
  ComputeEncompassingView(bb) {
1581
1595
  const center = bb.getCenter(new Vector33());
1582
1596
  const size = bb.getSize(new Vector33());
@@ -2049,6 +2063,7 @@ var DIVE = class _DIVE {
2049
2063
  var _a;
2050
2064
  this.removeResizeObserver();
2051
2065
  this.renderer.Dispose();
2066
+ this.orbitControls.Dispose();
2052
2067
  (_a = this.axisCamera) == null ? void 0 : _a.Dispose();
2053
2068
  this.animationSystem.Dispose();
2054
2069
  this.toolbox.Dispose();