diff options
author | Sam Wilkins <abdullah_ahmed@brown.edu> | 2019-03-02 17:43:55 -0500 |
---|---|---|
committer | Sam Wilkins <abdullah_ahmed@brown.edu> | 2019-03-02 17:43:55 -0500 |
commit | 950c656d06d7c6b25b82030feaa7c5c70102fe6a (patch) | |
tree | f5ff6112a6d0c34c225479e94a85450559b3f769 /src/client/util/Transform.ts | |
parent | bf26137803c09807b6e7e3d9d9ad086a7ead32ac (diff) | |
parent | bde8aabad7e5745b4797e73b564e4efb19faeca9 (diff) |
Merge with master and initial pass at converting main to a component
Diffstat (limited to 'src/client/util/Transform.ts')
-rw-r--r-- | src/client/util/Transform.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/client/util/Transform.ts b/src/client/util/Transform.ts index 9fd4f7bef..3e1039166 100644 --- a/src/client/util/Transform.ts +++ b/src/client/util/Transform.ts @@ -102,6 +102,12 @@ export class Transform { return [x * this._scale, y * this._scale]; } + transformBounds(x: number, y: number, width: number, height: number): { x: number, y: number, width: number, height: number } { + [x, y] = this.transformPoint(x, y); + [width, height] = this.transformDirection(width, height); + return { x, y, width, height }; + } + inverse = () => { return new Transform(-this._translateX / this._scale, -this._translateY / this._scale, 1 / this._scale) } |