Addressing @bartvde's review comments

This commit is contained in:
ahocevar
2013-01-07 14:26:41 +01:00
parent efd2de870a
commit 80f13188a3
4 changed files with 24 additions and 10 deletions

View File

@@ -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
obj.grid = [];
obj.gridResolution = null;
// same for backbuffer and tile queue
// same for backbuffer
obj.backBuffer = null;
obj.backBufferTimerId = null;
obj.loading = false;

View File

@@ -193,10 +193,13 @@ OpenLayers.Tile = OpenLayers.Class({
* is to call <clear> and return the result from <shouldDraw>.
*
* 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:
* {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.
*/
draw: function(force) {

View File

@@ -298,10 +298,10 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
/**
* 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.
*
* Paramters
* Parameters
* img - {HTMLImageElement} The image to use for this tile.
*/
setImage: function(img) {

View File

@@ -17,7 +17,7 @@
*
* Queueing avoids unnecessary image requests while changing zoom levels
* 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.
*
* Caching avoids setting the src on image elements for images that have already
@@ -74,8 +74,8 @@ OpenLayers.TileManager = OpenLayers.Class({
/**
* Property: tileCacheIndex
* {Array<String>} URLs of cached tiles. First entry in each array is the
* least recently used.
* {Array(String)} URLs of cached tiles. First entry is the least recently
* used.
*/
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) {
if (this._destroyed) {
return;
@@ -141,6 +148,7 @@ OpenLayers.TileManager = OpenLayers.Class({
}
delete this.tileQueue[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.
*
* Parameters:
* evt - {Object} Listener argument of the tile's loadstart event
* evt - {Object} Listener argument of the tile's beforeload event
*/
manageTileCache: function(evt) {
var tile = evt.object;
@@ -370,12 +378,15 @@ OpenLayers.TileManager = OpenLayers.Class({
var layer = evt.object;
var tileQueue = this.tileQueue[layer.map.id];
for (var i=tileQueue.length-1; i>=0; --i) {
if (tileQueue.layer === layer) {
if (tileQueue[i].layer === layer) {
tileQueue.splice(i, 1);
}
}
},
/**
* Method: destroy
*/
destroy: function() {
for (var i=this.maps.length-1; i>=0; --i) {
this.removeMap(this.maps[i]);