Always fill polygons for hit detection
This commit is contained in:
@@ -858,10 +858,10 @@ ol.render.canvas.PolygonReplay.prototype.drawFlatCoordinatess_ =
|
|||||||
}
|
}
|
||||||
// FIXME is it quicker to fill and stroke each polygon individually,
|
// FIXME is it quicker to fill and stroke each polygon individually,
|
||||||
// FIXME or all polygons together?
|
// FIXME or all polygons together?
|
||||||
|
var fillInstruction = [ol.render.canvas.Instruction.FILL];
|
||||||
|
this.hitDetectionInstructions.push(fillInstruction);
|
||||||
if (goog.isDef(state.fillStyle)) {
|
if (goog.isDef(state.fillStyle)) {
|
||||||
var fillInstruction = [ol.render.canvas.Instruction.FILL];
|
|
||||||
this.instructions.push(fillInstruction);
|
this.instructions.push(fillInstruction);
|
||||||
this.hitDetectionInstructions.push(fillInstruction);
|
|
||||||
}
|
}
|
||||||
if (goog.isDef(state.strokeStyle)) {
|
if (goog.isDef(state.strokeStyle)) {
|
||||||
goog.asserts.assert(goog.isDef(state.lineWidth));
|
goog.asserts.assert(goog.isDef(state.lineWidth));
|
||||||
@@ -891,10 +891,10 @@ ol.render.canvas.PolygonReplay.prototype.drawPolygonGeometry =
|
|||||||
ol.extent.extend(this.extent_, polygonGeometry.getExtent());
|
ol.extent.extend(this.extent_, polygonGeometry.getExtent());
|
||||||
this.setFillStrokeStyles_();
|
this.setFillStrokeStyles_();
|
||||||
this.beginGeometry(polygonGeometry);
|
this.beginGeometry(polygonGeometry);
|
||||||
if (goog.isDef(state.fillStyle)) {
|
// always fill the polygon for hit detection
|
||||||
this.hitDetectionInstructions.push(
|
this.hitDetectionInstructions.push(
|
||||||
[ol.render.canvas.Instruction.SET_FILL_STYLE, state.fillStyle]);
|
[ol.render.canvas.Instruction.SET_FILL_STYLE,
|
||||||
}
|
ol.color.asString(ol.render.canvas.defaultFillStyle)]);
|
||||||
if (goog.isDef(state.strokeStyle)) {
|
if (goog.isDef(state.strokeStyle)) {
|
||||||
this.hitDetectionInstructions.push(
|
this.hitDetectionInstructions.push(
|
||||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||||
@@ -927,10 +927,10 @@ ol.render.canvas.PolygonReplay.prototype.drawMultiPolygonGeometry =
|
|||||||
ol.extent.extend(this.extent_, multiPolygonGeometry.getExtent());
|
ol.extent.extend(this.extent_, multiPolygonGeometry.getExtent());
|
||||||
this.setFillStrokeStyles_();
|
this.setFillStrokeStyles_();
|
||||||
this.beginGeometry(multiPolygonGeometry);
|
this.beginGeometry(multiPolygonGeometry);
|
||||||
if (goog.isDef(state.fillStyle)) {
|
// always fill the multi-polygon for hit detection
|
||||||
this.hitDetectionInstructions.push(
|
this.hitDetectionInstructions.push(
|
||||||
[ol.render.canvas.Instruction.SET_FILL_STYLE, state.fillStyle]);
|
[ol.render.canvas.Instruction.SET_FILL_STYLE,
|
||||||
}
|
ol.color.asString(ol.render.canvas.defaultFillStyle)]);
|
||||||
if (goog.isDef(state.strokeStyle)) {
|
if (goog.isDef(state.strokeStyle)) {
|
||||||
this.hitDetectionInstructions.push(
|
this.hitDetectionInstructions.push(
|
||||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||||
|
|||||||
Reference in New Issue
Block a user