Skip to content

Fix zoom to mappable rectangle. - #7888

Open
na9da wants to merge 5 commits into
mainfrom
fix-zoom
Open

Fix zoom to mappable rectangle.#7888
na9da wants to merge 5 commits into
mainfrom
fix-zoom

Conversation

@na9da

@na9da na9da commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

What this PR does

When zooming to a mappable's rectangle, use the same code path we have for Rectangle which is smarter and sets a minimum viewing distance instead of simply fitting the camera view to the rectangle. This is a better behaviour when zooming to simple shapes like a single polygon.

Test me

Before:

  • Open this CI link for main branch and zoom to the item in workbench
  • Observe that the zoom is too close and possibly confusing to the user

After:

  • Open the CI link for this branch and repeat above steps
  • Observe that the full layer is correctly in view

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated relevant documentation in doc/.
  • I've updated CHANGES.md with what I changed.
  • I've provided instructions in the PR description on how to test this PR.

na9da added 2 commits July 13, 2026 10:57
When zooming to a mappable's rectangle, use the same code path we have for
`Rectangle` which is smarter and sets a minimum viewing distance instead of
simply fitting the camera view to the rectangle. This is a better behaviour
when zooming to simple shapes like a single polygon.
@na9da
na9da marked this pull request as ready for review July 17, 2026 01:56
@zoran995

zoran995 commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

@na9da 2 tests are failing

  • TerriaSpec initial zoom behaviour of initialCamera.focusWorkbenchItems zooms the map to focus on the workbench items
  • TerriaSpec initial zoom behaviour of initialCamera.focusWorkbenchItems works correctly even when there is a delay in a Cesium/Leaflet viewer becoming available
    Others are not relevant and should pass after those 2 are fixed (they are flaky

Other than that, zoom looks much better now

@na9da

na9da commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @zoran995. Fixed. The spec was relying on the zoom happening immediately which was no longer happening because of the nested call.

@na9da
na9da requested a review from zoran995 August 10, 2026 04:39
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