UNPKG

@antv/f6-ui

Version:

UI system for @antv/f6

54 lines (46 loc) 1.55 kB
import { __assign, __extends } from "tslib"; import UINode from './base'; var UIShapeNode = /** @class */ function (_super) { __extends(UIShapeNode, _super); function UIShapeNode() { return _super !== null && _super.apply(this, arguments) || this; } UIShapeNode.prototype.getAttrs = function () { var styleNode = this.styleNode; var style = styleNode.style; var layout = styleNode.layout; var dom = styleNode.dom; return __assign({ fill: style.backgroundColor, lineWidth: style.borderWidth, fillOpacity: style.backgroundOpacity, stroke: style.borderColor, width: layout.width - (style.borderWidth || 0), height: layout.height - (style.borderWidth || 0) }, dom.attrs); }; UIShapeNode.prototype.draw = function (parentGNode) { var styleNode = this.styleNode; var attrs = this.getAttrs(); var dom = styleNode.dom; if (!this.gNode) this.gNode = parentGNode.addShape(dom.attrs.type, { attrs: attrs }); this.update(); }; UIShapeNode.prototype.update = function () { var _a; var attrs = this.getAttrs(); var shape = this.gNode; var isCapture = this.styleNode.style.pointerEvents === 'none' ? false : true; shape.attr(attrs); shape.set('capture', isCapture); shape.resetMatrix(); shape.translate(this.left, this.top); typeof ((_a = this.style) === null || _a === void 0 ? void 0 : _a.zIndex) === 'number' && shape.setZIndex(this.style.zIndex); }; return UIShapeNode; }(UINode); export default UIShapeNode;