Skip to content

Commit

Permalink
Merge branch '2.12'
Browse files Browse the repository at this point in the history
  • Loading branch information
elemoine committed Mar 18, 2012
2 parents 472e400 + 46c5ac8 commit 926283f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 1 addition & 6 deletions examples/spherical-mercator.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,11 @@ <h1 id="title">OpenLayers Spherical Mercator Example</h1>
// create OSM layers
var mapnik = new OpenLayers.Layer.OSM();

var osmarender = new OpenLayers.Layer.OSM(
"OpenStreetMap (Tiles@Home)",
"http://tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png"
);

// create a vector layer for drawing
var vector = new OpenLayers.Layer.Vector("Editable Vectors");

map.addLayers([
gphy, gmap, gsat, ghyb, veroad, veaer, vehyb, mapnik, osmarender, vector
gphy, gmap, gsat, ghyb, veroad, veaer, vehyb, mapnik, vector
]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.EditingToolbar(vector));
Expand Down
12 changes: 10 additions & 2 deletions lib/OpenLayers/Layer/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
*/
tileQueue: null,

/**
* Property: loading
* {Boolean} Indicates if tiles are being loaded.
*/
loading: false,

/**
* Property: backBuffer
* {DOMElement} The back buffer.
Expand Down Expand Up @@ -1050,7 +1056,8 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {

tile.onLoadStart = function() {
//if that was first tile then trigger a 'loadstart' on the layer
if (this.numLoadingTiles == 0) {
if (this.loading === false) {
this.loading = true;
this.events.triggerEvent("loadstart");
}
this.events.triggerEvent("tileloadstart", {tile: tile});
Expand All @@ -1061,7 +1068,8 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
this.numLoadingTiles--;
this.events.triggerEvent("tileloaded", {tile: tile});
//if that was the last tile, then trigger a 'loadend' on the layer
if (this.numLoadingTiles === 0) {
if (this.tileQueue.length === 0 && this.numLoadingTiles === 0) {
this.loading = false;
this.events.triggerEvent("loadend");
if(this.backBuffer) {
// the removal of the back buffer is delayed to prevent flash
Expand Down

0 comments on commit 926283f

Please sign in to comment.