Repository navigation
Keep the editor's coordinates when the library rebuilds underneath it - #405
Merged
Merged
Conversation
The editor opens on top of the library, which stays mounted and rebuilds whenever something it watches changes (a cloud folder list update, a token refresh). Each rebuild replaced the shared CoordinateSystem with one sized for window height - 90, while the editor's canvas is window height - 40 since the editor took the library's 40px strip. Every item, lineup line and stroke redrawn after that landed about 6% closer to the top-left until the canvas laid out again. Only a canvas sets the coordinates now. Until one has laid out, the capture size stands in, so a strategy can still load first.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Users on Discord ("Line up path moving", Oct 22 and Oct 28) see lineup lines, and sometimes agents and abilities, slide off their spots while they edit. Leaving to the library and reopening the strategy puts them back, until it happens again.
Cause
Every placed item, lineup line and drawing converts between world and screen through one shared
CoordinateSystem, and whichever widget built last set it. The editor's canvas sets it as it lays out, sized to its own height: the window minus the 40px strip. The library (FolderNavigator) also set it on every build, sized towindow height − 90. That matched the editor's old 90px header. Since the editor moved to the library's 40px strip on Sept 12 (35a0a2a2, first shipped in 5.0.0), the two sizes have differed by about 6%.The editor opens on top of the library, and the library stays mounted underneath it. Whenever something the library watches changes, it rebuilds and replaces the editor's coordinates with the smaller size. From then until the canvas lays out again, anything that redraws (a hovered lineup's lines, agents re-laid after a new one is placed, strokes) is drawn about 6% closer to the top-left of the map. Things that haven't redrawn stay where they were, which is why it looks random.
In cloud mode the trigger is ordinary editing. The folder list the server pushes includes each folder's agents in play (#343, Oct 19). Placing an agent a folder hasn't used yet changes that list. The server pushes it, the library rebuilds under the editor, and the coordinates shrink. A teammate adding a folder or a strategy does the same. Reading the code, a sign-in change (such as a token refresh) that rebuilds the folder list should do it too.
Fix
Only a canvas sets the coordinates now. The library's line is gone. That line also kept
CoordinateSystem.instancefrom throwing before any canvas had laid out (a strategy's page can load before its canvas is on screen). So instead of throwing,CoordinateSystemnow starts with the 1920×1080 capture size until a canvas lays out, as the library's size did before.Ground truth
Windows release builds of
mainand of this branch, each with a scratch driver that sends real pointer events. Run on the dev deployment with a test account. Window 1584×891, so the canvas is 851px tall.Tests
test/library_under_editor_coordinates_test.dartmounts the real library, opens a canvas on top with the editor's 40px strip, and rebuilds the library underneath. It fails on main (860 → 810) and passes here.flutter test: 2871 passed. One vision geometry test timed out at 30 s while a release build was compiling alongside it, and it passes when run alone.Not covered
ReplayCanvasalso sets the coordinates when it lays out. It's a canvas, and it isn't laid out while the editor covers it, so I left it alone.ci: analyze test web


Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
The PR stops
FolderNavigatorfrom replacing the editor's coordinates when the library rebuilds underneath it.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Strategy loads before canvas] --> B[Use 1920×1080 fallback] B --> C[Canvas lays out] C --> D[Use canvas coordinates] E[Library rebuilds underneath] --> F[Leave coordinates unchanged] D --> G[Editor keeps its placement scale] F --> GReviews (1) · Last reviewed commit: "Stop the library resizing the editor's c..." · Reviewed by Greptile