| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.getRenderBBox = exports.BBox = void 0;
- var tslib_1 = require("tslib");
- var BBox = /** @class */ (function () {
- function BBox(x, y, width, height) {
- if (x === void 0) { x = 0; }
- if (y === void 0) { y = 0; }
- if (width === void 0) { width = 0; }
- if (height === void 0) { height = 0; }
- this.x = 0;
- this.y = 0;
- this.width = 0;
- this.height = 0;
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- }
- Object.defineProperty(BBox.prototype, "bottom", {
- get: function () {
- return this.y + this.height;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(BBox.prototype, "left", {
- get: function () {
- return this.x;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(BBox.prototype, "right", {
- get: function () {
- return this.x + this.width;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(BBox.prototype, "top", {
- get: function () {
- return this.y;
- },
- enumerable: false,
- configurable: true
- });
- BBox.fromRect = function (other) {
- return new BBox(other.x, other.y, other.width, other.height);
- };
- BBox.prototype.toJSON = function () {
- return {
- x: this.x,
- y: this.y,
- width: this.width,
- height: this.height,
- top: this.top,
- right: this.right,
- bottom: this.bottom,
- left: this.left,
- };
- };
- return BBox;
- }());
- exports.BBox = BBox;
- function getRenderBBox(element) {
- var _a = element.getRenderBounds(), _b = tslib_1.__read(_a.min, 2), minX = _b[0], minY = _b[1], _c = tslib_1.__read(_a.max, 2), maxX = _c[0], maxY = _c[1];
- var width = maxX - minX;
- var height = maxY - minY;
- return new BBox(minX, minY, width, height);
- }
- exports.getRenderBBox = getRenderBBox;
- //# sourceMappingURL=bbox.js.map
|