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

trim height of export requests when necessary #484

Merged
merged 2 commits into from
Mar 18, 2015

Conversation

jgravois
Copy link
Contributor

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

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);
Copy link
Member

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.

Copy link
Contributor Author

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){
Copy link
Contributor Author

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.

Copy link
Contributor

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.

@patrickarlt
Copy link
Contributor

Looks good!

patrickarlt added a commit that referenced this pull request Mar 18, 2015
trim height of export requests when necessary
@patrickarlt patrickarlt merged commit ce2d20f into Esri:master Mar 18, 2015
@jgravois jgravois deleted the dyn-align branch April 24, 2015 13:45
jgravois added a commit that referenced this pull request Apr 21, 2016
jgravois added a commit that referenced this pull request Apr 26, 2016
jgravois pushed a commit to jgravois/esri-leaflet that referenced this pull request Apr 23, 2022
trim height of export requests when necessary
jgravois added a commit to jgravois/esri-leaflet that referenced this pull request Apr 23, 2022
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.

Dynamic Layer rendering issue on Zoom level 1 and 2
3 participants