Merge pull request #1435 from elemoine/vector-api-hit-bug

[vector-api] Fix linestring hit detection bug
This commit is contained in:
Éric Lemoine
2013-12-20 13:25:12 -08:00

View File

@@ -798,7 +798,11 @@ ol.render.canvas.LineStringReplay.prototype.drawLineStringGeometry =
ol.extent.extend(this.extent_, lineStringGeometry.getExtent());
this.setStrokeStyle_();
this.beginGeometry(lineStringGeometry);
this.hitDetectionInstructions.push([ol.render.canvas.Instruction.BEGIN_PATH]);
this.hitDetectionInstructions.push(
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
state.miterLimit, state.lineDash],
[ol.render.canvas.Instruction.BEGIN_PATH]);
var flatCoordinates = lineStringGeometry.getFlatCoordinates();
var stride = lineStringGeometry.getStride();
this.drawFlatCoordinates_(
@@ -822,8 +826,12 @@ ol.render.canvas.LineStringReplay.prototype.drawMultiLineStringGeometry =
}
ol.extent.extend(this.extent_, multiLineStringGeometry.getExtent());
this.setStrokeStyle_();
this.hitDetectionInstructions.push([ol.render.canvas.Instruction.BEGIN_PATH]);
this.beginGeometry(multiLineStringGeometry);
this.hitDetectionInstructions.push(
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
state.miterLimit, state.lineDash],
[ol.render.canvas.Instruction.BEGIN_PATH]);
var ends = multiLineStringGeometry.getEnds();
var flatCoordinates = multiLineStringGeometry.getFlatCoordinates();
var stride = multiLineStringGeometry.getStride();