UNPKG

@visactor/vtable

Version:

canvas table width high performance

28 lines (24 loc) 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.BaseElement = void 0; class BaseElement { constructor(options) { var _a, _b, _c, _d; this.x = 0, this.y = 0, this.width = 0, this.height = 0, this.dx = 0, this.dy = 0, this.id = options.id, this.marginLeft = null !== (_a = options.marginLeft) && void 0 !== _a ? _a : 0, this.marginRight = null !== (_b = options.marginRight) && void 0 !== _b ? _b : 0, this.marginTop = null !== (_c = options.marginTop) && void 0 !== _c ? _c : 0, this.marginBottom = null !== (_d = options.marginBottom) && void 0 !== _d ? _d : 0, this.background = options.background || void 0; } getSize(table) { this.initLayoutSize(); } initLayoutSize() { this.layoutWidth = this.width + this.marginLeft + this.marginRight, this.layoutHeight = this.height + this.marginTop + this.marginBottom, this.background && (this.layoutWidth += 2 * (this.background.expandX || 0), this.layoutHeight += 2 * (this.background.expandY || 0)), this.dx = this.marginLeft, this.dy = this.marginTop; } } exports.BaseElement = BaseElement; //# sourceMappingURL=element.js.map