UNPKG

@antv/f6-ui

Version:

UI system for @antv/f6

65 lines (53 loc) 1.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _tslib = require("tslib"); var _base = _interopRequireDefault(require("./base")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var UIShapeNode = /** @class */ function (_super) { (0, _tslib.__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 (0, _tslib.__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; }(_base.default); var _default = UIShapeNode; exports.default = _default;