aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/Transform.ts
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-02-25 12:39:11 -0500
committerbob <bcz@cs.brown.edu>2019-02-25 12:39:11 -0500
commit067eee9293d1016ce6cbd57274bd7cd7f9660c6f (patch)
treef08b5dafc556113b91ed2b972c2d06e7ed722b81 /src/client/util/Transform.ts
parentc439f11ba9695703697f7abc53a7cc2fd2d5c1a2 (diff)
parentf8fe6307622439d23d05a7628b3a91851a54797d (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/util/Transform.ts')
-rw-r--r--src/client/util/Transform.ts6
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)
}