@needle-tools/three 0.169.2 → 0.169.3
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.
|
@@ -370,27 +370,27 @@ class OrbitControls extends Controls {
|
|
|
370
370
|
this.target.add( this.cursor );
|
|
371
371
|
|
|
372
372
|
let zoomChanged = false;
|
|
373
|
-
// adjust the camera position based on zoom only if we're not zooming to the cursor or if it's an ortho camera
|
|
374
|
-
// we adjust zoom later in these cases
|
|
375
|
-
if ( this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera ) {
|
|
376
373
|
|
|
377
|
-
|
|
374
|
+
if ( this.enableDamping ) {
|
|
375
|
+
|
|
376
|
+
this._currentScale = MathUtils.lerp( this._currentScale, this._scale, this.dampingFactor );
|
|
378
377
|
|
|
379
378
|
} else {
|
|
380
379
|
|
|
381
|
-
|
|
380
|
+
this._currentScale = this._scale;
|
|
382
381
|
|
|
383
|
-
|
|
382
|
+
}
|
|
384
383
|
|
|
385
|
-
|
|
384
|
+
// adjust the camera position based on zoom only if we're not zooming to the cursor or if it's an ortho camera
|
|
385
|
+
// we adjust zoom later in these cases
|
|
386
|
+
if ( this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera ) {
|
|
386
387
|
|
|
387
|
-
|
|
388
|
+
this._spherical.radius = this._clampDistance( this._spherical.radius );
|
|
388
389
|
|
|
389
|
-
|
|
390
|
+
} else {
|
|
390
391
|
|
|
391
|
-
this._spherical.radius = this._clampDistance( this._spherical.radius * this._currentScale );
|
|
392
392
|
const prevRadius = this._spherical.radius;
|
|
393
|
-
this._spherical.radius = this._clampDistance( this._spherical.radius * this.
|
|
393
|
+
this._spherical.radius = this._clampDistance( this._spherical.radius * this._currentScale );
|
|
394
394
|
zoomChanged = prevRadius != this._spherical.radius;
|
|
395
395
|
|
|
396
396
|
}
|
|
@@ -429,7 +429,7 @@ class OrbitControls extends Controls {
|
|
|
429
429
|
// move the camera down the pointer ray
|
|
430
430
|
// this method avoids floating point error
|
|
431
431
|
const prevRadius = _v.length();
|
|
432
|
-
newRadius = this._clampDistance( prevRadius * this.
|
|
432
|
+
newRadius = this._clampDistance( prevRadius * this._currentScale );
|
|
433
433
|
|
|
434
434
|
const radiusDelta = prevRadius - newRadius;
|
|
435
435
|
this.object.position.addScaledVector( this._dollyDirection, radiusDelta );
|
|
@@ -444,7 +444,7 @@ class OrbitControls extends Controls {
|
|
|
444
444
|
mouseBefore.unproject( this.object );
|
|
445
445
|
|
|
446
446
|
const prevZoom = this.object.zoom;
|
|
447
|
-
this.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom / this.
|
|
447
|
+
this.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom / this._currentScale ) );
|
|
448
448
|
this.object.updateProjectionMatrix();
|
|
449
449
|
|
|
450
450
|
zoomChanged = prevZoom !== this.object.zoom;
|
|
@@ -513,8 +513,6 @@ class OrbitControls extends Controls {
|
|
|
513
513
|
}
|
|
514
514
|
|
|
515
515
|
this._scale = 1;
|
|
516
|
-
this._currentScale = 1;
|
|
517
|
-
this._performCursorZoom = false;
|
|
518
516
|
|
|
519
517
|
// update condition is:
|
|
520
518
|
// min(camera displacement, camera rotation in radians)^2 > EPS
|
|
@@ -535,6 +533,9 @@ class OrbitControls extends Controls {
|
|
|
535
533
|
|
|
536
534
|
}
|
|
537
535
|
|
|
536
|
+
|
|
537
|
+
this._performCursorZoom = false;
|
|
538
|
+
|
|
538
539
|
return false;
|
|
539
540
|
|
|
540
541
|
}
|
|
@@ -608,10 +609,7 @@ class OrbitControls extends Controls {
|
|
|
608
609
|
if ( this.object.isPerspectiveCamera ) {
|
|
609
610
|
|
|
610
611
|
// perspective
|
|
611
|
-
|
|
612
|
-
const position = this.object.position;
|
|
613
|
-
this.object.getWorldPosition( position );
|
|
614
|
-
_v.copy( position ).sub( this.target );
|
|
612
|
+
this.object.getWorldPosition( _v ).sub( this.target );
|
|
615
613
|
let targetDistance = _v.length();
|
|
616
614
|
|
|
617
615
|
// half of the fov is center to top of screen
|