Skip to content

Commit 4960d15

Browse files
sciecodeAdaRoseCannon
authored andcommitted
OrbitControls: fix Orthographic 'change' event (mrdoob#27424)
* OrbitControls: fix Orthographic 'change' event Signed-off-by: Guilherme Avila <3927951+sciecode@users.noreply.github.com> * OrbitControls: only recalculate when zoom has changed Signed-off-by: Guilherme Avila <3927951+sciecode@users.noreply.github.com> * clean-up Signed-off-by: Guilherme Avila <3927951+sciecode@users.noreply.github.com> --------- Signed-off-by: Guilherme Avila <3927951+sciecode@users.noreply.github.com>
1 parent 303dfc9 commit 4960d15

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

examples/jsm/controls/OrbitControls.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,15 @@ class OrbitControls extends EventDispatcher {
373373
}
374374

375375
} else if ( scope.object.isOrthographicCamera ) {
376+
377+
zoomChanged = scale !== 1;
376378

377-
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
378-
scope.object.updateProjectionMatrix();
379-
zoomChanged = true;
379+
if ( zoomChanged ) {
380+
381+
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
382+
scope.object.updateProjectionMatrix();
383+
384+
}
380385

381386
}
382387

0 commit comments

Comments
 (0)