Spaces:
Running
Running
Upload 85 files
Browse files- dist/index.js +0 -0
- dist/index.js.map +0 -0
- src/controls/OrbitControls.ts +9 -9
dist/index.js
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
dist/index.js.map
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
src/controls/OrbitControls.ts
CHANGED
@@ -4,12 +4,12 @@ import { Quaternion } from "../math/Quaternion";
|
|
4 |
import { Vector3 } from "../math/Vector3";
|
5 |
|
6 |
class OrbitControls {
|
7 |
-
// Vertical (polar) limits:
|
8 |
-
minAngle: number = -
|
9 |
-
maxAngle: number =
|
10 |
-
//
|
11 |
-
minAzimuth: number = -
|
12 |
-
maxAzimuth: number =
|
13 |
minZoom: number = 0.1;
|
14 |
maxZoom: number = 30;
|
15 |
orbitSpeed: number = 1;
|
@@ -128,7 +128,7 @@ class OrbitControls {
|
|
128 |
} else {
|
129 |
desiredAlpha -= dx * this.orbitSpeed * 0.003;
|
130 |
desiredBeta += dy * this.orbitSpeed * 0.003;
|
131 |
-
// Clamp
|
132 |
desiredBeta = Math.min(
|
133 |
Math.max(desiredBeta, (this.minAngle * Math.PI) / 180),
|
134 |
(this.maxAngle * Math.PI) / 180,
|
@@ -202,7 +202,7 @@ class OrbitControls {
|
|
202 |
|
203 |
desiredAlpha -= dx * this.orbitSpeed * 0.003;
|
204 |
desiredBeta += dy * this.orbitSpeed * 0.003;
|
205 |
-
// Clamp
|
206 |
desiredBeta = Math.min(
|
207 |
Math.max(desiredBeta, (this.minAngle * Math.PI) / 180),
|
208 |
(this.maxAngle * Math.PI) / 180,
|
@@ -250,7 +250,7 @@ class OrbitControls {
|
|
250 |
// Horizontal (azimuth) rotation with 'e' and 'q'
|
251 |
if (keys["KeyE"]) desiredAlpha += rotateSpeed;
|
252 |
if (keys["KeyQ"]) desiredAlpha -= rotateSpeed;
|
253 |
-
// Clamp
|
254 |
desiredAlpha = Math.min(
|
255 |
Math.max(desiredAlpha, (this.minAzimuth * Math.PI) / 180),
|
256 |
(this.maxAzimuth * Math.PI) / 180
|
|
|
4 |
import { Vector3 } from "../math/Vector3";
|
5 |
|
6 |
class OrbitControls {
|
7 |
+
// Vertical (polar) limits: by default, free rotation.
|
8 |
+
minAngle: number = -Infinity;
|
9 |
+
maxAngle: number = Infinity;
|
10 |
+
// Horizontal (azimuth) limits: by default, free rotation.
|
11 |
+
minAzimuth: number = -Infinity;
|
12 |
+
maxAzimuth: number = Infinity;
|
13 |
minZoom: number = 0.1;
|
14 |
maxZoom: number = 30;
|
15 |
orbitSpeed: number = 1;
|
|
|
128 |
} else {
|
129 |
desiredAlpha -= dx * this.orbitSpeed * 0.003;
|
130 |
desiredBeta += dy * this.orbitSpeed * 0.003;
|
131 |
+
// Clamp vertical angle (beta) only if limits are finite
|
132 |
desiredBeta = Math.min(
|
133 |
Math.max(desiredBeta, (this.minAngle * Math.PI) / 180),
|
134 |
(this.maxAngle * Math.PI) / 180,
|
|
|
202 |
|
203 |
desiredAlpha -= dx * this.orbitSpeed * 0.003;
|
204 |
desiredBeta += dy * this.orbitSpeed * 0.003;
|
205 |
+
// Clamp vertical (polar) angle (beta) if limits are finite
|
206 |
desiredBeta = Math.min(
|
207 |
Math.max(desiredBeta, (this.minAngle * Math.PI) / 180),
|
208 |
(this.maxAngle * Math.PI) / 180,
|
|
|
250 |
// Horizontal (azimuth) rotation with 'e' and 'q'
|
251 |
if (keys["KeyE"]) desiredAlpha += rotateSpeed;
|
252 |
if (keys["KeyQ"]) desiredAlpha -= rotateSpeed;
|
253 |
+
// Clamp horizontal angle (azimuth) only if limits are finite
|
254 |
desiredAlpha = Math.min(
|
255 |
Math.max(desiredAlpha, (this.minAzimuth * Math.PI) / 180),
|
256 |
(this.maxAzimuth * Math.PI) / 180
|