<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hey all,<br>
<br>
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:<br>
<br>
Run the following lines in a console against 2.12 and 2.13 (e.g.
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a class="moz-txt-link-freetext" href="http://dev.openlayers.org/releases/OpenLayers-2.12/examples/all-overlays.html">http://dev.openlayers.org/releases/OpenLayers-2.12/examples/all-overlays.html</a>,
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a class="moz-txt-link-freetext" href="http://dev.openlayers.org/releases/OpenLayers-2.13/examples/all-overlays.html">http://dev.openlayers.org/releases/OpenLayers-2.13/examples/all-overlays.html</a>)<br>
<blockquote>console.log('Initial zoom is: ' + map.getZoom());<br>
console.log('calling zoomTo: 1, 2, 1, 0');<br>
map.zoomTo(1);<br>
map.zoomTo(2);<br>
map.zoomTo(1);<br>
map.zoomTo(0);<br>
console.log('wait 10 seconds, and then get the zoom');<br>
var to = window.setTimeout(function(){<br>
console.log('Current zoom is: ' + map.getZoom());<br>
}, 10000);<br>
</blockquote>
2.12 (as expected):<br>
<blockquote>Initial zoom is: 0<br>
calling zoomTo: 1, 2, 1, 0<br>
wait 10 seconds, and then get the zoom<br>
Current zoom is: 0<br>
</blockquote>
<br>
2.13 (ends with zoom 4, IMHO wrong, at least highly unexpected):<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<blockquote>Initial zoom is: 0<br>
calling zoomTo: 1, 2, 1, 0<br>
wait 10 seconds, and then get the zoom<br>
Current zoom is: 4<br>
</blockquote>
<br>
2.13.1 is the same as 2.13<br>
<br>
I don't think that it is ok that we end up with four.<br>
<br>
Best,<br>
Marc<br>
<br>
<br>
<br>
<br>
On 27.11.2013 13:14, Andreas Hocevar wrote:<br>
</div>
<blockquote
cite="mid:CAOiJ94hyk+sBqfg+UMeHsdMmbSa3_7sbvMeFHjSOm0UuicrzVQ@mail.gmail.com"
type="cite">
<div dir="ltr">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.
<div>
<br>
</div>
<div>So instead of calling getZoom() directly, you should
register for a zoomend listener and call getZoom() there.</div>
<div><br>
</div>
<div>Andreas.</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
On Wed, Nov 27, 2013 at 11:17 AM, Johannes Weskamm <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:weskamm@terrestris.de" target="_blank">weskamm@terrestris.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Hi,<br>
<br>
I think i found a bug in the zoomTo Method of the map,
while investigating an issue in geoext 2 ( <a
moz-do-not-send="true"
href="https://github.com/geoext/geoext2/issues/205"
target="_blank">https://github.com/geoext/geoext2/issues/205</a>).<br>
The problem seems to be introduced since OL 2.13 and is
also occuring in 2.13.1:<br>
<br>
When you zoom the map with the zoomTo Method multiple
times in a row, the result will be confusing.<br>
To be exact, it will not be the last zoomValue you have
given to the method, instead it will become e.g. 0.<br>
<br>
Here is the simple code which i used to test the
behaviour:<br>
<br>
m = map;<br>
m.zoomTo(1);<br>
m.zoomTo(2);<br>
m.zoomTo(3);<br>
m.zoomTo(4);<br>
m.zoomTo(5);<br>
m.getZoom();<br>
<br>
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.<br>
I checked this with the official examples of OL 2.12, 2.13
and 2.13.1:<br>
<br>
<a moz-do-not-send="true"
href="http://dev.openlayers.org/releases/OpenLayers-2.12/examples/all-overlays.html"
target="_blank">http://dev.openlayers.org/releases/OpenLayers-2.12/examples/all-overlays.html</a><br>
<br>
In 2.12, everything works as expected, but in<br>
<br>
<a moz-do-not-send="true"
href="http://dev.openlayers.org/releases/OpenLayers-2.13/examples/all-overlays.html"
target="_blank">http://dev.openlayers.org/releases/OpenLayers-2.13/examples/all-overlays.html</a><br>
<br>
or<br>
<br>
<a moz-do-not-send="true"
href="http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/all-overlays.html"
target="_blank">http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/all-overlays.html</a><br>
<br>
it does not, like described above.<br>
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?<br>
<br>
Best regards,<br>
<br>
Johannes Weskamm<br>
</div>
<br>
_______________________________________________<br>
Dev mailing list<br>
<a moz-do-not-send="true" href="mailto:Dev@lists.osgeo.org">Dev@lists.osgeo.org</a><br>
<a moz-do-not-send="true"
href="http://lists.osgeo.org/mailman/listinfo/openlayers-dev"
target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-dev</a><br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Dev@lists.osgeo.org">Dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/openlayers-dev">http://lists.osgeo.org/mailman/listinfo/openlayers-dev</a></pre>
</blockquote>
<br>
</body>
</html>