-
Notifications
You must be signed in to change notification settings - Fork 797
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
trim height of export requests when necessary #484
Conversation
var bottom = this._map.latLngToLayerPoint(bounds._southWest); | ||
|
||
if (top.y > 0 || bottom.y < total.y){ | ||
size.y = total.y - top.y - (total.y - bottom.y); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe reduce this to size.y = bottom.y - top.y
? By using size
instead of total
in the if
condition, you can get rid of total
completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm still using total
in the check above, but 👍 for simpler maths!
var top = this._map.latLngToLayerPoint(bounds._northEast); | ||
var bottom = this._map.latLngToLayerPoint(bounds._southWest); | ||
|
||
if (top.y > 0 || bottom.y < size.y){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at this again, i guess we could even skip the check entirely.
if the map fills up the whole div, bottom.y - top.y
still returns the height we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets leave the check in there just for safety.
Looks good! |
trim height of export requests when necessary
trim height of export requests when necessary
resolves #450
i was able to correct the distortion seen in DynamicMapLayer overlays in scenarios where whitespace surrounds the map by introducing a quick check into
_buildExportParams
to compare the height of the div to the top and bottom y values of the actual map (in screen coordinates) and trimming if appropriate.confirmed that display behavior is improved for web mercator basemaps, even when L.tileLayer noWrap is set to true
confirmed that display behavior is appropriate in leaflet-1.0 branch as well (with the exception of the fact that the area below 85deg south isn't cropped appropriately)
happy to include relevant tests prior to merge, just wanted to make sure everyone's happy with the methodology first.
cc @nixta