qauMaWeb/node_modules/.cache/babel-loader/5e298e27350bbf064a8553a2f8c...

1 line
114 KiB
JSON
Raw Normal View History

2024-10-13 18:02:27 +08:00
{"ast":null,"code":"import \"core-js/modules/es.array.concat.js\";\nimport \"core-js/modules/es.array.fill.js\";\nimport \"core-js/modules/es.array.join.js\";\nimport \"core-js/modules/es.array.slice.js\";\nimport \"core-js/modules/es.array.splice.js\";\nimport \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.function.name.js\";\nimport Transformable, { TRANSFORMABLE_PROPS } from './core/Transformable.js';\nimport Animator, { cloneValue } from './animation/Animator.js';\nimport BoundingRect from './core/BoundingRect.js';\nimport Eventful from './core/Eventful.js';\nimport { calculateTextPosition, parsePercent } from './contain/text.js';\nimport { guid, isObject, keys, extend, indexOf, logError, mixin, isArrayLike, isTypedArray, isGradientObject, filter, reduce } from './core/util.js';\nimport { LIGHT_LABEL_COLOR, DARK_LABEL_COLOR } from './config.js';\nimport { parse, stringify } from './tool/color.js';\nimport { REDRAW_BIT } from './graphic/constants.js';\nexport var PRESERVED_NORMAL_STATE = '__zr_normal__';\nvar PRIMARY_STATES_KEYS = TRANSFORMABLE_PROPS.concat(['ignore']);\nvar DEFAULT_ANIMATABLE_MAP = reduce(TRANSFORMABLE_PROPS, function (obj, key) {\n obj[key] = true;\n return obj;\n}, {\n ignore: false\n});\nvar tmpTextPosCalcRes = {};\nvar tmpBoundingRect = new BoundingRect(0, 0, 0, 0);\n\nvar Element = function () {\n function Element(props) {\n this.id = guid();\n this.animators = [];\n this.currentStates = [];\n this.states = {};\n\n this._init(props);\n }\n\n Element.prototype._init = function (props) {\n this.attr(props);\n };\n\n Element.prototype.drift = function (dx, dy, e) {\n switch (this.draggable) {\n case 'horizontal':\n dy = 0;\n break;\n\n case 'vertical':\n dx = 0;\n break;\n }\n\n var m = this.transform;\n\n if (!m) {\n m = this.transform = [1, 0, 0, 1, 0, 0];\n }\n\n m[4] += dx;\n m[5] += dy;\n this.decomposeTransform();\n this.markRedraw();\n };\n\n Element.prototype.beforeUpdate = function () {};\n\n Element.prototype.afterUpdate = function () {};\n\n Element.prototype.update = function () {\n this.updateTransform();\n\n if (this.__dirty) {\n this.updateInnerText();\n }\n };\n\n Element.prototype.updateInnerText = function (forceUpdate) {\n var textEl = this._textContent;\n\n if (textEl && (!textEl.ignore || forceUpdate)) {\n if (!this.textConfig) {\n this.textConfig = {};\n }\n\n var textConfig = this.textConfig;\n var isLocal = textConfig.local;\n var innerTransformable = textEl.innerTransformable;\n var textAlign = void 0;\n var textVerticalAlign = void 0;\n var textStyleChanged = false;\n innerTransformable.parent = isLocal ? this : null;\n var innerOrigin = false;\n innerTransformable.copyTransform(textEl);\n\n if (textConfig.position != null) {\n var layoutRect = tmpBoundingRect;\n\n if (textConfig.layoutRect) {\n layoutRect.copy(textConfig.layoutRect);\n } else {\n layoutRect.copy(this.getBoundingRect());\n }\n\n if (!isLocal) {\n layoutRect.applyTransform(this.transform);\n }\n\n if (this.calculateTextPosition) {\n this.calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);\n } else {\n calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);\n }\n\n innerTransformable.x = tmpTextPosCalcRes.x;\n innerTransformable.y = tmpTextPosCalcRes.y;\n textAlign = tmpTextPosCalcRes.align;\n textVerticalAlign = tmpTextPosCalcRes.verticalAlign;\n var textOrigin = textConfig.origin;\n\n if (textOrigin && textConfig.rotation != null) {\n var relOriginX = void 0;\n var relOriginY = void 0;\n\n if (textOrigin === 'center') {\n relOriginX = layoutRect.width * 0.5;\n relOriginY = layoutRect.height * 0.5;\n } else {\n relOriginX = parsePercent(textOrigin[0], layoutRect