Store focus in frame state
This commit is contained in:
@@ -23,6 +23,7 @@ goog.require('ol.layer.LayerState');
|
|||||||
* backgroundColor: ol.Color,
|
* backgroundColor: ol.Color,
|
||||||
* coordinateToPixelMatrix: goog.vec.Mat4.Number,
|
* coordinateToPixelMatrix: goog.vec.Mat4.Number,
|
||||||
* extent: (null|ol.Extent),
|
* extent: (null|ol.Extent),
|
||||||
|
* focus: ol.Coordinate,
|
||||||
* layersArray: Array.<ol.layer.Layer>,
|
* layersArray: Array.<ol.layer.Layer>,
|
||||||
* layerStates: Object.<number, ol.layer.LayerState>,
|
* layerStates: Object.<number, ol.layer.LayerState>,
|
||||||
* pixelToCoordinateMatrix: goog.vec.Mat4.Number,
|
* pixelToCoordinateMatrix: goog.vec.Mat4.Number,
|
||||||
|
|||||||
@@ -500,13 +500,11 @@ ol.Map.prototype.getTilePriority =
|
|||||||
if (!frameState.wantedTiles[tileSourceKey][coordKey]) {
|
if (!frameState.wantedTiles[tileSourceKey][coordKey]) {
|
||||||
return ol.structs.PriorityQueue.DROP;
|
return ol.structs.PriorityQueue.DROP;
|
||||||
}
|
}
|
||||||
// Prioritize tiles closest to the focus or center. The + 1 helps to
|
// Prioritize tiles closest to the focus. The + 1 helps to prioritize tiles
|
||||||
// prioritize tiles at higher zoom levels over tiles at lower zoom levels,
|
// at higher zoom levels over tiles at lower zoom levels, even if the tile's
|
||||||
// even if the tile's center is close to the focus.
|
// center is close to the focus.
|
||||||
var focus = goog.isNull(this.focus_) ?
|
var deltaX = tileCenter.x - frameState.focus.x;
|
||||||
frameState.view2DState.center : this.focus_;
|
var deltaY = tileCenter.y - frameState.focus.y;
|
||||||
var deltaX = tileCenter.x - focus.x;
|
|
||||||
var deltaY = tileCenter.y - focus.y;
|
|
||||||
return tileResolution * (deltaX * deltaX + deltaY * deltaY + 1);
|
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),
|
backgroundColor : new ol.Color(255, 255, 255, 1),
|
||||||
coordinateToPixelMatrix: this.coordinateToPixelMatrix_,
|
coordinateToPixelMatrix: this.coordinateToPixelMatrix_,
|
||||||
extent: null,
|
extent: null,
|
||||||
|
focus: goog.isNull(this.focus_) ? view2DState.center : this.focus_,
|
||||||
layersArray: layersArray,
|
layersArray: layersArray,
|
||||||
layerStates: layerStates,
|
layerStates: layerStates,
|
||||||
pixelToCoordinateMatrix: this.pixelToCoordinateMatrix_,
|
pixelToCoordinateMatrix: this.pixelToCoordinateMatrix_,
|
||||||
|
|||||||
Reference in New Issue
Block a user