1 | import { freeze } from './utils/freeze';
|
2 | var DOMRectReadOnly = (function () {
|
3 | function DOMRectReadOnly(x, y, width, height) {
|
4 | this.x = x;
|
5 | this.y = y;
|
6 | this.width = width;
|
7 | this.height = height;
|
8 | this.top = this.y;
|
9 | this.left = this.x;
|
10 | this.bottom = this.top + this.height;
|
11 | this.right = this.left + this.width;
|
12 | return freeze(this);
|
13 | }
|
14 | DOMRectReadOnly.prototype.toJSON = function () {
|
15 | var _a = this, x = _a.x, y = _a.y, top = _a.top, right = _a.right, bottom = _a.bottom, left = _a.left, width = _a.width, height = _a.height;
|
16 | return { x: x, y: y, top: top, right: right, bottom: bottom, left: left, width: width, height: height };
|
17 | };
|
18 | DOMRectReadOnly.fromRect = function (rectangle) {
|
19 | return new DOMRectReadOnly(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
|
20 | };
|
21 | return DOMRectReadOnly;
|
22 | }());
|
23 | export { DOMRectReadOnly };
|