Skip to content

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

Closed
@etpinard

Description

@etpinard

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions