Merge pull request #840 from bartvde/clone
when cloning a layer that is loading, make sure numLoadingTiles is reset...
This commit is contained in:
@@ -428,6 +428,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
|||||||
obj.backBuffer = null;
|
obj.backBuffer = null;
|
||||||
obj.backBufferTimerId = null;
|
obj.backBufferTimerId = null;
|
||||||
obj.loading = false;
|
obj.loading = false;
|
||||||
|
obj.numLoadingTiles = 0;
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -390,7 +390,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function test_Layer_Grid_clone(t) {
|
function test_Layer_Grid_clone(t) {
|
||||||
t.plan(6);
|
t.plan(7);
|
||||||
|
|
||||||
var options = {tileSize: new OpenLayers.Size(500,50)};
|
var options = {tileSize: new OpenLayers.Size(500,50)};
|
||||||
var map = new OpenLayers.Map('map', options);
|
var map = new OpenLayers.Map('map', options);
|
||||||
@@ -400,8 +400,10 @@
|
|||||||
layer.grid = [ [6, 7],
|
layer.grid = [ [6, 7],
|
||||||
[8, 9]];
|
[8, 9]];
|
||||||
|
|
||||||
|
// if we clone when tiles are still loading, this should not influence the clone
|
||||||
|
layer.numLoadingTiles = 1;
|
||||||
var clone = layer.clone();
|
var clone = layer.clone();
|
||||||
|
t.eq( clone.numLoadingTiles, 0, "numLoadingTiles should be reset");
|
||||||
t.ok( clone.grid != layer.grid, "clone does not copy grid");
|
t.ok( clone.grid != layer.grid, "clone does not copy grid");
|
||||||
t.ok( clone.grid.length == 0, "clone creates a new array instead");
|
t.ok( clone.grid.length == 0, "clone creates a new array instead");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user