summaryrefslogtreecommitdiff
path: root/web/src/math/Rect.ts
diff options
context:
space:
mode:
authorJosh Kingsley <josh@joshkingsley.me>2025-10-26 22:13:31 +0200
committerJosh Kingsley <josh@joshkingsley.me>2025-10-26 22:13:31 +0200
commit74592676444cdb9bdc2fef5dc8c483667b557a5e (patch)
tree9481019fb81bd9dd47025298720c04004f1a93cb /web/src/math/Rect.ts
parented566a3f657e8256df9aabd107c199e6971a8f96 (diff)
feat(web): draw cell values
Diffstat (limited to 'web/src/math/Rect.ts')
-rw-r--r--web/src/math/Rect.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/web/src/math/Rect.ts b/web/src/math/Rect.ts
index e26fbae..f52a2f7 100644
--- a/web/src/math/Rect.ts
+++ b/web/src/math/Rect.ts
@@ -40,6 +40,13 @@ export default class Rect {
);
}
+ get center(): Coord {
+ return new Coord(
+ this.topLeft.x + (this.bottomRight.x - this.topLeft.x) / 2,
+ this.topLeft.y + (this.bottomRight.y - this.topLeft.y) / 2,
+ );
+ }
+
/** Determine if this rectangle contains the point at `coord`. */
containsCoord(coord: Coord): boolean {
return (