Skip to content

fix(extent): make setting the current extent a no-op - #54

Open
draarivpatel-ui wants to merge 1 commit into
d3:mainfrom
draarivpatel-ui:fix/extent-idempotent
Open

draarivpatel-ui wants to merge 1 commit into
d3:mainfrom
draarivpatel-ui:fix/extent-idempotent

Conversation

@draarivpatel-ui

Copy link
Copy Markdown

Fixes #44.

Calling tree.extent(tree.extent()) previously grew the extent on every call. For example, an extent of [[1,1],[5,5]] becomes [[1,1],[9,9]] after the first setter call and [[1,1],[17,17]] after the second.

The setter implemented via cover(corner0).cover(corner1), which repeatedly doubles the extent to include the points. When the corners are already the current extent, this unnecessary covers expand it further.

The fix detects when the provided extent exactly matches the current extent and returns this unchanged. All other extents still go through the existing cover logic, preserving squarification and point coverage behavior.

Added a regression test. Full suite: 71 passed.

Copilot AI balanced review requested due to automatic review settings November 25, 2026 23:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Extent is broken?

2 participants