diff options
author | yipstanley <stanley_yip@brown.edu> | 2019-03-09 18:37:47 -0500 |
---|---|---|
committer | yipstanley <stanley_yip@brown.edu> | 2019-03-09 18:37:47 -0500 |
commit | c739d5ae0f7d78bbd65134606c727df5a71defec (patch) | |
tree | 27c05f13a244a04717eeaa8aeb537b60b0ca985c /src/client/util/Transform.ts | |
parent | 1135a989b154aae084e07e09195e2d1c59e06180 (diff) | |
parent | 96eede5f7d1706a3f7ac6ee02a85bb3da217f467 (diff) |
finally merged
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) } |