Merge pull request #9986 from mike-000/patch-2

Make Circle geometry hit detection consistent with Polygon
This commit is contained in:
Olivier Guyot
2019-09-25 15:38:50 +02:00
committed by GitHub
2 changed files with 226 additions and 2 deletions

View File

@@ -31,7 +31,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
drawFlatCoordinatess_(flatCoordinates, offset, ends, stride) {
const state = this.state;
const fill = state.fillStyle !== undefined;
const stroke = state.strokeStyle != undefined;
const stroke = state.strokeStyle !== undefined;
const numEnds = ends.length;
this.instructions.push(beginPathInstruction);
this.hitDetectionInstructions.push(beginPathInstruction);
@@ -94,9 +94,9 @@ class CanvasPolygonBuilder extends CanvasBuilder {
const circleInstruction = [CanvasInstruction.CIRCLE, myBegin];
this.instructions.push(beginPathInstruction, circleInstruction);
this.hitDetectionInstructions.push(beginPathInstruction, circleInstruction);
this.hitDetectionInstructions.push(fillInstruction);
if (state.fillStyle !== undefined) {
this.instructions.push(fillInstruction);
this.hitDetectionInstructions.push(fillInstruction);
}
if (state.strokeStyle !== undefined) {
this.instructions.push(strokeInstruction);