UNPKG

@visactor/vtable-gantt

Version:

canvas table width high performance

59 lines (55 loc) 2.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.ToolTip = void 0; const vrender_1 = require("@visactor/vtable/es/vrender"); class ToolTip { constructor(scene) { this._scene = scene, this.group = new vrender_1.PopTip({ position: "top", content: "", contentStyle: { fill: "#fff" }, visible: !1, panel: { background: "#14161c", cornerRadius: 4 } }), scene.ganttGroup.addChild(this.group); } show(graphic) { var _a, _b, _c; const options = (null === (_a = this._scene._gantt.parsedOptions.markLineCreateOptions) || void 0 === _a ? void 0 : _a.markLineCreationHoverToolTip) || {}, matrix = graphic.globalTransMatrix, targetWidth = graphic.attribute.width, targetHeight = graphic.attribute.height; let x, y; const position = options.position || "top"; "top" === position ? (x = matrix.e + targetWidth / 2 - 2, y = matrix.f) : "bottom" === position && (x = matrix.e + targetWidth / 2 - 2, y = matrix.f + targetHeight); const contentStyle = (null === (_b = options.style) || void 0 === _b ? void 0 : _b.contentStyle) || { fill: "#fff" }, pannelStyle = (null === (_c = options.style) || void 0 === _c ? void 0 : _c.panelStyle) || { background: "#14161c", cornerRadius: 4 }; this.group.setAttributes({ content: options.tipContent, position: position, visibleAll: !0, visible: !0, contentStyle: contentStyle, panel: Object.assign(Object.assign({}, pannelStyle), { visible: !0 }), x: x, y: y }); } hide() { this.group.setAttributes({ visibleAll: !1, visible: !1 }); } } exports.ToolTip = ToolTip; //# sourceMappingURL=tooltip.js.map