Addressing @bartvde's review comments
This commit is contained in:
@@ -377,7 +377,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
|||||||
// we do not want to copy reference to grid, so we make a new array
|
// we do not want to copy reference to grid, so we make a new array
|
||||||
obj.grid = [];
|
obj.grid = [];
|
||||||
obj.gridResolution = null;
|
obj.gridResolution = null;
|
||||||
// same for backbuffer and tile queue
|
// same for backbuffer
|
||||||
obj.backBuffer = null;
|
obj.backBuffer = null;
|
||||||
obj.backBufferTimerId = null;
|
obj.backBufferTimerId = null;
|
||||||
obj.loading = false;
|
obj.loading = false;
|
||||||
|
|||||||
@@ -193,10 +193,13 @@ OpenLayers.Tile = OpenLayers.Class({
|
|||||||
* is to call <clear> and return the result from <shouldDraw>.
|
* is to call <clear> and return the result from <shouldDraw>.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* force - {Boolean} No beforedraw event will be fired.
|
* force - {Boolean} If true, the tile will not be cleared and no beforedraw
|
||||||
|
* event will be fired. This is used for drawing tiles asynchronously
|
||||||
|
* after drawing has been cancelled by returning false from a beforedraw
|
||||||
|
* listener.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {Boolean} Whether or not the tile should actually be drawn. Retruns null
|
* {Boolean} Whether or not the tile should actually be drawn. Returns null
|
||||||
* if a beforedraw listener returned false.
|
* if a beforedraw listener returned false.
|
||||||
*/
|
*/
|
||||||
draw: function(force) {
|
draw: function(force) {
|
||||||
|
|||||||
@@ -298,10 +298,10 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: setImage
|
* APIMethod: setImage
|
||||||
* Sets the image element or this tile. This method should only be called
|
* Sets the image element for this tile. This method should only be called
|
||||||
* from beforeload listeners.
|
* from beforeload listeners.
|
||||||
*
|
*
|
||||||
* Paramters
|
* Parameters
|
||||||
* img - {HTMLImageElement} The image to use for this tile.
|
* img - {HTMLImageElement} The image to use for this tile.
|
||||||
*/
|
*/
|
||||||
setImage: function(img) {
|
setImage: function(img) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*
|
*
|
||||||
* Queueing avoids unnecessary image requests while changing zoom levels
|
* Queueing avoids unnecessary image requests while changing zoom levels
|
||||||
* quickly, and helps improve dragging performance on mobile devices that show
|
* quickly, and helps improve dragging performance on mobile devices that show
|
||||||
* a lag in dragging when loading of new images start. <zoomDelay> and
|
* a lag in dragging when loading of new images starts. <zoomDelay> and
|
||||||
* <moveDelay> are the configuration options to control this behavior.
|
* <moveDelay> are the configuration options to control this behavior.
|
||||||
*
|
*
|
||||||
* Caching avoids setting the src on image elements for images that have already
|
* Caching avoids setting the src on image elements for images that have already
|
||||||
@@ -74,8 +74,8 @@ OpenLayers.TileManager = OpenLayers.Class({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: tileCacheIndex
|
* Property: tileCacheIndex
|
||||||
* {Array<String>} URLs of cached tiles. First entry in each array is the
|
* {Array(String)} URLs of cached tiles. First entry is the least recently
|
||||||
* least recently used.
|
* used.
|
||||||
*/
|
*/
|
||||||
tileCacheIndex: null,
|
tileCacheIndex: null,
|
||||||
|
|
||||||
@@ -120,6 +120,13 @@ OpenLayers.TileManager = OpenLayers.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: removeMap
|
||||||
|
* Unbinds this instance from a map
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* map - {<OpenLayers.Map>}
|
||||||
|
*/
|
||||||
removeMap: function(map) {
|
removeMap: function(map) {
|
||||||
if (this._destroyed) {
|
if (this._destroyed) {
|
||||||
return;
|
return;
|
||||||
@@ -141,6 +148,7 @@ OpenLayers.TileManager = OpenLayers.Class({
|
|||||||
}
|
}
|
||||||
delete this.tileQueue[map.id];
|
delete this.tileQueue[map.id];
|
||||||
delete this.tileQueueId[map.id];
|
delete this.tileQueueId[map.id];
|
||||||
|
OpenLayers.Util.removeItem(this.maps, map);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -321,7 +329,7 @@ OpenLayers.TileManager = OpenLayers.Class({
|
|||||||
* Adds, updates, removes and fetches cache entries.
|
* Adds, updates, removes and fetches cache entries.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* evt - {Object} Listener argument of the tile's loadstart event
|
* evt - {Object} Listener argument of the tile's beforeload event
|
||||||
*/
|
*/
|
||||||
manageTileCache: function(evt) {
|
manageTileCache: function(evt) {
|
||||||
var tile = evt.object;
|
var tile = evt.object;
|
||||||
@@ -370,12 +378,15 @@ OpenLayers.TileManager = OpenLayers.Class({
|
|||||||
var layer = evt.object;
|
var layer = evt.object;
|
||||||
var tileQueue = this.tileQueue[layer.map.id];
|
var tileQueue = this.tileQueue[layer.map.id];
|
||||||
for (var i=tileQueue.length-1; i>=0; --i) {
|
for (var i=tileQueue.length-1; i>=0; --i) {
|
||||||
if (tileQueue.layer === layer) {
|
if (tileQueue[i].layer === layer) {
|
||||||
tileQueue.splice(i, 1);
|
tileQueue.splice(i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: destroy
|
||||||
|
*/
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
for (var i=this.maps.length-1; i>=0; --i) {
|
for (var i=this.maps.length-1; i>=0; --i) {
|
||||||
this.removeMap(this.maps[i]);
|
this.removeMap(this.maps[i]);
|
||||||
|
|||||||
Reference in New Issue
Block a user