Repository navigation
Conversation
A WebGL context that draws nothing, and helpers that render <Canvas> in a map layer or over the map and draw frames. vitest loads R3F's ES build, because its CommonJS build would load three's CommonJS build next to the ES build the tests use.
Both canvas modes draw only when the map repaints. With frameloop="demand", nothing asked for a repaint when the latitude, longitude or altitude of <Canvas> or <Coordinates> changed, so the scene and the pointer camera kept the old origin until the map moved. They now ask for one when their origin matrix changes.
🦋 Changeset detectedLatest commit: 817c30c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This also came up on our work on adding ellipsoid support to react-three-map. I'm not sure what your (agentic) contribution policy is, so happy to work on the PR based on your feedback :)
Built with help from @RichardMEN11.
Problem
Both canvas modes draw only when the map repaints: in a map layer, the layer's
render, and over the map, the custom layer that feeds the overlay its view projection. Withframeloop="demand", nothing asks for a repaint when thelatitude,longitudeoraltitudeof<Canvas>or of a<Coordinates>change. So the scene, and the camera that pointer events use, keep the old origin until the map moves for another reason. R3F only asks for one when an object's props change, which a moved origin doesn't do.Change
useRender), over the map (SyncCameraFC) and in<Coordinates>, an effect asks the map to repaint when the origin matrix changes.Testing
Render <Canvas> in happy-dom for component tests, is shared with the<NearCoordinates>PR; see there.src/test/repaint.test.tsx, in both canvas modes withframeloop="demand"and a scene with nothing that changes with the origin: the map is asked to repaint when the canvas moves, when it rises, and when a<Coordinates>moves, before any frame is drawn.yarn lint,ts:check,testandbuildpass.Notes
<NearCoordinates>PR share their first commit, and merging both conflicts only in the React import line ofsrc/api/coordinates.tsx, where each adds a hook.🤖 Generated with Claude Code