Skip to content

Commit 11683e8

Browse files
Fix: Correct arrow head fill position in measurements
The `fillPolygon` method in `screenCanvas.drawController.ts` was using y-coordinates directly after transformation by `worldToTarget`. However, other primitive drawing operations (like `drawLineScreen`, `drawArcScreen`, `fillRectScreen`, `drawTextScreen`) effectively transform these y-coordinates further using `canvasSize.y - y_coordinate` before passing them to the HTML5 canvas context. This inconsistency caused the fill of measurement arrowheads (drawn via `fillPolygon`) to appear in a different position than their outlines (drawn via `drawLine`). This commit modifies `fillPolygon` to apply the same `this.canvasSize.y - screenPoint.y` transformation to its y-coordinates, aligning it with the predominant coordinate handling strategy in the `screenCanvas.drawController` and resolving the arrow head fill issue. Addresses your feedback related to issue #17.
1 parent 1efa8e5 commit 11683e8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/drawControllers/screenCanvas.drawController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,9 @@ export class ScreenCanvasDrawController implements DrawController {
468468
this.context.beginPath();
469469
screenPoints.forEach((screenPoint, index) => {
470470
if (index === 0) {
471-
this.context.moveTo(screenPoint.x, screenPoint.y);
471+
this.context.moveTo(screenPoint.x, this.canvasSize.y - screenPoint.y);
472472
} else {
473-
this.context.lineTo(screenPoint.x, screenPoint.y);
473+
this.context.lineTo(screenPoint.x, this.canvasSize.y - screenPoint.y);
474474
}
475475
});
476476
this.context.closePath();

0 commit comments

Comments
 (0)