Hey all,
I think Johannes might have discovered a bug / behavioural change still
undocumented. While in 2.12 it was perfectly fine to call zoomTo
multiple times, with 2.13 and later you get very unexpected results. If
we can we should guard against that:
Run the following lines in a console against 2.12 and 2.13 (e.g.
http://dev.openlayers.org/releases/OpenLayers-2.12/examples/all-overlays.html,
http://dev.openlayers.org/releases/OpenLayers-2.13/examples/all-overlays.html)
console.log('Initial zoom is: ' + map.getZoom());
console.log('calling zoomTo: 1, 2, 1, 0');
map.zoomTo(1);
map.zoomTo(2);
map.zoomTo(1);
map.zoomTo(0);
console.log('wait 10 seconds, and then get the zoom');
var to = window.setTimeout(function(){
console.log('Current zoom is: ' + map.getZoom());
}, 10000);
2.12 (as expected):
Initial zoom is: 0
calling zoomTo: 1, 2, 1, 0
wait 10 seconds, and then get the zoom
Current zoom is: 0
2.13 (ends with zoom 4, IMHO wrong, at least highly unexpected):
Initial zoom is: 0
calling zoomTo: 1, 2, 1, 0
wait 10 seconds, and then get the zoom
Current zoom is: 4
2.13.1 is the same as 2.13
I don't think that it is ok that we end up with four.
Best,
Marc
On 27.11.2013 13:14, Andreas Hocevar wrote:
With your above example, your zoom level when you call map.getZoom()
will be something between 0 and 5. This is because map.zoomTo() is
asynchronous now, at least when a zoomMethod is configured for the map.
So instead of calling getZoom() directly, you should register for a
zoomend listener and call getZoom() there.
Andreas.
On Wed, Nov 27, 2013 at 11:17 AM, Johannes Weskamm
<wesk...@terrestris.de <mailto:wesk...@terrestris.de>> wrote:
Hi,
I think i found a bug in the zoomTo Method of the map, while
investigating an issue in geoext 2 (
https://github.com/geoext/geoext2/issues/205).
The problem seems to be introduced since OL 2.13 and is also
occuring in 2.13.1:
When you zoom the map with the zoomTo Method multiple times in a
row, the result will be confusing.
To be exact, it will not be the last zoomValue you have given to
the method, instead it will become e.g. 0.
Here is the simple code which i used to test the behaviour:
m = map;
m.zoomTo(1);
m.zoomTo(2);
m.zoomTo(3);
m.zoomTo(4);
m.zoomTo(5);
m.getZoom();
The result of the last line should return a value of 5. But since
OL 2.13, it returns 0 or some other non-correct value.
I checked this with the official examples of OL 2.12, 2.13 and 2.13.1:
http://dev.openlayers.org/releases/OpenLayers-2.12/examples/all-overlays.html
In 2.12, everything works as expected, but in
http://dev.openlayers.org/releases/OpenLayers-2.13/examples/all-overlays.html
or
http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/all-overlays.html
it does not, like described above.
A first finding is that when you use "zoomMethod: null" on map
instanciation, the problem disappears. So this bug could have
something todo with the " zoomTween" on the map. Maybe someone
could have a detailed look at this?
Best regards,
Johannes Weskamm
_______________________________________________
Dev mailing list
d...@lists.osgeo.org <mailto:d...@lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/openlayers-dev
_______________________________________________
Dev mailing list
d...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-dev
_______________________________________________
Dev mailing list
d...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-dev