diff --git a/src/ol/framestate.js b/src/ol/framestate.js index a4c97039a0..cffecf36b4 100644 --- a/src/ol/framestate.js +++ b/src/ol/framestate.js @@ -23,6 +23,7 @@ goog.require('ol.layer.LayerState'); * backgroundColor: ol.Color, * coordinateToPixelMatrix: goog.vec.Mat4.Number, * extent: (null|ol.Extent), + * focus: ol.Coordinate, * layersArray: Array., * layerStates: Object., * pixelToCoordinateMatrix: goog.vec.Mat4.Number, diff --git a/src/ol/map.js b/src/ol/map.js index 34b92731bc..b5dbc4304a 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -500,13 +500,11 @@ ol.Map.prototype.getTilePriority = if (!frameState.wantedTiles[tileSourceKey][coordKey]) { return ol.structs.PriorityQueue.DROP; } - // Prioritize tiles closest to the focus or center. The + 1 helps to - // prioritize tiles at higher zoom levels over tiles at lower zoom levels, - // even if the tile's center is close to the focus. - var focus = goog.isNull(this.focus_) ? - frameState.view2DState.center : this.focus_; - var deltaX = tileCenter.x - focus.x; - var deltaY = tileCenter.y - focus.y; + // Prioritize tiles closest to the focus. The + 1 helps to prioritize tiles + // at higher zoom levels over tiles at lower zoom levels, even if the tile's + // center is close to the focus. + var deltaX = tileCenter.x - frameState.focus.x; + var deltaY = tileCenter.y - frameState.focus.y; return tileResolution * (deltaX * deltaX + deltaY * deltaY + 1); }; @@ -714,6 +712,7 @@ ol.Map.prototype.renderFrame_ = function(time) { backgroundColor : new ol.Color(255, 255, 255, 1), coordinateToPixelMatrix: this.coordinateToPixelMatrix_, extent: null, + focus: goog.isNull(this.focus_) ? view2DState.center : this.focus_, layersArray: layersArray, layerStates: layerStates, pixelToCoordinateMatrix: this.pixelToCoordinateMatrix_,