diff options
author | bob <bcz@cs.brown.edu> | 2019-03-25 16:08:40 -0400 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2019-03-25 16:08:40 -0400 |
commit | 9d73e6d0a74a5f94e3143203ac10b4397710330c (patch) | |
tree | 6593a34600ccf6b7a2b0b6aee7613e40082007b6 /src/client/northstar/utils/MathUtil.ts | |
parent | aec363d4b5fcb3df1a42796014c67dfc52149161 (diff) | |
parent | 60ff3da65fbabd21c29bf1eecace02ebc1f6430c (diff) |
merged with master
Diffstat (limited to 'src/client/northstar/utils/MathUtil.ts')
-rw-r--r-- | src/client/northstar/utils/MathUtil.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/client/northstar/utils/MathUtil.ts b/src/client/northstar/utils/MathUtil.ts index 3ed8628ee..bb7e73871 100644 --- a/src/client/northstar/utils/MathUtil.ts +++ b/src/client/northstar/utils/MathUtil.ts @@ -1,13 +1,17 @@ export class PIXIPoint { - public x: number; - public y: number; + public get x() { return this.coords[0]; } + public get y() { return this.coords[1]; } + public set x(value: number) { this.coords[0] = value; } + public set y(value: number) { this.coords[1] = value; } + public coords: number[] = [0, 0]; constructor(x: number, y: number) { - this.x = x; - this.y = y; + this.coords[0] = x; + this.coords[1] = y; } } + export class PIXIRectangle { public x: number; public y: number; @@ -17,6 +21,7 @@ export class PIXIRectangle { public get right() { return this.x + this.width; } public get top() { return this.y } public get bottom() { return this.top + this.height } + public static get EMPTY() { return new PIXIRectangle(0, 0, -1, -1); } constructor(x: number, y: number, width: number, height: number) { this.x = x; this.y = y; |