pptx-react-viewer 4.25.0 → 4.27.0

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.
Files changed (190) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/{AiChatPanel-2OWWIKF5.mjs → AiChatPanel-3J6XGIJ4.mjs} +3 -7
  3. package/dist/AiChatPanel-3J6XGIJ4.mjs.br +0 -0
  4. package/dist/AiChatPanel-3J6XGIJ4.mjs.gz +0 -0
  5. package/dist/{AiChatPanel-3NUGL5VN.js → AiChatPanel-EGTSK4T5.js} +27 -31
  6. package/dist/AiChatPanel-EGTSK4T5.js.br +0 -0
  7. package/dist/AiChatPanel-EGTSK4T5.js.gz +0 -0
  8. package/dist/{Model3DScene-SKCDIM2U.mjs → Model3DScene-2V2GQ6FY.mjs} +2 -2
  9. package/dist/Model3DScene-2V2GQ6FY.mjs.br +0 -0
  10. package/dist/Model3DScene-2V2GQ6FY.mjs.gz +0 -0
  11. package/dist/{Model3DScene-TXD4IOMU.js → Model3DScene-Q3XEZSWV.js} +3 -3
  12. package/dist/Model3DScene-Q3XEZSWV.js.br +2 -0
  13. package/dist/Model3DScene-Q3XEZSWV.js.gz +0 -0
  14. package/dist/{UTIF-CNNXS5Z5.mjs → UTIF-RPFRSSC5.mjs} +3 -3
  15. package/dist/UTIF-RPFRSSC5.mjs.br +0 -0
  16. package/dist/UTIF-RPFRSSC5.mjs.gz +0 -0
  17. package/dist/{UTIF-6SHLXCNF.js → UTIF-XWCKRN6V.js} +21 -21
  18. package/dist/UTIF-XWCKRN6V.js.br +0 -0
  19. package/dist/UTIF-XWCKRN6V.js.gz +0 -0
  20. package/dist/{chunk-M6FVQI5G.mjs → chunk-34AXBLYH.mjs} +51 -104
  21. package/dist/chunk-34AXBLYH.mjs.br +0 -0
  22. package/dist/chunk-34AXBLYH.mjs.gz +0 -0
  23. package/dist/{chunk-MT33XQSF.js → chunk-5RQTZ376.js} +1207 -1185
  24. package/dist/chunk-5RQTZ376.js.br +0 -0
  25. package/dist/chunk-5RQTZ376.js.gz +0 -0
  26. package/dist/{chunk-XGB3TDIC.mjs → chunk-6DZX6EAA.mjs} +1 -5
  27. package/dist/chunk-6DZX6EAA.mjs.br +0 -0
  28. package/dist/chunk-6DZX6EAA.mjs.gz +0 -0
  29. package/dist/{chunk-XDWL6LNV.js → chunk-MQCBMO6A.js} +909 -923
  30. package/dist/chunk-MQCBMO6A.js.br +0 -0
  31. package/dist/chunk-MQCBMO6A.js.gz +0 -0
  32. package/dist/{chunk-4VNS5WPM.js → chunk-QGM4M3NI.js} +0 -5
  33. package/dist/chunk-QGM4M3NI.js.br +0 -0
  34. package/dist/chunk-QGM4M3NI.js.gz +0 -0
  35. package/dist/{chunk-MRJZIBPQ.js → chunk-TYJZJJZ6.mjs} +13062 -118856
  36. package/dist/chunk-TYJZJJZ6.mjs.br +0 -0
  37. package/dist/chunk-TYJZJJZ6.mjs.gz +0 -0
  38. package/dist/{chunk-5FEQK3MW.mjs → chunk-WK6JBJCT.js} +13430 -117602
  39. package/dist/chunk-WK6JBJCT.js.br +0 -0
  40. package/dist/chunk-WK6JBJCT.js.gz +0 -0
  41. package/dist/{chunk-BP7NMPQE.mjs → chunk-ZK7UEEXE.mjs} +71 -92
  42. package/dist/chunk-ZK7UEEXE.mjs.br +0 -0
  43. package/dist/chunk-ZK7UEEXE.mjs.gz +0 -0
  44. package/dist/i18n/de.cjs +1 -0
  45. package/dist/i18n/de.cjs.br +0 -0
  46. package/dist/i18n/de.cjs.gz +0 -0
  47. package/dist/i18n/de.mjs +1 -0
  48. package/dist/i18n/de.mjs.br +0 -0
  49. package/dist/i18n/de.mjs.gz +0 -0
  50. package/dist/i18n/es.cjs +1 -0
  51. package/dist/i18n/es.cjs.br +0 -0
  52. package/dist/i18n/es.cjs.gz +0 -0
  53. package/dist/i18n/es.mjs +1 -0
  54. package/dist/i18n/es.mjs.br +0 -0
  55. package/dist/i18n/es.mjs.gz +0 -0
  56. package/dist/i18n/fr.cjs +1 -0
  57. package/dist/i18n/fr.cjs.br +0 -0
  58. package/dist/i18n/fr.cjs.gz +0 -0
  59. package/dist/i18n/fr.mjs +1 -0
  60. package/dist/i18n/fr.mjs.br +0 -0
  61. package/dist/i18n/fr.mjs.gz +0 -0
  62. package/dist/i18n/zh-CN.cjs +1 -0
  63. package/dist/i18n/zh-CN.cjs.br +0 -0
  64. package/dist/i18n/zh-CN.cjs.gz +0 -0
  65. package/dist/i18n/zh-CN.mjs +1 -0
  66. package/dist/i18n/zh-CN.mjs.br +0 -0
  67. package/dist/i18n/zh-CN.mjs.gz +0 -0
  68. package/dist/i18n.d.ts +1 -46
  69. package/dist/i18n.js +5 -5
  70. package/dist/i18n.js.br +0 -0
  71. package/dist/i18n.js.gz +0 -0
  72. package/dist/i18n.mjs +2 -2
  73. package/dist/i18n.mjs.br +0 -0
  74. package/dist/i18n.mjs.gz +0 -0
  75. package/dist/index.d.ts +11 -3703
  76. package/dist/index.js +96 -97
  77. package/dist/index.js.br +0 -0
  78. package/dist/index.js.gz +0 -0
  79. package/dist/index.mjs +6 -7
  80. package/dist/index.mjs.br +0 -0
  81. package/dist/index.mjs.gz +0 -0
  82. package/dist/internals.d.ts +5 -3847
  83. package/dist/internals.js +114 -115
  84. package/dist/internals.js.br +0 -0
  85. package/dist/internals.js.gz +0 -0
  86. package/dist/internals.mjs +4 -5
  87. package/dist/internals.mjs.br +0 -0
  88. package/dist/internals.mjs.gz +0 -0
  89. package/dist/{chunk-NJYF5KTY.mjs → three.module-A6ACXOES.mjs} +2 -0
  90. package/dist/three.module-A6ACXOES.mjs.br +0 -0
  91. package/dist/three.module-A6ACXOES.mjs.gz +0 -0
  92. package/dist/{chunk-QS3GAPPA.js → three.module-IORLGCSX.js} +2 -0
  93. package/dist/three.module-IORLGCSX.js.br +0 -0
  94. package/dist/three.module-IORLGCSX.js.gz +0 -0
  95. package/dist/viewer/index.d.ts +12 -2633
  96. package/dist/viewer/index.js +35 -37
  97. package/dist/viewer/index.js.br +0 -0
  98. package/dist/viewer/index.js.gz +0 -0
  99. package/dist/viewer/index.mjs +5 -7
  100. package/dist/viewer/index.mjs.br +0 -0
  101. package/dist/viewer/index.mjs.gz +0 -0
  102. package/dist/{y-webrtc-F2H7BRUK.js → y-webrtc-6LID3XZO.js} +5 -5
  103. package/dist/y-webrtc-6LID3XZO.js.br +0 -0
  104. package/dist/y-webrtc-6LID3XZO.js.gz +0 -0
  105. package/dist/{y-webrtc-GAHCEZSS.mjs → y-webrtc-F5IA7T5S.mjs} +1 -1
  106. package/dist/y-webrtc-F5IA7T5S.mjs.br +0 -0
  107. package/dist/y-webrtc-F5IA7T5S.mjs.gz +0 -0
  108. package/dist/{y-websocket-FBMB63F4.js → y-websocket-HOY2HFMH.js} +1 -1
  109. package/dist/y-websocket-HOY2HFMH.js.br +0 -0
  110. package/dist/y-websocket-HOY2HFMH.js.gz +0 -0
  111. package/dist/{y-websocket-MAGDFVLN.mjs → y-websocket-VGLBV2HJ.mjs} +1 -1
  112. package/dist/y-websocket-VGLBV2HJ.mjs.br +0 -0
  113. package/dist/y-websocket-VGLBV2HJ.mjs.gz +0 -0
  114. package/package.json +3 -4
  115. package/dist/AiChatPanel-2OWWIKF5.mjs.br +0 -0
  116. package/dist/AiChatPanel-2OWWIKF5.mjs.gz +0 -0
  117. package/dist/AiChatPanel-3NUGL5VN.js.br +0 -0
  118. package/dist/AiChatPanel-3NUGL5VN.js.gz +0 -0
  119. package/dist/GLTFLoader-O7FNKCHG.mjs +0 -2649
  120. package/dist/GLTFLoader-O7FNKCHG.mjs.br +0 -0
  121. package/dist/GLTFLoader-O7FNKCHG.mjs.gz +0 -0
  122. package/dist/GLTFLoader-UM56GMCK.js +0 -2651
  123. package/dist/GLTFLoader-UM56GMCK.js.br +0 -0
  124. package/dist/GLTFLoader-UM56GMCK.js.gz +0 -0
  125. package/dist/Model3DScene-SKCDIM2U.mjs.br +0 -0
  126. package/dist/Model3DScene-SKCDIM2U.mjs.gz +0 -0
  127. package/dist/Model3DScene-TXD4IOMU.js.br +0 -0
  128. package/dist/Model3DScene-TXD4IOMU.js.gz +0 -0
  129. package/dist/OrbitControls-EXEHIXFI.js +0 -922
  130. package/dist/OrbitControls-EXEHIXFI.js.br +0 -0
  131. package/dist/OrbitControls-EXEHIXFI.js.gz +0 -0
  132. package/dist/OrbitControls-PZQ4CBVS.mjs +0 -920
  133. package/dist/OrbitControls-PZQ4CBVS.mjs.br +0 -0
  134. package/dist/OrbitControls-PZQ4CBVS.mjs.gz +0 -0
  135. package/dist/UTIF-6SHLXCNF.js.br +0 -0
  136. package/dist/UTIF-6SHLXCNF.js.gz +0 -0
  137. package/dist/UTIF-CNNXS5Z5.mjs.br +0 -0
  138. package/dist/UTIF-CNNXS5Z5.mjs.gz +0 -0
  139. package/dist/chunk-4VNS5WPM.js.br +0 -0
  140. package/dist/chunk-4VNS5WPM.js.gz +0 -0
  141. package/dist/chunk-5FEQK3MW.mjs.br +0 -0
  142. package/dist/chunk-5FEQK3MW.mjs.gz +0 -0
  143. package/dist/chunk-7E6EF4GQ.js +0 -3977
  144. package/dist/chunk-7E6EF4GQ.js.br +0 -0
  145. package/dist/chunk-7E6EF4GQ.js.gz +0 -0
  146. package/dist/chunk-BP7NMPQE.mjs.br +0 -0
  147. package/dist/chunk-BP7NMPQE.mjs.gz +0 -0
  148. package/dist/chunk-C7SS65W2.mjs +0 -22197
  149. package/dist/chunk-C7SS65W2.mjs.br +0 -0
  150. package/dist/chunk-C7SS65W2.mjs.gz +0 -0
  151. package/dist/chunk-DC67MV5I.mjs +0 -3915
  152. package/dist/chunk-DC67MV5I.mjs.br +0 -0
  153. package/dist/chunk-DC67MV5I.mjs.gz +0 -0
  154. package/dist/chunk-LKL6DQ55.js +0 -4246
  155. package/dist/chunk-LKL6DQ55.js.br +0 -0
  156. package/dist/chunk-LKL6DQ55.js.gz +0 -0
  157. package/dist/chunk-M6FVQI5G.mjs.br +0 -0
  158. package/dist/chunk-M6FVQI5G.mjs.gz +0 -0
  159. package/dist/chunk-MRJZIBPQ.js.br +0 -0
  160. package/dist/chunk-MRJZIBPQ.js.gz +0 -0
  161. package/dist/chunk-MT33XQSF.js.br +0 -0
  162. package/dist/chunk-MT33XQSF.js.gz +0 -0
  163. package/dist/chunk-NJYF5KTY.mjs.br +0 -0
  164. package/dist/chunk-NJYF5KTY.mjs.gz +0 -0
  165. package/dist/chunk-Q4HRYUEP.mjs +0 -4242
  166. package/dist/chunk-Q4HRYUEP.mjs.br +0 -0
  167. package/dist/chunk-Q4HRYUEP.mjs.gz +0 -0
  168. package/dist/chunk-QS3GAPPA.js.br +0 -0
  169. package/dist/chunk-QS3GAPPA.js.gz +0 -0
  170. package/dist/chunk-QTASICXP.js +0 -22241
  171. package/dist/chunk-QTASICXP.js.br +0 -0
  172. package/dist/chunk-QTASICXP.js.gz +0 -0
  173. package/dist/chunk-XDWL6LNV.js.br +0 -0
  174. package/dist/chunk-XDWL6LNV.js.gz +0 -0
  175. package/dist/chunk-XGB3TDIC.mjs.br +0 -0
  176. package/dist/chunk-XGB3TDIC.mjs.gz +0 -0
  177. package/dist/three.module-BLHG4FHZ.js +0 -1783
  178. package/dist/three.module-BLHG4FHZ.js.br +0 -0
  179. package/dist/three.module-BLHG4FHZ.js.gz +0 -0
  180. package/dist/three.module-ZSSMKKHW.mjs +0 -2
  181. package/dist/three.module-ZSSMKKHW.mjs.br +0 -0
  182. package/dist/three.module-ZSSMKKHW.mjs.gz +0 -0
  183. package/dist/y-webrtc-F2H7BRUK.js.br +0 -0
  184. package/dist/y-webrtc-F2H7BRUK.js.gz +0 -0
  185. package/dist/y-webrtc-GAHCEZSS.mjs.br +0 -0
  186. package/dist/y-webrtc-GAHCEZSS.mjs.gz +0 -0
  187. package/dist/y-websocket-FBMB63F4.js.br +0 -0
  188. package/dist/y-websocket-FBMB63F4.js.gz +0 -0
  189. package/dist/y-websocket-MAGDFVLN.mjs.br +0 -0
  190. package/dist/y-websocket-MAGDFVLN.mjs.gz +0 -0
@@ -1,920 +0,0 @@
1
- import { Ray, Plane, MathUtils, Vector3, Controls, MOUSE, TOUCH, Quaternion, Spherical, Vector2 } from './chunk-NJYF5KTY.mjs';
2
- import './chunk-XGB3TDIC.mjs';
3
-
4
- // ../../../../node_modules/.bun/three@0.186.1/node_modules/three/examples/jsm/controls/OrbitControls.js
5
- var _changeEvent = { type: "change" };
6
- var _startEvent = { type: "start" };
7
- var _endEvent = { type: "end" };
8
- var _ray = new Ray();
9
- var _plane = new Plane();
10
- var _TILT_LIMIT = Math.cos(70 * MathUtils.DEG2RAD);
11
- var _v = new Vector3();
12
- var _twoPI = 2 * Math.PI;
13
- var _STATE = {
14
- NONE: -1,
15
- ROTATE: 0,
16
- DOLLY: 1,
17
- PAN: 2,
18
- TOUCH_ROTATE: 3,
19
- TOUCH_PAN: 4,
20
- TOUCH_DOLLY_PAN: 5,
21
- TOUCH_DOLLY_ROTATE: 6
22
- };
23
- var _EPS = 1e-6;
24
- var OrbitControls = class extends Controls {
25
- /**
26
- * Constructs a new controls instance.
27
- *
28
- * @param {Object3D} object - The object that is managed by the controls.
29
- * @param {?HTMLElement} domElement - The HTML element used for event listeners.
30
- */
31
- constructor(object, domElement = null) {
32
- super(object, domElement);
33
- this.state = _STATE.NONE;
34
- this.target = new Vector3();
35
- this.cursor = new Vector3();
36
- this.minDistance = 0;
37
- this.maxDistance = Infinity;
38
- this.minZoom = 0;
39
- this.maxZoom = Infinity;
40
- this.minTargetRadius = 0;
41
- this.maxTargetRadius = Infinity;
42
- this.minPolarAngle = 0;
43
- this.maxPolarAngle = Math.PI;
44
- this.minAzimuthAngle = -Infinity;
45
- this.maxAzimuthAngle = Infinity;
46
- this.enableDamping = false;
47
- this.dampingFactor = 0.05;
48
- this.enableZoom = true;
49
- this.zoomSpeed = 1;
50
- this.enableRotate = true;
51
- this.rotateSpeed = 1;
52
- this.keyRotateSpeed = 1;
53
- this.enablePan = true;
54
- this.panSpeed = 1;
55
- this.screenSpacePanning = true;
56
- this.keyPanSpeed = 7;
57
- this.zoomToCursor = false;
58
- this.autoRotate = false;
59
- this.autoRotateSpeed = 2;
60
- this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" };
61
- this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN };
62
- this.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN };
63
- this.target0 = this.target.clone();
64
- this.position0 = this.object.position.clone();
65
- this.zoom0 = this.object.zoom;
66
- this._cursorStyle = "auto";
67
- this._domElementKeyEvents = null;
68
- this._lastPosition = new Vector3();
69
- this._lastQuaternion = new Quaternion();
70
- this._lastTargetPosition = new Vector3();
71
- this._quat = new Quaternion().setFromUnitVectors(object.up, new Vector3(0, 1, 0));
72
- this._quatInverse = this._quat.clone().invert();
73
- this._spherical = new Spherical();
74
- this._sphericalDelta = new Spherical();
75
- this._scale = 1;
76
- this._panOffset = new Vector3();
77
- this._rotateStart = new Vector2();
78
- this._rotateEnd = new Vector2();
79
- this._rotateDelta = new Vector2();
80
- this._panStart = new Vector2();
81
- this._panEnd = new Vector2();
82
- this._panDelta = new Vector2();
83
- this._dollyStart = new Vector2();
84
- this._dollyEnd = new Vector2();
85
- this._dollyDelta = new Vector2();
86
- this._dollyDirection = new Vector3();
87
- this._mouse = new Vector2();
88
- this._performCursorZoom = false;
89
- this._pointers = [];
90
- this._pointerPositions = {};
91
- this._controlActive = false;
92
- this._onPointerMove = onPointerMove.bind(this);
93
- this._onPointerDown = onPointerDown.bind(this);
94
- this._onPointerUp = onPointerUp.bind(this);
95
- this._onContextMenu = onContextMenu.bind(this);
96
- this._onMouseWheel = onMouseWheel.bind(this);
97
- this._onKeyDown = onKeyDown.bind(this);
98
- this._onTouchStart = onTouchStart.bind(this);
99
- this._onTouchMove = onTouchMove.bind(this);
100
- this._onMouseDown = onMouseDown.bind(this);
101
- this._onMouseMove = onMouseMove.bind(this);
102
- this._interceptControlDown = interceptControlDown.bind(this);
103
- this._interceptControlUp = interceptControlUp.bind(this);
104
- if (this.domElement !== null) {
105
- this.connect(this.domElement);
106
- }
107
- this.update();
108
- }
109
- /**
110
- * Defines the visual representation of the cursor.
111
- *
112
- * @type {('auto'|'grab')}
113
- * @default 'auto'
114
- */
115
- set cursorStyle(type) {
116
- this._cursorStyle = type;
117
- if (type === "grab") {
118
- this.domElement.style.cursor = "grab";
119
- } else {
120
- this.domElement.style.cursor = "auto";
121
- }
122
- }
123
- get cursorStyle() {
124
- return this._cursorStyle;
125
- }
126
- connect(element) {
127
- super.connect(element);
128
- this.domElement.addEventListener("pointerdown", this._onPointerDown);
129
- this.domElement.addEventListener("pointercancel", this._onPointerUp);
130
- this.domElement.addEventListener("contextmenu", this._onContextMenu);
131
- this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: false });
132
- const document = this.domElement.getRootNode();
133
- document.addEventListener("keydown", this._interceptControlDown, { passive: true, capture: true });
134
- this.domElement.style.touchAction = "none";
135
- }
136
- disconnect() {
137
- this.state = _STATE.NONE;
138
- this.domElement.removeEventListener("pointerdown", this._onPointerDown);
139
- this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove);
140
- this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp);
141
- this.domElement.removeEventListener("pointercancel", this._onPointerUp);
142
- this.domElement.removeEventListener("wheel", this._onMouseWheel);
143
- this.domElement.removeEventListener("contextmenu", this._onContextMenu);
144
- this.stopListenToKeyEvents();
145
- const document = this.domElement.getRootNode();
146
- document.removeEventListener("keydown", this._interceptControlDown, { capture: true });
147
- document.removeEventListener("keyup", this._interceptControlUp, { capture: true });
148
- this._controlActive = false;
149
- this._pointers.length = 0;
150
- this._pointerPositions = {};
151
- this.domElement.style.touchAction = "";
152
- this.domElement.style.cursor = "auto";
153
- }
154
- dispose() {
155
- this.disconnect();
156
- }
157
- /**
158
- * Get the current vertical rotation, in radians.
159
- *
160
- * @return {number} The current vertical rotation, in radians.
161
- */
162
- getPolarAngle() {
163
- return this._spherical.phi;
164
- }
165
- /**
166
- * Get the current horizontal rotation, in radians.
167
- *
168
- * @return {number} The current horizontal rotation, in radians.
169
- */
170
- getAzimuthalAngle() {
171
- return this._spherical.theta;
172
- }
173
- /**
174
- * Returns the distance from the camera to the target.
175
- *
176
- * @return {number} The distance from the camera to the target.
177
- */
178
- getDistance() {
179
- return this.object.position.distanceTo(this.target);
180
- }
181
- /**
182
- * Adds key event listeners to the given DOM element.
183
- * `window` is a recommended argument for using this method.
184
- *
185
- * @param {HTMLElement} domElement - The DOM element
186
- */
187
- listenToKeyEvents(domElement) {
188
- domElement.addEventListener("keydown", this._onKeyDown);
189
- this._domElementKeyEvents = domElement;
190
- }
191
- /**
192
- * Removes the key event listener previously defined with `listenToKeyEvents()`.
193
- */
194
- stopListenToKeyEvents() {
195
- if (this._domElementKeyEvents !== null) {
196
- this._domElementKeyEvents.removeEventListener("keydown", this._onKeyDown);
197
- this._domElementKeyEvents = null;
198
- }
199
- }
200
- /**
201
- * Save the current state of the controls. This can later be recovered with `reset()`.
202
- */
203
- saveState() {
204
- this.target0.copy(this.target);
205
- this.position0.copy(this.object.position);
206
- this.zoom0 = this.object.zoom;
207
- }
208
- /**
209
- * Reset the controls to their state from either the last time the `saveState()`
210
- * was called, or the initial state.
211
- */
212
- reset() {
213
- this.target.copy(this.target0);
214
- this.object.position.copy(this.position0);
215
- this.object.zoom = this.zoom0;
216
- this.object.updateProjectionMatrix();
217
- this.dispatchEvent(_changeEvent);
218
- this.update();
219
- this.state = _STATE.NONE;
220
- }
221
- /**
222
- * Programmatically pan the camera.
223
- *
224
- * @param {number} deltaX - The horizontal pan amount in pixels.
225
- * @param {number} deltaY - The vertical pan amount in pixels.
226
- */
227
- pan(deltaX, deltaY) {
228
- this._pan(deltaX, deltaY);
229
- this.update();
230
- }
231
- /**
232
- * Programmatically dolly in (zoom in for perspective camera).
233
- *
234
- * @param {number} dollyScale - The dolly scale factor.
235
- */
236
- dollyIn(dollyScale) {
237
- this._dollyIn(dollyScale);
238
- this.update();
239
- }
240
- /**
241
- * Programmatically dolly out (zoom out for perspective camera).
242
- *
243
- * @param {number} dollyScale - The dolly scale factor.
244
- */
245
- dollyOut(dollyScale) {
246
- this._dollyOut(dollyScale);
247
- this.update();
248
- }
249
- /**
250
- * Programmatically rotate the camera left (around the vertical axis).
251
- *
252
- * @param {number} angle - The rotation angle in radians.
253
- */
254
- rotateLeft(angle) {
255
- this._rotateLeft(angle);
256
- this.update();
257
- }
258
- /**
259
- * Programmatically rotate the camera up (around the horizontal axis).
260
- *
261
- * @param {number} angle - The rotation angle in radians.
262
- */
263
- rotateUp(angle) {
264
- this._rotateUp(angle);
265
- this.update();
266
- }
267
- update(deltaTime = null) {
268
- const position = this.object.position;
269
- _v.copy(position).sub(this.target);
270
- _v.applyQuaternion(this._quat);
271
- this._spherical.setFromVector3(_v);
272
- if (this.autoRotate && this.state === _STATE.NONE) {
273
- this._rotateLeft(this._getAutoRotationAngle(deltaTime));
274
- }
275
- if (this.enableDamping) {
276
- this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor;
277
- this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor;
278
- } else {
279
- this._spherical.theta += this._sphericalDelta.theta;
280
- this._spherical.phi += this._sphericalDelta.phi;
281
- }
282
- let min = this.minAzimuthAngle;
283
- let max = this.maxAzimuthAngle;
284
- if (isFinite(min) && isFinite(max)) {
285
- if (min < -Math.PI) min += _twoPI;
286
- else if (min > Math.PI) min -= _twoPI;
287
- if (max < -Math.PI) max += _twoPI;
288
- else if (max > Math.PI) max -= _twoPI;
289
- if (min <= max) {
290
- this._spherical.theta = Math.max(min, Math.min(max, this._spherical.theta));
291
- } else {
292
- this._spherical.theta = this._spherical.theta > (min + max) / 2 ? Math.max(min, this._spherical.theta) : Math.min(max, this._spherical.theta);
293
- }
294
- }
295
- this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi));
296
- this._spherical.makeSafe();
297
- if (this.enableDamping === true) {
298
- this.target.addScaledVector(this._panOffset, this.dampingFactor);
299
- } else {
300
- this.target.add(this._panOffset);
301
- }
302
- this.target.sub(this.cursor);
303
- this.target.clampLength(this.minTargetRadius, this.maxTargetRadius);
304
- this.target.add(this.cursor);
305
- let zoomChanged = false;
306
- if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera) {
307
- this._spherical.radius = this._clampDistance(this._spherical.radius);
308
- } else {
309
- const prevRadius = this._spherical.radius;
310
- this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale);
311
- zoomChanged = prevRadius != this._spherical.radius;
312
- }
313
- _v.setFromSpherical(this._spherical);
314
- _v.applyQuaternion(this._quatInverse);
315
- position.copy(this.target).add(_v);
316
- this.object.lookAt(this.target);
317
- if (this.enableDamping === true) {
318
- this._sphericalDelta.theta *= 1 - this.dampingFactor;
319
- this._sphericalDelta.phi *= 1 - this.dampingFactor;
320
- this._panOffset.multiplyScalar(1 - this.dampingFactor);
321
- } else {
322
- this._sphericalDelta.set(0, 0, 0);
323
- this._panOffset.set(0, 0, 0);
324
- }
325
- if (this.zoomToCursor && this._performCursorZoom) {
326
- let newRadius = null;
327
- if (this.object.isPerspectiveCamera) {
328
- const prevRadius = _v.length();
329
- newRadius = this._clampDistance(prevRadius * this._scale);
330
- const radiusDelta = prevRadius - newRadius;
331
- this.object.position.addScaledVector(this._dollyDirection, radiusDelta);
332
- this.object.updateMatrixWorld();
333
- zoomChanged = !!radiusDelta;
334
- } else if (this.object.isOrthographicCamera) {
335
- const mouseBefore = new Vector3(this._mouse.x, this._mouse.y, 0);
336
- mouseBefore.unproject(this.object);
337
- const prevZoom = this.object.zoom;
338
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale));
339
- this.object.updateProjectionMatrix();
340
- zoomChanged = prevZoom !== this.object.zoom;
341
- const mouseAfter = new Vector3(this._mouse.x, this._mouse.y, 0);
342
- mouseAfter.unproject(this.object);
343
- this.object.position.sub(mouseAfter).add(mouseBefore);
344
- this.object.updateMatrixWorld();
345
- newRadius = _v.length();
346
- } else {
347
- console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.");
348
- this.zoomToCursor = false;
349
- }
350
- if (newRadius !== null) {
351
- if (this.screenSpacePanning) {
352
- this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(newRadius).add(this.object.position);
353
- } else {
354
- _ray.origin.copy(this.object.position);
355
- _ray.direction.set(0, 0, -1).transformDirection(this.object.matrix);
356
- if (Math.abs(this.object.up.dot(_ray.direction)) < _TILT_LIMIT) {
357
- this.object.lookAt(this.target);
358
- } else {
359
- _plane.setFromNormalAndCoplanarPoint(this.object.up, this.target);
360
- _ray.intersectPlane(_plane, this.target);
361
- }
362
- }
363
- }
364
- } else if (this.object.isOrthographicCamera) {
365
- const prevZoom = this.object.zoom;
366
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale));
367
- if (prevZoom !== this.object.zoom) {
368
- this.object.updateProjectionMatrix();
369
- zoomChanged = true;
370
- }
371
- }
372
- this._scale = 1;
373
- this._performCursorZoom = false;
374
- if (zoomChanged || this._lastPosition.distanceToSquared(this.object.position) > _EPS || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > _EPS || this._lastTargetPosition.distanceToSquared(this.target) > _EPS) {
375
- this.dispatchEvent(_changeEvent);
376
- this._lastPosition.copy(this.object.position);
377
- this._lastQuaternion.copy(this.object.quaternion);
378
- this._lastTargetPosition.copy(this.target);
379
- return true;
380
- }
381
- return false;
382
- }
383
- _getAutoRotationAngle(deltaTime) {
384
- if (deltaTime !== null) {
385
- return _twoPI / 60 * this.autoRotateSpeed * deltaTime;
386
- } else {
387
- return _twoPI / 60 / 60 * this.autoRotateSpeed;
388
- }
389
- }
390
- _getZoomScale(delta) {
391
- const normalizedDelta = Math.abs(delta * 0.01);
392
- return Math.pow(0.95, this.zoomSpeed * normalizedDelta);
393
- }
394
- _rotateLeft(angle) {
395
- this._sphericalDelta.theta -= angle;
396
- }
397
- _rotateUp(angle) {
398
- this._sphericalDelta.phi -= angle;
399
- }
400
- _panLeft(distance, objectMatrix) {
401
- _v.setFromMatrixColumn(objectMatrix, 0);
402
- _v.multiplyScalar(-distance);
403
- this._panOffset.add(_v);
404
- }
405
- _panUp(distance, objectMatrix) {
406
- if (this.screenSpacePanning === true) {
407
- _v.setFromMatrixColumn(objectMatrix, 1);
408
- } else {
409
- _v.setFromMatrixColumn(objectMatrix, 0);
410
- _v.crossVectors(this.object.up, _v);
411
- }
412
- _v.multiplyScalar(distance);
413
- this._panOffset.add(_v);
414
- }
415
- // deltaX and deltaY are in pixels; right and down are positive
416
- _pan(deltaX, deltaY) {
417
- const element = this.domElement;
418
- if (this.object.isPerspectiveCamera) {
419
- const position = this.object.position;
420
- _v.copy(position).sub(this.target);
421
- let targetDistance = _v.length();
422
- targetDistance *= Math.tan(this.object.fov / 2 * Math.PI / 180);
423
- this._panLeft(2 * deltaX * targetDistance / element.clientHeight, this.object.matrix);
424
- this._panUp(2 * deltaY * targetDistance / element.clientHeight, this.object.matrix);
425
- } else if (this.object.isOrthographicCamera) {
426
- this._panLeft(deltaX * (this.object.right - this.object.left) / this.object.zoom / element.clientWidth, this.object.matrix);
427
- this._panUp(deltaY * (this.object.top - this.object.bottom) / this.object.zoom / element.clientHeight, this.object.matrix);
428
- } else {
429
- console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.");
430
- this.enablePan = false;
431
- }
432
- }
433
- _dollyOut(dollyScale) {
434
- if (this.object.isPerspectiveCamera || this.object.isOrthographicCamera) {
435
- this._scale /= dollyScale;
436
- } else {
437
- console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.");
438
- this.enableZoom = false;
439
- }
440
- }
441
- _dollyIn(dollyScale) {
442
- if (this.object.isPerspectiveCamera || this.object.isOrthographicCamera) {
443
- this._scale *= dollyScale;
444
- } else {
445
- console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.");
446
- this.enableZoom = false;
447
- }
448
- }
449
- _updateZoomParameters(x, y) {
450
- if (!this.zoomToCursor) {
451
- return;
452
- }
453
- this._performCursorZoom = true;
454
- const rect = this.domElement.getBoundingClientRect();
455
- const dx = x - rect.left;
456
- const dy = y - rect.top;
457
- const w = rect.width;
458
- const h = rect.height;
459
- this._mouse.x = dx / w * 2 - 1;
460
- this._mouse.y = -(dy / h) * 2 + 1;
461
- this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
462
- }
463
- _clampDistance(dist) {
464
- return Math.max(this.minDistance, Math.min(this.maxDistance, dist));
465
- }
466
- //
467
- // event callbacks - update the object state
468
- //
469
- _handleMouseDownRotate(event) {
470
- this._rotateStart.set(event.clientX, event.clientY);
471
- }
472
- _handleMouseDownDolly(event) {
473
- this._updateZoomParameters(event.clientX, event.clientX);
474
- this._dollyStart.set(event.clientX, event.clientY);
475
- }
476
- _handleMouseDownPan(event) {
477
- this._panStart.set(event.clientX, event.clientY);
478
- }
479
- _handleMouseMoveRotate(event) {
480
- this._rotateEnd.set(event.clientX, event.clientY);
481
- this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
482
- const element = this.domElement;
483
- this._rotateLeft(_twoPI * this._rotateDelta.x / element.clientHeight);
484
- this._rotateUp(_twoPI * this._rotateDelta.y / element.clientHeight);
485
- this._rotateStart.copy(this._rotateEnd);
486
- this.update();
487
- }
488
- _handleMouseMoveDolly(event) {
489
- this._dollyEnd.set(event.clientX, event.clientY);
490
- this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart);
491
- if (this._dollyDelta.y > 0) {
492
- this._dollyOut(this._getZoomScale(this._dollyDelta.y));
493
- } else if (this._dollyDelta.y < 0) {
494
- this._dollyIn(this._getZoomScale(this._dollyDelta.y));
495
- }
496
- this._dollyStart.copy(this._dollyEnd);
497
- this.update();
498
- }
499
- _handleMouseMovePan(event) {
500
- this._panEnd.set(event.clientX, event.clientY);
501
- this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed);
502
- this._pan(this._panDelta.x, this._panDelta.y);
503
- this._panStart.copy(this._panEnd);
504
- this.update();
505
- }
506
- _handleMouseWheel(event) {
507
- this._updateZoomParameters(event.clientX, event.clientY);
508
- if (event.deltaY < 0) {
509
- this._dollyIn(this._getZoomScale(event.deltaY));
510
- } else if (event.deltaY > 0) {
511
- this._dollyOut(this._getZoomScale(event.deltaY));
512
- }
513
- this.update();
514
- }
515
- _handleKeyDown(event) {
516
- let needsUpdate = false;
517
- switch (event.code) {
518
- case this.keys.UP:
519
- if (event.ctrlKey || event.metaKey || event.shiftKey) {
520
- if (this.enableRotate) {
521
- this._rotateUp(_twoPI * this.keyRotateSpeed / this.domElement.clientHeight);
522
- }
523
- } else {
524
- if (this.enablePan) {
525
- this._pan(0, this.keyPanSpeed);
526
- }
527
- }
528
- needsUpdate = true;
529
- break;
530
- case this.keys.BOTTOM:
531
- if (event.ctrlKey || event.metaKey || event.shiftKey) {
532
- if (this.enableRotate) {
533
- this._rotateUp(-_twoPI * this.keyRotateSpeed / this.domElement.clientHeight);
534
- }
535
- } else {
536
- if (this.enablePan) {
537
- this._pan(0, -this.keyPanSpeed);
538
- }
539
- }
540
- needsUpdate = true;
541
- break;
542
- case this.keys.LEFT:
543
- if (event.ctrlKey || event.metaKey || event.shiftKey) {
544
- if (this.enableRotate) {
545
- this._rotateLeft(_twoPI * this.keyRotateSpeed / this.domElement.clientHeight);
546
- }
547
- } else {
548
- if (this.enablePan) {
549
- this._pan(this.keyPanSpeed, 0);
550
- }
551
- }
552
- needsUpdate = true;
553
- break;
554
- case this.keys.RIGHT:
555
- if (event.ctrlKey || event.metaKey || event.shiftKey) {
556
- if (this.enableRotate) {
557
- this._rotateLeft(-_twoPI * this.keyRotateSpeed / this.domElement.clientHeight);
558
- }
559
- } else {
560
- if (this.enablePan) {
561
- this._pan(-this.keyPanSpeed, 0);
562
- }
563
- }
564
- needsUpdate = true;
565
- break;
566
- }
567
- if (needsUpdate) {
568
- event.preventDefault();
569
- this.update();
570
- }
571
- }
572
- _handleTouchStartRotate(event) {
573
- if (this._pointers.length === 1) {
574
- this._rotateStart.set(event.pageX, event.pageY);
575
- } else {
576
- const position = this._getSecondPointerPosition(event);
577
- const x = 0.5 * (event.pageX + position.x);
578
- const y = 0.5 * (event.pageY + position.y);
579
- this._rotateStart.set(x, y);
580
- }
581
- }
582
- _handleTouchStartPan(event) {
583
- if (this._pointers.length === 1) {
584
- this._panStart.set(event.pageX, event.pageY);
585
- } else {
586
- const position = this._getSecondPointerPosition(event);
587
- const x = 0.5 * (event.pageX + position.x);
588
- const y = 0.5 * (event.pageY + position.y);
589
- this._panStart.set(x, y);
590
- }
591
- }
592
- _handleTouchStartDolly(event) {
593
- const position = this._getSecondPointerPosition(event);
594
- const dx = event.pageX - position.x;
595
- const dy = event.pageY - position.y;
596
- const distance = Math.sqrt(dx * dx + dy * dy);
597
- this._dollyStart.set(0, distance);
598
- }
599
- _handleTouchStartDollyPan(event) {
600
- if (this.enableZoom) this._handleTouchStartDolly(event);
601
- if (this.enablePan) this._handleTouchStartPan(event);
602
- }
603
- _handleTouchStartDollyRotate(event) {
604
- if (this.enableZoom) this._handleTouchStartDolly(event);
605
- if (this.enableRotate) this._handleTouchStartRotate(event);
606
- }
607
- _handleTouchMoveRotate(event) {
608
- if (this._pointers.length == 1) {
609
- this._rotateEnd.set(event.pageX, event.pageY);
610
- } else {
611
- const position = this._getSecondPointerPosition(event);
612
- const x = 0.5 * (event.pageX + position.x);
613
- const y = 0.5 * (event.pageY + position.y);
614
- this._rotateEnd.set(x, y);
615
- }
616
- this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
617
- const element = this.domElement;
618
- this._rotateLeft(_twoPI * this._rotateDelta.x / element.clientHeight);
619
- this._rotateUp(_twoPI * this._rotateDelta.y / element.clientHeight);
620
- this._rotateStart.copy(this._rotateEnd);
621
- }
622
- _handleTouchMovePan(event) {
623
- if (this._pointers.length === 1) {
624
- this._panEnd.set(event.pageX, event.pageY);
625
- } else {
626
- const position = this._getSecondPointerPosition(event);
627
- const x = 0.5 * (event.pageX + position.x);
628
- const y = 0.5 * (event.pageY + position.y);
629
- this._panEnd.set(x, y);
630
- }
631
- this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed);
632
- this._pan(this._panDelta.x, this._panDelta.y);
633
- this._panStart.copy(this._panEnd);
634
- }
635
- _handleTouchMoveDolly(event) {
636
- const position = this._getSecondPointerPosition(event);
637
- const dx = event.pageX - position.x;
638
- const dy = event.pageY - position.y;
639
- const distance = Math.sqrt(dx * dx + dy * dy);
640
- this._dollyEnd.set(0, distance);
641
- this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed));
642
- this._dollyOut(this._dollyDelta.y);
643
- this._dollyStart.copy(this._dollyEnd);
644
- const centerX = (event.pageX + position.x) * 0.5;
645
- const centerY = (event.pageY + position.y) * 0.5;
646
- this._updateZoomParameters(centerX, centerY);
647
- }
648
- _handleTouchMoveDollyPan(event) {
649
- if (this.enableZoom) this._handleTouchMoveDolly(event);
650
- if (this.enablePan) this._handleTouchMovePan(event);
651
- }
652
- _handleTouchMoveDollyRotate(event) {
653
- if (this.enableZoom) this._handleTouchMoveDolly(event);
654
- if (this.enableRotate) this._handleTouchMoveRotate(event);
655
- }
656
- // pointers
657
- _addPointer(event) {
658
- this._pointers.push(event.pointerId);
659
- }
660
- _removePointer(event) {
661
- delete this._pointerPositions[event.pointerId];
662
- for (let i = 0; i < this._pointers.length; i++) {
663
- if (this._pointers[i] == event.pointerId) {
664
- this._pointers.splice(i, 1);
665
- return;
666
- }
667
- }
668
- }
669
- _isTrackingPointer(event) {
670
- for (let i = 0; i < this._pointers.length; i++) {
671
- if (this._pointers[i] == event.pointerId) return true;
672
- }
673
- return false;
674
- }
675
- _trackPointer(event) {
676
- let position = this._pointerPositions[event.pointerId];
677
- if (position === void 0) {
678
- position = new Vector2();
679
- this._pointerPositions[event.pointerId] = position;
680
- }
681
- position.set(event.pageX, event.pageY);
682
- }
683
- _getSecondPointerPosition(event) {
684
- const pointerId = event.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
685
- return this._pointerPositions[pointerId];
686
- }
687
- //
688
- _customWheelEvent(event) {
689
- const mode = event.deltaMode;
690
- const newEvent = {
691
- clientX: event.clientX,
692
- clientY: event.clientY,
693
- deltaY: event.deltaY
694
- };
695
- switch (mode) {
696
- case 1:
697
- newEvent.deltaY *= 16;
698
- break;
699
- case 2:
700
- newEvent.deltaY *= 100;
701
- break;
702
- }
703
- if (event.ctrlKey && !this._controlActive) {
704
- newEvent.deltaY *= 10;
705
- }
706
- return newEvent;
707
- }
708
- };
709
- function onPointerDown(event) {
710
- if (this.enabled === false) return;
711
- if (this._pointers.length === 0) {
712
- this.domElement.setPointerCapture(event.pointerId);
713
- this.domElement.ownerDocument.addEventListener("pointermove", this._onPointerMove);
714
- this.domElement.ownerDocument.addEventListener("pointerup", this._onPointerUp);
715
- }
716
- if (this._isTrackingPointer(event)) return;
717
- this._addPointer(event);
718
- if (event.pointerType === "touch") {
719
- this._onTouchStart(event);
720
- } else {
721
- this._onMouseDown(event);
722
- }
723
- if (this._cursorStyle === "grab") {
724
- this.domElement.style.cursor = "grabbing";
725
- }
726
- }
727
- function onPointerMove(event) {
728
- if (this.enabled === false) return;
729
- if (event.pointerType === "touch") {
730
- this._onTouchMove(event);
731
- } else {
732
- this._onMouseMove(event);
733
- }
734
- }
735
- function onPointerUp(event) {
736
- this._removePointer(event);
737
- switch (this._pointers.length) {
738
- case 0:
739
- this.domElement.releasePointerCapture(event.pointerId);
740
- this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove);
741
- this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp);
742
- this.dispatchEvent(_endEvent);
743
- this.state = _STATE.NONE;
744
- if (this._cursorStyle === "grab") {
745
- this.domElement.style.cursor = "grab";
746
- }
747
- break;
748
- case 1:
749
- const pointerId = this._pointers[0];
750
- const position = this._pointerPositions[pointerId];
751
- this._onTouchStart({ pointerId, pageX: position.x, pageY: position.y });
752
- break;
753
- }
754
- }
755
- function onMouseDown(event) {
756
- let mouseAction;
757
- switch (event.button) {
758
- case 0:
759
- mouseAction = this.mouseButtons.LEFT;
760
- break;
761
- case 1:
762
- mouseAction = this.mouseButtons.MIDDLE;
763
- break;
764
- case 2:
765
- mouseAction = this.mouseButtons.RIGHT;
766
- break;
767
- default:
768
- mouseAction = -1;
769
- }
770
- switch (mouseAction) {
771
- case MOUSE.DOLLY:
772
- if (this.enableZoom === false) return;
773
- this._handleMouseDownDolly(event);
774
- this.state = _STATE.DOLLY;
775
- break;
776
- case MOUSE.ROTATE:
777
- if (event.ctrlKey || event.metaKey || event.shiftKey) {
778
- if (this.enablePan === false) return;
779
- this._handleMouseDownPan(event);
780
- this.state = _STATE.PAN;
781
- } else {
782
- if (this.enableRotate === false) return;
783
- this._handleMouseDownRotate(event);
784
- this.state = _STATE.ROTATE;
785
- }
786
- break;
787
- case MOUSE.PAN:
788
- if (event.ctrlKey || event.metaKey || event.shiftKey) {
789
- if (this.enableRotate === false) return;
790
- this._handleMouseDownRotate(event);
791
- this.state = _STATE.ROTATE;
792
- } else {
793
- if (this.enablePan === false) return;
794
- this._handleMouseDownPan(event);
795
- this.state = _STATE.PAN;
796
- }
797
- break;
798
- default:
799
- this.state = _STATE.NONE;
800
- }
801
- if (this.state !== _STATE.NONE) {
802
- this.dispatchEvent(_startEvent);
803
- }
804
- }
805
- function onMouseMove(event) {
806
- switch (this.state) {
807
- case _STATE.ROTATE:
808
- if (this.enableRotate === false) return;
809
- this._handleMouseMoveRotate(event);
810
- break;
811
- case _STATE.DOLLY:
812
- if (this.enableZoom === false) return;
813
- this._handleMouseMoveDolly(event);
814
- break;
815
- case _STATE.PAN:
816
- if (this.enablePan === false) return;
817
- this._handleMouseMovePan(event);
818
- break;
819
- }
820
- }
821
- function onMouseWheel(event) {
822
- if (this.enabled === false || this.enableZoom === false || this.state !== _STATE.NONE) return;
823
- event.preventDefault();
824
- this.dispatchEvent(_startEvent);
825
- this._handleMouseWheel(this._customWheelEvent(event));
826
- this.dispatchEvent(_endEvent);
827
- }
828
- function onKeyDown(event) {
829
- if (this.enabled === false) return;
830
- this._handleKeyDown(event);
831
- }
832
- function onTouchStart(event) {
833
- this._trackPointer(event);
834
- switch (this._pointers.length) {
835
- case 1:
836
- switch (this.touches.ONE) {
837
- case TOUCH.ROTATE:
838
- if (this.enableRotate === false) return;
839
- this._handleTouchStartRotate(event);
840
- this.state = _STATE.TOUCH_ROTATE;
841
- break;
842
- case TOUCH.PAN:
843
- if (this.enablePan === false) return;
844
- this._handleTouchStartPan(event);
845
- this.state = _STATE.TOUCH_PAN;
846
- break;
847
- default:
848
- this.state = _STATE.NONE;
849
- }
850
- break;
851
- case 2:
852
- switch (this.touches.TWO) {
853
- case TOUCH.DOLLY_PAN:
854
- if (this.enableZoom === false && this.enablePan === false) return;
855
- this._handleTouchStartDollyPan(event);
856
- this.state = _STATE.TOUCH_DOLLY_PAN;
857
- break;
858
- case TOUCH.DOLLY_ROTATE:
859
- if (this.enableZoom === false && this.enableRotate === false) return;
860
- this._handleTouchStartDollyRotate(event);
861
- this.state = _STATE.TOUCH_DOLLY_ROTATE;
862
- break;
863
- default:
864
- this.state = _STATE.NONE;
865
- }
866
- break;
867
- default:
868
- this.state = _STATE.NONE;
869
- }
870
- if (this.state !== _STATE.NONE) {
871
- this.dispatchEvent(_startEvent);
872
- }
873
- }
874
- function onTouchMove(event) {
875
- this._trackPointer(event);
876
- switch (this.state) {
877
- case _STATE.TOUCH_ROTATE:
878
- if (this.enableRotate === false) return;
879
- this._handleTouchMoveRotate(event);
880
- this.update();
881
- break;
882
- case _STATE.TOUCH_PAN:
883
- if (this.enablePan === false) return;
884
- this._handleTouchMovePan(event);
885
- this.update();
886
- break;
887
- case _STATE.TOUCH_DOLLY_PAN:
888
- if (this.enableZoom === false && this.enablePan === false) return;
889
- this._handleTouchMoveDollyPan(event);
890
- this.update();
891
- break;
892
- case _STATE.TOUCH_DOLLY_ROTATE:
893
- if (this.enableZoom === false && this.enableRotate === false) return;
894
- this._handleTouchMoveDollyRotate(event);
895
- this.update();
896
- break;
897
- default:
898
- this.state = _STATE.NONE;
899
- }
900
- }
901
- function onContextMenu(event) {
902
- if (this.enabled === false) return;
903
- event.preventDefault();
904
- }
905
- function interceptControlDown(event) {
906
- if (event.key === "Control") {
907
- this._controlActive = true;
908
- const document = this.domElement.getRootNode();
909
- document.addEventListener("keyup", this._interceptControlUp, { passive: true, capture: true });
910
- }
911
- }
912
- function interceptControlUp(event) {
913
- if (event.key === "Control") {
914
- this._controlActive = false;
915
- const document = this.domElement.getRootNode();
916
- document.removeEventListener("keyup", this._interceptControlUp, { passive: true, capture: true });
917
- }
918
- }
919
-
920
- export { OrbitControls };