Merge pull request #6251 from ahocevar/image-tile-pixel-ratio
Take image pixel ratio into account for rendered resolution
This commit is contained in:
@@ -89,7 +89,6 @@ ol.renderer.canvas.ImageLayer.prototype.prepareFrame = function(frameState, laye
|
|||||||
var loaded = this.loadImage(image);
|
var loaded = this.loadImage(image);
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
this.image_ = image;
|
this.image_ = image;
|
||||||
this.renderedResolution = viewResolution;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,6 +114,7 @@ ol.renderer.canvas.ImageLayer.prototype.prepareFrame = function(frameState, laye
|
|||||||
|
|
||||||
this.updateAttributions(frameState.attributions, image.getAttributions());
|
this.updateAttributions(frameState.attributions, image.getAttributions());
|
||||||
this.updateLogos(frameState, imageSource);
|
this.updateLogos(frameState, imageSource);
|
||||||
|
this.renderedResolution = viewResolution * pixelRatio / imagePixelRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!this.image_;
|
return !!this.image_;
|
||||||
|
|||||||
@@ -208,17 +208,17 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame = function(frameState, layer
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.renderedRevision = sourceRevision;
|
this.renderedRevision = sourceRevision;
|
||||||
this.renderedResolution = tileResolution;
|
this.renderedResolution = tileResolution * pixelRatio / tilePixelRatio;
|
||||||
this.renderedExtent_ = imageExtent;
|
this.renderedExtent_ = imageExtent;
|
||||||
}
|
}
|
||||||
|
|
||||||
var scale = pixelRatio / tilePixelRatio * this.renderedResolution / viewResolution;
|
var scale = this.renderedResolution / viewResolution;
|
||||||
var transform = ol.transform.compose(this.imageTransform_,
|
var transform = ol.transform.compose(this.imageTransform_,
|
||||||
pixelRatio * size[0] / 2, pixelRatio * size[1] / 2,
|
pixelRatio * size[0] / 2, pixelRatio * size[1] / 2,
|
||||||
scale, scale,
|
scale, scale,
|
||||||
0,
|
0,
|
||||||
tilePixelRatio * (this.renderedExtent_[0] - viewCenter[0]) / this.renderedResolution,
|
(this.renderedExtent_[0] - viewCenter[0]) / this.renderedResolution * pixelRatio,
|
||||||
tilePixelRatio * (viewCenter[1] - this.renderedExtent_[3]) / this.renderedResolution);
|
(viewCenter[1] - this.renderedExtent_[3]) / this.renderedResolution * pixelRatio);
|
||||||
ol.transform.compose(this.coordinateToCanvasPixelTransform,
|
ol.transform.compose(this.coordinateToCanvasPixelTransform,
|
||||||
pixelRatio * size[0] / 2 - transform[4], pixelRatio * size[1] / 2 - transform[5],
|
pixelRatio * size[0] / 2 - transform[4], pixelRatio * size[1] / 2 - transform[5],
|
||||||
pixelRatio / viewResolution, -pixelRatio / viewResolution,
|
pixelRatio / viewResolution, -pixelRatio / viewResolution,
|
||||||
|
|||||||
Reference in New Issue
Block a user