map.zoomTo doesn't keep entire geometry on screen

3136
2
11-17-2015 04:29 PM
PaulHaakma
Regular Contributor

Can anyone else replicate this? (using Windows to test this at present)

Take a polygon geometry and hook a button up to map.zoomTo(geom).

Set your window size on the monitor smaller (i.e. not maximized), and click the zoom to button, then drag the window a bit wider and hit zoom again.

Each time I drag the window a bit wider, the map zooms in a little closer, to the point where (especially with polygons that are higher than they are wide on the screen) the top and bottom of the geometry disappears off the map.

I would expect the zoomTo function to always keep the polygon geometry within the extents of the window, but it appears that the function is not taking the size of the actual window into account.

Am I missing something in the implementation of this function, or is this a bug?

Cheers,

-Paul

Tags (3)
0 Kudos
2 Replies
TobiasFimpel1
Occasional Contributor III

Paul, I can replicate this same behavior. The window height/width proportions and the polygon height/width proportions seem to make a difference in what this function does.

0 Kudos
PaulHaakma
Regular Contributor

Thanks for the feedback Tobias.

0 Kudos