Skip to content

fix/1529-invalidate-presentation-controls #2432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nielsvdpol
Copy link

@nielsvdpol nielsvdpol commented Apr 23, 2025

Why

Resolves: #1529
When using <Canvas frameloop="demand" />, the PresentationControls component was non-functional because interactions and easing animations did not automatically trigger re-renders. Since frameloop="demand" disables continuous rendering, it requires manual invalidation of the render loop to update the scene. Without this, changes to rotation or scale weren't reflected visually.

This PR fixes that issue by ensuring the component properly invalidates the render loop on interaction and animation updates, restoring expected behavior when frameloop="demand" is in use.

What

  • Fixed broken behavior under frameloop="demand" by manually triggering re-renders with invalidate() from useThree.
  • Called invalidate():
    • Inside onDrag and onDragEnd gesture handlers to ensure updates apply during/after interactions.
    • Inside the useFrame loop when easing causes a change to rotation or scale.
  • This ensures the component works correctly in both default and frameloop="demand" render modes.

Checklist

  • Ready to be merged

Copy link

vercel bot commented Apr 23, 2025

@nielsvdpol is attempting to deploy a commit to the Poimandres Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PresentationControls doesn't trigger invalidate() onChange
1 participant