Take the pixel ratio into account when clipping the layer
This commit is contained in:
@@ -52,6 +52,7 @@ ol.renderer.canvas.Layer.prototype.composeFrame =
|
||||
var clipped = goog.isDef(extent);
|
||||
if (clipped) {
|
||||
goog.asserts.assert(goog.isDef(extent));
|
||||
var pixelRatio = frameState.pixelRatio;
|
||||
var topLeft = ol.extent.getTopLeft(extent);
|
||||
var topRight = ol.extent.getTopRight(extent);
|
||||
var bottomRight = ol.extent.getBottomRight(extent);
|
||||
@@ -68,10 +69,10 @@ ol.renderer.canvas.Layer.prototype.composeFrame =
|
||||
|
||||
context.save();
|
||||
context.beginPath();
|
||||
context.moveTo(topLeft[0], topLeft[1]);
|
||||
context.lineTo(topRight[0], topRight[1]);
|
||||
context.lineTo(bottomRight[0], bottomRight[1]);
|
||||
context.lineTo(bottomLeft[0], bottomLeft[1]);
|
||||
context.moveTo(topLeft[0] * pixelRatio, topLeft[1] * pixelRatio);
|
||||
context.lineTo(topRight[0] * pixelRatio, topRight[1] * pixelRatio);
|
||||
context.lineTo(bottomRight[0] * pixelRatio, bottomRight[1] * pixelRatio);
|
||||
context.lineTo(bottomLeft[0] * pixelRatio, bottomLeft[1] * pixelRatio);
|
||||
context.clip();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user