Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic adjustment of projection fit on resizing #18

Open
olange opened this issue Apr 28, 2022 · 0 comments
Open

Automatic adjustment of projection fit on resizing #18

olange opened this issue Apr 28, 2022 · 0 comments
Labels
user story New feature or request

Comments

@olange
Copy link
Owner

olange commented Apr 28, 2022

When the host element resizes, the bounding client rectangle of the SVG canvas of the world map must be measured again. Then the view box of the SVG canvas must be updated accordingly; and the D3-geo projection must fit within the new SVG view box.

Those tasks are currently performed only after first paint, by the render() (which will update the view box on the SVG element of the map) and the _measureSVGElement() instance methods, and lastly, by the projFn getter.

By the way, review how we fit the projection. A code fragment I spotted in @d3/projection-comparison Observable notebook seems more precise than ours.

Another appealing feature of Resize Observers: « […] ResizeObserver processing happens between layout and paint. » And any change to layout will only invalidate layout, not paint.

Reference articles

See also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user story New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant