javascript - Canceling an OpenLayers.Map current panTo tween if user begins dragging map -


i've noticed if user drags map before panto function completes, map continue pan in previous pan direction.

here's quick jsfiddle high pan duration make effect easy reproduce:

http://jsfiddle.net/a8kk4/58/

map.panto( xy ); // code jsfiddle link 

is there straight forward way cancel current panning event if user begins drag map?

i fixed it, though i'm not sure if best way. basically, did put call pantween.stop in map's moveend event, set pantween's callback null, otherwise, loop continues -- see openlayers.tween stop`function here: http://trac.osgeo.org/openlayers/browser/trunk/openlayers/lib/openlayers/tween.js

in summary, added these 3 lines @ end of init function:

map.events.register('moveend', map, function(){                    this.pantween.callbacks=null;         this.pantween.stop();             }); 

updated fiddle: http://jsfiddle.net/a8kk4/62/


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -