fix: use cached matrix in viewportToFramedGraph when no override is given - #1543
Open
shaked-shlomo wants to merge 1 commit into
Open
fix: use cached matrix in viewportToFramedGraph when no override is given#1543shaked-shlomo wants to merge 1 commit into
shaked-shlomo wants to merge 1 commit into
Conversation
…de given recomputeMatrix used a single negation on the last term (!override.graphDimensions) instead of the double negation used by the sibling framedGraphToViewport (!!override.graphDimensions). The intent is to recompute only when an override that affects the matrix is supplied; the stray single ! instead forced a recompute whenever graphDimensions was NOT provided -- i.e. on the normal no-override calls used by mouse pan/zoom and touch handlers. As a result viewportToFramedGraph built its inverse from the live camera state while framedGraphToViewport used the matrix snapshotted at the last render(), desyncing the two halves of the round-trip during camera animations. Matches the fix already on the v4 branch (940ad72).
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.
Bug
viewportToFramedGraphcomputesrecomputeMatrixwith a single negation on the last term:while its sibling
framedGraphToViewportuses a double negation:recomputeMatrixis meant to betrueonly when the caller passes an override that affects the matrix. Because of the stray single!,viewportToFramedGraphinstead recomputes whenevergraphDimensionsis not provided — i.e. on the normal no-override calls made by the mouse (mouse.tsdrag/pan, wheel zoom) and touch handlers.Impact
On those paths the method bypasses the cached
this.invMatrixand rebuilds the inverse from the livethis.camera.getState(), whereasframedGraphToViewportcorrectly usesthis.matrixsnapshotted at the lastrender(). During a camera animation the live state runs ahead of the rendered matrix, so the two conversions operate on different camera states within the same frame — causing the round-trip to desync (jumpy pan/zoom anchoring).Fix
Change
!override.graphDimensions→!!override.graphDimensions, matchingframedGraphToViewport. This is the same one-character fix already present on thev4branch (commit940ad72a); this backports it tomain.