@inweb/viewer-three 25.10.1 → 25.11.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.
@@ -192,6 +192,7 @@ export class WalkControls extends EventDispatcher {
192
192
 
193
193
  if (this.moveWheel !== 0) {
194
194
  const moveDelta = this.moveWheel * 0.0001 * this.movementSpeed * this.multiplier;
195
+
195
196
  this.camera.translateZ(-moveDelta);
196
197
  this.moveWheel += -1 * Math.sign(this.moveWheel);
197
198
  this.dispatchEvent(_changeEvent);
@@ -22,10 +22,10 @@
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
24
  import { MOUSE, TOUCH } from "three";
25
- import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
26
25
 
27
26
  import type { IDisposable } from "../IDisposable";
28
27
  import type { Viewer } from "../Viewer";
28
+ import { OrbitControls, STATE } from "../controls/OrbitControls.js";
29
29
 
30
30
  export class OrbitDragger implements IDisposable {
31
31
  protected viewer: Viewer;
@@ -45,15 +45,17 @@ export class OrbitDragger implements IDisposable {
45
45
  this.viewer.on("geometryend", this.updateControls);
46
46
  this.viewer.on("viewposition", this.updateControls);
47
47
  this.viewer.on("zoom", this.updateControls);
48
+ this.viewer.on("drawviewpoint", this.updateControls);
48
49
  this.viewer.on("contextmenu", this.stopContextMenu);
49
50
  this.updateControls();
50
51
  }
51
52
 
52
53
  dispose(): void {
53
- this.viewer.off("contextmenu", this.stopContextMenu);
54
- this.viewer.off("zoom", this.updateControls);
55
- this.viewer.off("viewposition", this.updateControls);
56
54
  this.viewer.off("geometryend", this.updateControls);
55
+ this.viewer.off("viewposition", this.updateControls);
56
+ this.viewer.off("zoom", this.updateControls);
57
+ this.viewer.off("drawviewpoint", this.updateControls);
58
+ this.viewer.off("contextmenu", this.stopContextMenu);
57
59
 
58
60
  this.orbit.removeEventListener("change", this.controlsChange);
59
61
  this.orbit.dispose();
@@ -74,6 +76,28 @@ export class OrbitDragger implements IDisposable {
74
76
  this.viewer.target.copy(this.orbit.target);
75
77
  this.viewer.update();
76
78
 
79
+ switch (this.orbit.state) {
80
+ case STATE.PAN:
81
+ case STATE.TOUCH_PAN:
82
+ this.viewer.emitEvent({
83
+ type: "pan",
84
+ x: this.orbit.panEnd.x,
85
+ y: this.orbit.panEnd.y,
86
+ dX: this.orbit.panDelta.x,
87
+ dY: this.orbit.panDelta.y,
88
+ });
89
+ break;
90
+
91
+ case STATE.DOLLY:
92
+ this.viewer.emitEvent({
93
+ type: "zoomat",
94
+ data: this.orbit.dollyScale,
95
+ x: this.orbit.dollyEnd.x,
96
+ y: this.orbit.dollyEnd.y,
97
+ });
98
+ break;
99
+ }
100
+
77
101
  this.changed = true;
78
102
  };
79
103