Make ol.source.Tile#getTilePixelRatio work for all sources
Even for sources which serve dynamic tile sizes based on devicePixelRatio
This commit is contained in:
@@ -94,7 +94,7 @@ ol.renderer.canvas.VectorTileLayer.prototype.composeFrame =
|
||||
var source = layer.getSource();
|
||||
goog.asserts.assertInstanceof(source, ol.source.VectorTile,
|
||||
'Source is an ol.source.VectorTile');
|
||||
var tilePixelRatio = source.getTilePixelRatio();
|
||||
var tilePixelRatio = source.getTilePixelRatio(pixelRatio);
|
||||
var maxScale = tilePixelRatio / pixelRatio;
|
||||
|
||||
var transform = this.getTransform(frameState, 0);
|
||||
@@ -240,7 +240,8 @@ ol.renderer.canvas.VectorTileLayer.prototype.createReplayGroup = function(tile,
|
||||
extent = tileGrid.getTileCoordExtent(tileCoord);
|
||||
}
|
||||
var resolution = tileGrid.getResolution(tileCoord[0]);
|
||||
var tileResolution = pixelSpace ? source.getTilePixelRatio() : resolution;
|
||||
var tileResolution =
|
||||
pixelSpace ? source.getTilePixelRatio(pixelRatio) : resolution;
|
||||
replayState.dirty = false;
|
||||
var replayGroup = new ol.render.canvas.ReplayGroup(0, extent,
|
||||
tileResolution, layer.getRenderBuffer());
|
||||
@@ -294,6 +295,7 @@ ol.renderer.canvas.VectorTileLayer.prototype.createReplayGroup = function(tile,
|
||||
*/
|
||||
ol.renderer.canvas.VectorTileLayer.prototype.forEachFeatureAtCoordinate =
|
||||
function(coordinate, frameState, callback, thisArg) {
|
||||
var pixelRatio = frameState.pixelRatio;
|
||||
var resolution = frameState.viewState.resolution;
|
||||
var rotation = frameState.viewState.rotation;
|
||||
var layer = this.getLayer();
|
||||
@@ -319,7 +321,7 @@ ol.renderer.canvas.VectorTileLayer.prototype.forEachFeatureAtCoordinate =
|
||||
}
|
||||
if (tile.getProjection().getUnits() === ol.proj.Units.TILE_PIXELS) {
|
||||
origin = ol.extent.getTopLeft(tileExtent);
|
||||
tilePixelRatio = source.getTilePixelRatio();
|
||||
tilePixelRatio = source.getTilePixelRatio(pixelRatio);
|
||||
tileResolution = tileGrid.getResolution(tileCoord[0]) / tilePixelRatio;
|
||||
tileSpaceCoordinate = [
|
||||
(coordinate[0] - origin[0]) / tileResolution,
|
||||
|
||||
Reference in New Issue
Block a user