Fixing the ZoomSlider size for OpenLayers >2.11 #48

Merged
merged 2 commits into from Jul 7, 2012

Projects

None yet

2 participants

@ahocevar
GeoExt member

OpenLayers 2.12 restricts the minimum zoom level for maps that have a base layer with wrapDateLine set to true, so the map does not show more than one world. This change makes it so the ZoomSlider size is adjusted according to the minimum zoom level restriction in OpenLayers.

This fix depends on openlayers/ol2#524.

With tests; tests pass in Safari 5. Thanks for any review.

ahocevar and others added some commits Jun 13, 2012
@ahocevar ahocevar Fixing the ZoomSlider size for OpenLayers 2.12.
OpenLayers 2.12 restricts the minimum zoom level for maps that have a base layer with wrapDateLine set to true, so the map does not show more than one world. This change makes it so the ZoomSlider size is adjusted according to the minimum zoom level restriction in OpenLayers.
e27f93b
@tschaub tschaub Applying force with care.
We only want to force an update of the thumb position when it is likely that the min/max values have changed.  Previously, the thumb value was always set to null, even if the slider hadn't been rendered yet.  In this case, the change event would be fired immediately upon rendering, and handleChange would end up setting the map zoom to zero even if that was not the initial value.  See the test (or the zoomslider.js) example for effects before and after.
68a9844
@tschaub
GeoExt member

Without the changes in 68a9844, the zoomslider.html example no longer works (it starts at zoom 0 instead of 3). I added a test to demonstrate this.

It's a funky issue, but basically it boils down to setting this.thumbs[0].value = null before the slider is rendered. If you add logging to all the event listeners, you can see the unintended sequence in action in that example.

If you agree with my change, please merge. Thanks for the work on this.

@tschaub
GeoExt member

For posterity, the GitHub v2 api is gone now, and if you don't feel like installing defunkt/hub, you can always use curl to modify issues or pull requests. E.g.

curl -d '{"issue": "48", "head": "tschaub:minzoom-slider", "base": "master"}' -u 'tschaub' https://api.github.com/repos/geoext/geoext/pulls
@ahocevar ahocevar merged commit 34c8cd2 into geoext:master Jul 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment