When using a buffer, the grid lacks rows/columns at the top/left.
This is because the threshold used for deciding when a column or row is shifted is too far to the bottom right. A tiny fix, but effective. A new test makes sure that we don't shift columns more than necessary when the layer is dragged.
This commit is contained in:
@@ -1193,7 +1193,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
||||
);
|
||||
return;
|
||||
}
|
||||
var buffer = this.buffer || 1;
|
||||
var buffer = this.buffer + 1;
|
||||
var scale = this.getResolutionScale();
|
||||
while(true) {
|
||||
var tlViewPort = {
|
||||
|
||||
@@ -239,6 +239,23 @@
|
||||
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
|
||||
}
|
||||
|
||||
function test_moveGriddedTiles(t) {
|
||||
t.plan(1);
|
||||
var map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.WMS(name, url, params, {buffer: 2});
|
||||
map.addLayer(layer);
|
||||
map.setCenter([0, 0], 5);
|
||||
var count = 0;
|
||||
layer.shiftColumn = function(prepend) {
|
||||
++count;
|
||||
OpenLayers.Layer.WMS.prototype.shiftColumn.apply(this, arguments);
|
||||
}
|
||||
map.moveTo([15, 0]);
|
||||
t.delay_call(.5, function() {
|
||||
t.eq(count, 1, "column shifted once");
|
||||
});
|
||||
}
|
||||
|
||||
function test_Layer_Grid_moveTo(t) {
|
||||
|
||||
t.plan(17);
|
||||
|
||||
Reference in New Issue
Block a user