UNPKG

@visactor/vtable-gantt

Version:

canvas table width high performance

41 lines (40 loc) 3.28 kB
import { createRect } from "@visactor/vtable/es/vrender"; export 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 = 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 }); } } //# sourceMappingURL=frame-border.js.map