Skip to content

Commit

Permalink
Fix "reseting" timeout when autorotate is off (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
franknoirot authored Jan 26, 2024
1 parent 0f32fde commit a547c2e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/ModelViewer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
interactivity()
let shouldAutoRotate = true
$: shouldAutoRotate = enableAutoRotate
const AUTO_ROTATE_PAUSE = 5000
// This allows autorotate to be paused when the user is interacting with the model
Expand All @@ -28,7 +28,7 @@
const reenableAutoRotate = () => {
if (!pausable) return
autorotateTimeout = setTimeout(function () {
shouldAutoRotate = true
shouldAutoRotate = enableAutoRotate
}, AUTO_ROTATE_PAUSE)
}
Expand Down Expand Up @@ -79,7 +79,7 @@
>
<OrbitControls
enableDamping
autoRotate={enableAutoRotate && shouldAutoRotate}
autoRotate={shouldAutoRotate}
{enableZoom}
on:start={disableAutoRotate}
on:end={reenableAutoRotate}
Expand Down

0 comments on commit a547c2e

Please sign in to comment.