diff options
| author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-02-25 18:02:47 -0500 |
|---|---|---|
| committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-02-25 18:02:47 -0500 |
| commit | 326696caa52a7feadf37f8f9e0f8bbb69d39bf9a (patch) | |
| tree | 59dd222b58abdeefa5c648219411411d7c45128e /src/client/util/Transform.ts | |
| parent | fc3308a7760860328d153faba65ab3821d4d0c70 (diff) | |
| parent | abec712d1e5169704473a7fad2c21b0ab04299ad (diff) | |
Merge branch 'master' of github-tsch-brown:browngraphicslab/Dash-Web into treeview
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) } |
