Skip to content

Commit

Permalink
fixed non-finite bugs (google#1133)
Browse files Browse the repository at this point in the history
  • Loading branch information
elalish authored Apr 9, 2020
1 parent bae62df commit ff255de
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/model-viewer/src/three-components/SmoothControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,11 @@ export class SmoothControls extends EventDispatcher {
(radius - minimumRadius!) /
(this[$goalLogFov] - Math.log(minimumFieldOfView!));

const goalRadius =
radius + (isFinite(deltaRatio) ? deltaZoom * deltaRatio : 0);
const goalRadius = radius +
deltaZoom *
Math.min(
isFinite(deltaRatio) ? deltaRatio : Infinity,
maximumRadius! - minimumRadius!);
let handled = this.setOrbit(goalTheta, goalPhi, goalRadius);

if (deltaZoom !== 0) {
Expand Down

0 comments on commit ff255de

Please sign in to comment.