Skip to content

Figure out why a pad value is needed in geo range box bounds calculations #2043

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

Closed
etpinard opened this issue Sep 28, 2017 · 2 comments
Closed
Labels
bug something broken

Comments

@etpinard
Copy link
Contributor

Referencing commits from https://github.com/plotly/plotly.js/tree/try-bigger-clippad


From #2030 (comment)

If I do Plotly.relayout(gd,{coastlinewidth:10}) (still using geo_orthographic), occasionally (I really can't figure out when ) the viewport shrinks:

FYI I was able to reproduce the bug using a simple relayout call - see 3ad3d1e

The problem can be fixed by increasing the clipPad geo constant from 1e-3 to 1e-2. Now, why? Without a clipPad some clipped projections (e.g. orthographic), compute different bounds for different geo.projection.rotation values. But this shouldn't happen. Bounds should be a function of the lon/lat axis range only. This is possibly due to rounding errors in d3, but my investigation stopped there.

@alexcjohnson you can uncomment this line to draw the lon/lat range-box polygon on the map if you feel like investigating further.

Bumping clipPath to 1e-2 does affect the baselines - see 3cd0ca5, but not noticeably. The jasmine tests are passing fine.

There might be other situations where clipPath: 1e-2 will fail too. Maybe setting it to 0.1 would be safer. Oh well, I couldn't get geo to break with clipPath: 1e-2.


and @alexcjohnson 's followup #2030 (comment)

I'm uncomfortable with this solution. For example, what if you zoom in sufficiently that 0.1 (or even 0.01) is a noticeable fraction of the range? I think we need to step back and look into where this is coming from a little closer.

The bug exists on master (in fact it's worse, you just get the top or bottom half of the viewport rather than a centered half, see below) so lets ignore it for this PR and make a new bug report for it.
screen shot 2017-09-28 at 12 32 09 pm

@etpinard
Copy link
Contributor Author

Branch

https://github.com/plotly/plotly.js/compare/try-bigger-clippad

made an attempt at fixing this. It appeared to have "worked", but the reason why is still a little mysterious, so I'll keep the branch on origin, but I won't open a PR.

@archmoj if you notice weird things on relayout calls after drag interactions on geo subplots, it might be of interest to take a closer look at this issue.

@gvwilson
Copy link
Contributor

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

2 participants