1 line
70 KiB
JSON
1 line
70 KiB
JSON
|
{"ast":null,"code":"import \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.array.fill.js\";\nimport \"core-js/modules/es.array.join.js\";\nimport { __extends } from \"tslib\";\nimport { parseRichText, parsePlainText } from './helper/parseText.js';\nimport TSpan from './TSpan.js';\nimport { retrieve2, each, normalizeCssArray, trim, retrieve3, extend, keys, defaults } from '../core/util.js';\nimport { adjustTextX, adjustTextY } from '../contain/text.js';\nimport ZRImage from './Image.js';\nimport Rect from './shape/Rect.js';\nimport BoundingRect from '../core/BoundingRect.js';\nimport Displayable, { DEFAULT_COMMON_ANIMATION_PROPS } from './Displayable.js';\nimport { DEFAULT_FONT, DEFAULT_FONT_SIZE } from '../core/platform.js';\nvar DEFAULT_RICH_TEXT_COLOR = {\n fill: '#000'\n};\nvar DEFAULT_STROKE_LINE_WIDTH = 2;\nexport var DEFAULT_TEXT_ANIMATION_PROPS = {\n style: defaults({\n fill: true,\n stroke: true,\n fillOpacity: true,\n strokeOpacity: true,\n lineWidth: true,\n fontSize: true,\n lineHeight: true,\n width: true,\n height: true,\n textShadowColor: true,\n textShadowBlur: true,\n textShadowOffsetX: true,\n textShadowOffsetY: true,\n backgroundColor: true,\n padding: true,\n borderColor: true,\n borderWidth: true,\n borderRadius: true\n }, DEFAULT_COMMON_ANIMATION_PROPS.style)\n};\n\nvar ZRText = function (_super) {\n __extends(ZRText, _super);\n\n function ZRText(opts) {\n var _this = _super.call(this) || this;\n\n _this.type = 'text';\n _this._children = [];\n _this._defaultStyle = DEFAULT_RICH_TEXT_COLOR;\n\n _this.attr(opts);\n\n return _this;\n }\n\n ZRText.prototype.childrenRef = function () {\n return this._children;\n };\n\n ZRText.prototype.update = function () {\n _super.prototype.update.call(this);\n\n if (this.styleChanged()) {\n this._updateSubTexts();\n }\n\n for (var i = 0; i < this._children.length; i++) {\n var child = this._children[i];\n child.zlevel = this.zlevel;\n child.z = this.z;\n child.z2 = this.z2;\n child.culling = this.culling;\n child.cursor = this.cursor;\n child.invisible = this.invisible;\n }\n };\n\n ZRText.prototype.updateTransform = function () {\n var innerTransformable = this.innerTransformable;\n\n if (innerTransformable) {\n innerTransformable.updateTransform();\n\n if (innerTransformable.transform) {\n this.transform = innerTransformable.transform;\n }\n } else {\n _super.prototype.updateTransform.call(this);\n }\n };\n\n ZRText.prototype.getLocalTransform = function (m) {\n var innerTransformable = this.innerTransformable;\n return innerTransformable ? innerTransformable.getLocalTransform(m) : _super.prototype.getLocalTransform.call(this, m);\n };\n\n ZRText.prototype.getComputedTransform = function () {\n if (this.__hostTarget) {\n this.__hostTarget.getComputedTransform();\n\n this.__hostTarget.updateInnerText(true);\n }\n\n return _super.prototype.getComputedTransform.call(this);\n };\n\n ZRText.prototype._updateSubTexts = function () {\n this._childCursor = 0;\n normalizeTextStyle(this.style);\n this.style.rich ? this._updateRichTexts() : this._updatePlainTexts();\n this._children.length = this._childCursor;\n this.styleUpdated();\n };\n\n ZRText.prototype.addSelfToZr = function (zr) {\n _super.prototype.addSelfToZr.call(this, zr);\n\n for (var i = 0; i < this._children.length; i++) {\n this._children[i].__zr = zr;\n }\n };\n\n ZRText.prototype.removeSelfFromZr = function (zr) {\n _super.prototype.removeSelfFromZr.call(this, zr);\n\n for (var i = 0; i < this._children.length; i++) {\n this._children[i].__zr = null;\n }\n };\n\n ZRText.prototype.getBoundingRect = function () {\n if (this.styleChanged()) {\n this._updateSubTexts();\n }\n\n if (!this._rect) {\n var tmpRect = new BoundingRect(0, 0, 0, 0);\n var children = this._children;\n var tmpMat = [];\n var rect =
|