Skip to content

Conversation

@osheroff
Copy link
Collaborator

@osheroff osheroff commented Jan 3, 2026

Short description

If calls to addRegion() came in all at once, we'd end up in a situation where all overlapping regions moved themselves to avoid each other (because they were all working with the same list of regions). This is incorrect, the first region shouldn't move at all. We leverage the ordering of the regions array to ensure that only the later overlapping regions move.

And I added 2 pixels of room because it just looks nicer.

Screenshots

before:
Screenshot 2026-01-03 at 10 48 35 AM

after:
Screenshot 2026-01-03 at 10 48 44 AM

If calls to addRegion() came in all at once, we'd end up in a situation
where all overlapping regions moved themselves to avoid each other
(because they were all working with the same list of regions).
This is incorrect, the first region shouldn't move at all.  We leverage
the ordering of the `regions` array to ensure that only the later
overlapping regions move.
Copy link
Owner

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!

@katspaugh katspaugh merged commit c79da23 into katspaugh:main Jan 4, 2026
4 checks passed
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.

2 participants