Use binaryInsert instead of sort
This commit is contained in:
@@ -320,14 +320,16 @@ ol.renderer.canvas.VectorLayer.prototype.renderFrame =
|
|||||||
var oldResolutions = goog.isNull(this.tileGrid_) ? [] :
|
var oldResolutions = goog.isNull(this.tileGrid_) ? [] :
|
||||||
this.tileGrid_.getResolutions();
|
this.tileGrid_.getResolutions();
|
||||||
if (!goog.array.contains(oldResolutions, newResolution)) {
|
if (!goog.array.contains(oldResolutions, newResolution)) {
|
||||||
|
var newResolutions = oldResolutions.concat([]);
|
||||||
|
goog.array.binaryInsert(newResolutions, newResolution,
|
||||||
|
function(a, b) { return b - a; });
|
||||||
tileGrid = new ol.tilegrid.TileGrid({
|
tileGrid = new ol.tilegrid.TileGrid({
|
||||||
origin: [0, 0],
|
origin: [0, 0],
|
||||||
projection: view2DState.projection,
|
projection: view2DState.projection,
|
||||||
resolutions: [newResolution].concat(oldResolutions)
|
resolutions: newResolutions,
|
||||||
.sort(function(a, b) { return b - a; }),
|
|
||||||
tileSize: [512, 512]
|
tileSize: [512, 512]
|
||||||
});
|
});
|
||||||
this.updateTileCache_(oldResolutions, tileGrid.getResolutions());
|
this.updateTileCache_(oldResolutions, newResolutions);
|
||||||
this.tileGrid_ = tileGrid;
|
this.tileGrid_ = tileGrid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user