@visactor/vtable-gantt
Version:
canvas table width high performance
49 lines (45 loc) • 3.44 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.FrameBorder = void 0;
const vrender_1 = require("@visactor/vtable/es/vrender");
class FrameBorder {
constructor(scene) {
this._scene = scene, this.createFrameBorder();
}
createFrameBorder() {
var _a, _b, _c, _d, _e, _f;
const group = this._scene.ganttGroup, frameStyle = this._scene._gantt.parsedOptions.outerFrameStyle;
if (!frameStyle) return;
const {cornerRadius: cornerRadius, borderColor: borderColor, borderLineWidth: borderLineWidth, borderLineDash: borderLineDash} = frameStyle, groupAttributes = {}, rectAttributes = {
pickable: !1
};
if (borderLineWidth && (rectAttributes.stroke = !0, rectAttributes.fill = !1, rectAttributes.stroke = borderColor,
rectAttributes.lineWidth = borderLineWidth, borderLineDash && (rectAttributes.lineDash = borderLineDash),
rectAttributes.lineCap = "butt"), cornerRadius && (this._scene._gantt.taskListTableInstance ? (rectAttributes.cornerRadius = [ 0, null !== (_a = this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius) && void 0 !== _a ? _a : 0, null !== (_b = this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius) && void 0 !== _b ? _b : 0, 0 ],
groupAttributes.cornerRadius = [ 0, null !== (_c = this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius) && void 0 !== _c ? _c : 0, null !== (_d = this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius) && void 0 !== _d ? _d : 0, 0 ]) : (rectAttributes.cornerRadius = null !== (_e = this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius) && void 0 !== _e ? _e : 0,
groupAttributes.cornerRadius = null !== (_f = this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius) && void 0 !== _f ? _f : 0)),
group.setAttributes(groupAttributes), rectAttributes.stroke) {
rectAttributes.x = this._scene._gantt.taskListTableInstance ? -borderLineWidth / 2 : borderLineWidth / 2,
rectAttributes.y = borderLineWidth / 2, rectAttributes.pickable = !1, rectAttributes.width = group.attribute.width + borderLineWidth + (this._scene._gantt.taskListTableInstance ? this._scene._gantt.parsedOptions.verticalSplitLine.lineWidth : 0),
rectAttributes.height = group.attribute.height + borderLineWidth / 2 + borderLineWidth / 2;
const borderRect = (0, vrender_1.createRect)(rectAttributes);
borderRect.name = "border-rect", group.parent.insertAfter(borderRect, group), group.border = borderRect,
this.border = borderRect;
}
}
refresh() {
this.border && this.border.parent && this.border.parent.removeChild(this.border),
this.createFrameBorder();
}
resize() {
var _a;
const {cornerRadius: cornerRadius, borderColor: borderColor, borderLineWidth: borderLineWidth, borderLineDash: borderLineDash} = this._scene._gantt.parsedOptions.outerFrameStyle;
null === (_a = this.border) || void 0 === _a || _a.setAttributes({
width: this._scene.ganttGroup.attribute.width + borderLineWidth + (this._scene._gantt.taskListTableInstance ? this._scene._gantt.parsedOptions.verticalSplitLine.lineWidth : 0),
height: this._scene._gantt.drawHeight + borderLineWidth
});
}
}
exports.FrameBorder = FrameBorder;
//# sourceMappingURL=frame-border.js.map