Skip to content
This repository was archived by the owner on Feb 7, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/app/components/common/shapes/base-shape.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import * as Konva from "konva";

// TODO:
// Need to factor strokewidth into the size of the shape to have
// parity with the desktop version. Konva counts the stroke width separately.
// Ex: to achieve a total width of 20, radius is (20 - (2*2))/2 = 16/2 = 8 pix.
// Then 8 pix + 2 pix is 10 pix which is half the desired width.
export const strokeWidth: number = 2;

export enum ShapeKind {
Expand Down
8 changes: 4 additions & 4 deletions src/app/components/common/shapes/ellipse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export class EllipseShape extends BaseShape<Konva.Ellipse> {
x: width / 2,
y: height / 2,
radius: {
x: (width - (2 * strokeWidth)) / 2,
y: (height - (2 * strokeWidth)) / 2
x: (width - strokeWidth) / 2,
y: (height - strokeWidth) / 2
},
fill: "slateblue",
stroke: "black",
Expand All @@ -25,7 +25,7 @@ export class EllipseShape extends BaseShape<Konva.Ellipse> {
}

public move(x: number, y: number): void {
this.instance.y(y + this.instance.radiusY());
this.instance.x(x + this.instance.radiusX());
this.instance.y(y + this.instance.radiusY() + strokeWidth / 2);
this.instance.x(x + this.instance.radiusX() + strokeWidth / 2);
}
}