Make sure that drawTilesFromQueue gets executed
For events other than move, the tile queue may not be populated yet when updateTimeout is called. So instead of checking for the queue's length, we register the timer unconditionally in these cases.
This commit is contained in:
committed by
Bart van den Eijnden
parent
449b85966e
commit
1d948fc914
@@ -175,7 +175,7 @@ OpenLayers.TileManager = OpenLayers.Class({
|
|||||||
* evt - {Object} Listener argument
|
* evt - {Object} Listener argument
|
||||||
*/
|
*/
|
||||||
move: function(evt) {
|
move: function(evt) {
|
||||||
this.updateTimeout(evt.object, this.moveDelay);
|
this.updateTimeout(evt.object, this.moveDelay, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -272,11 +272,16 @@ OpenLayers.TileManager = OpenLayers.Class({
|
|||||||
* Parameters:
|
* Parameters:
|
||||||
* map - {<OpenLayers.Map>} The map to update the timeout for
|
* map - {<OpenLayers.Map>} The map to update the timeout for
|
||||||
* delay - {Number} The delay to apply
|
* delay - {Number} The delay to apply
|
||||||
|
* nice - {Boolean} If true, the timeout function will only be created if
|
||||||
|
* the tilequeue is not empty. This is used by the move handler to
|
||||||
|
* avoid impacts on dragging performance. For other events, the tile
|
||||||
|
* queue may not be populated yet, so we need to set the timer
|
||||||
|
* regardless of the queue size.
|
||||||
*/
|
*/
|
||||||
updateTimeout: function(map, delay) {
|
updateTimeout: function(map, delay, nice) {
|
||||||
window.clearTimeout(this.tileQueueId[map.id]);
|
window.clearTimeout(this.tileQueueId[map.id]);
|
||||||
var tileQueue = this.tileQueue[map.id];
|
var tileQueue = this.tileQueue[map.id];
|
||||||
if (tileQueue.length) {
|
if (!nice || tileQueue.length) {
|
||||||
this.tileQueueId[map.id] = window.setTimeout(
|
this.tileQueueId[map.id] = window.setTimeout(
|
||||||
OpenLayers.Function.bind(function() {
|
OpenLayers.Function.bind(function() {
|
||||||
this.drawTilesFromQueue(map);
|
this.drawTilesFromQueue(map);
|
||||||
|
|||||||
Reference in New Issue
Block a user