Consider background box with stroke for hit detection

This commit is contained in:
Andreas Hocevar
2018-01-01 12:05:21 +01:00
parent 745bf3d79f
commit ad8f847465

View File

@@ -268,7 +268,10 @@ _ol_render_canvas_Replay_.prototype.replayImage_ = function(context, x, y, image
createOrUpdate(boxX, boxY, boxX + boxW, boxY + boxH, box);
}
var canvas = context.canvas;
var intersects = box[0] <= canvas.width && box[2] >= 0 && box[1] <= canvas.height && box[3] >= 0;
var strokePadding = strokeInstruction ? (strokeInstruction[2] * scale / 2) : 0;
var intersects =
box[0] - strokePadding <= canvas.width && box[2] + strokePadding >= 0 &&
box[1] - strokePadding <= canvas.height && box[3] + strokePadding >= 0;
if (snapToPixel) {
x = Math.round(x);