Skip to content

Commit 825841c

Browse files
committed
fix(GlobeControls): fix jittering move globe when devtool is open
1 parent ae1c30b commit 825841c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Controls/GlobeControls.js

+7
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,10 @@ class GlobeControls extends THREE.EventDispatcher {
569569
handleDrag(event) {
570570
const normalized = this.view.viewToNormalizedCoords(event.viewCoords);
571571

572+
// An updateMatrixWorld on the camera prevents camera jittering when moving globe on a zoomed out view, with
573+
// devtools open in web browser.
574+
this.camera.updateMatrixWorld();
575+
572576
raycaster.setFromCamera(normalized, this.camera);
573577

574578
// If there's intersection then move globe else we stop the move
@@ -815,6 +819,9 @@ class GlobeControls extends THREE.EventDispatcher {
815819
case this.states.MOVE_GLOBE.finger: {
816820
const coords = this.view.eventToViewCoords(event);
817821
const normalized = this.view.viewToNormalizedCoords(coords);
822+
// An updateMatrixWorld on the camera prevents camera jittering when moving globe on a zoomed out view, with
823+
// devtools open in web browser.
824+
this.camera.updateMatrixWorld();
818825
raycaster.setFromCamera(normalized, this.camera);
819826
// If there's intersection then move globe else we stop the move
820827
if (raycaster.ray.intersectSphere(pickSphere, intersection)) {

0 commit comments

Comments
 (0)