@visactor/vrender-components 0.16.14-alpha.6 → 0.16.14-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/brush/index.js +1 -2
- package/cjs/checkbox/index.js +2 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/tooltip/tooltip.js +1 -1
- package/cjs/tooltip/tooltip.js.map +1 -1
- package/dist/index.js +164 -32
- package/dist/index.min.js +1 -1
- package/es/brush/index.js +1 -2
- package/es/checkbox/index.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/tooltip/tooltip.js +2 -2
- package/es/tooltip/tooltip.js.map +1 -1
- package/package.json +8 -8
package/cjs/brush/index.js
CHANGED
|
@@ -17,5 +17,4 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
|
-
}), __exportStar(require("./brush"), exports), __exportStar(require("./type"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
20
|
+
}), __exportStar(require("./brush"), exports), __exportStar(require("./type"), exports);
|
package/cjs/checkbox/index.js
CHANGED
|
@@ -17,4 +17,5 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
|
-
}), __exportStar(require("./checkbox"), exports), __exportStar(require("./type"), exports);
|
|
20
|
+
}), __exportStar(require("./checkbox"), exports), __exportStar(require("./type"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
|
-
}), exports.version = void 0, exports.version = "0.16.14-alpha.
|
|
20
|
+
}), exports.version = void 0, exports.version = "0.16.14-alpha.7", __exportStar(require("./core/base"), exports),
|
|
21
21
|
__exportStar(require("./scrollbar"), exports), __exportStar(require("./tag"), exports),
|
|
22
22
|
__exportStar(require("./poptip"), exports), __exportStar(require("./crosshair"), exports),
|
|
23
23
|
__exportStar(require("./label"), exports), __exportStar(require("./axis"), exports),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.16.14-alpha.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.16.14-alpha.7\";\n\nexport * from './core/base';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\n"]}
|
package/cjs/tooltip/tooltip.js
CHANGED
|
@@ -81,7 +81,7 @@ class Tooltip extends base_1.AbstractComponent {
|
|
|
81
81
|
if ((0, util_1.isVisible)(itemAttr.shape) && itemGroup.createOrUpdateChild(`${itemGroupName}-shape`, Object.assign({
|
|
82
82
|
visible: !0,
|
|
83
83
|
x: itemAttr.shape.size / 2,
|
|
84
|
-
y: itemAttr.shape.size / 2 + ((null !== (_a = itemAttr.key.lineHeight) && void 0 !== _a ? _a : itemAttr.key.fontSize) - itemAttr.shape.size) / 2
|
|
84
|
+
y: itemAttr.shape.size / 2 + ((null !== (_a = (0, vrender_core_1.calculateLineHeight)(itemAttr.key.lineHeight, itemAttr.key.fontSize)) && void 0 !== _a ? _a : itemAttr.key.fontSize) - itemAttr.shape.size) / 2
|
|
85
85
|
}, itemAttr.shape), "symbol"), hasContentShape && (x += itemAttr.shape.size + itemAttr.shape.spacing),
|
|
86
86
|
(0, util_1.isVisible)(itemAttr.key)) {
|
|
87
87
|
let element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tooltip/tooltip.ts"],"names":[],"mappings":";;;AAIA,yDAA2D;AAC3D,6CAA2E;AAC3E,uCAAiD;AACjD,uCAA+C;AAC/C,kCAAoC;AAEpC,iCAA6D;AAC7D,qCAA0E;AAE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AAM,GAAG,eAAe,CAAC;QAEzC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,SAAqC;QACvD,OAAO,IAAA,oBAAa,EAClB,EAAE,EACF,OAAO,CAAC,iBAAiB,CAAC,UAAU,EACpC,OAAO,CAAC,iBAAiB,CAAC,KAAK,EAC/B,SAAS,CAAC,UAAU,EACpB,SAAS,CAAC,KAAK,CAChB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,SAAqC,EAAE,KAAa;QACxE,OAAO,IAAA,oBAAa,EAAC,EAAE,EAAE,OAAO,CAAC,iBAAiB,CAAC,YAAY,EAAE,SAAS,CAAC,YAAY,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IACrH,CAAC;;AA9dH,0BA+dC;AAjdQ,yBAAiB,GAA+B,0BAAiB,CAAC","file":"tooltip.js","sourcesContent":["/**\n * @description 标题组件\n */\nimport type { IGroup, IText, IRichText, IRect, ISymbol, IRichTextCharacter } from '@visactor/vrender-core';\nimport { builtinSymbolsMap } from '@visactor/vrender-core';\nimport { merge, isValid, normalizePadding, isNil } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { initTextMeasure } from '../util/text';\nimport { isVisible } from '../util';\nimport type { TooltipAttributes, TooltipRowAttrs, TooltipRowStyleAttrs } from './type';\nimport { getRichTextAttribute, mergeRowAttrs } from './util';\nimport { defaultAttributes, TOOLTIP_POSITION_ATTRIBUTES } from './config';\n\nconst TOOLTIP_BACKGROUND_NAME = 'tooltip-background';\nconst TOOLTIP_TITLE_NAME = 'tooltip-title';\nconst TOOLTIP_CONTENT_NAME = 'tooltip-content';\n\nconst TOOLTIP_SHAPE_NAME_SUFFIX = 'shape';\nconst TOOLTIP_KEY_NAME_SUFFIX = 'key';\nconst TOOLTIP_VALUE_NAME_SUFFIX = 'value';\n\nexport class Tooltip extends AbstractComponent<Required<TooltipAttributes>> {\n name = 'tooltip';\n\n // tooltip 背景\n private _tooltipPanel!: IRect;\n // tooltip title 容器\n private _tooltipTitleContainer!: IGroup;\n // tooltip title shape\n private _tooltipTitleSymbol!: ISymbol;\n // tooltip title 文本\n private _tooltipTitle!: IText | IRichText;\n // tooltip 内容项容器\n private _tooltipContent!: IGroup;\n\n static defaultAttributes: Partial<TooltipAttributes> = defaultAttributes;\n\n constructor(attributes: TooltipAttributes) {\n super(merge({}, Tooltip.defaultAttributes, attributes));\n }\n\n protected render() {\n const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure } =\n this.attribute;\n\n if (!visible) {\n this.hideAll();\n return;\n }\n\n if (autoMeasure) {\n Tooltip.measureTooltip(this.attribute);\n }\n if (autoCalculatePosition) {\n Tooltip.calculateTooltipPosition(this.attribute);\n }\n\n const padding = normalizePadding(this.attribute.padding);\n\n // 创建背景层\n this._tooltipPanel = this.createOrUpdateChild(\n TOOLTIP_BACKGROUND_NAME,\n {\n visible: true,\n ...panel\n },\n 'rect'\n ) as IRect;\n\n // 创建标题层\n this._tooltipTitleContainer = this.createOrUpdateChild(\n TOOLTIP_TITLE_NAME,\n { visible: true, x: padding[3], y: padding[0] },\n 'group'\n ) as IGroup;\n\n // 合并样式\n const titleAttr = Tooltip.getTitleAttr(this.attribute);\n\n // 创建标题 shape\n // 创建 symbol\n this._tooltipTitleSymbol = this._tooltipTitleContainer.createOrUpdateChild(\n `${TOOLTIP_TITLE_NAME}-${TOOLTIP_SHAPE_NAME_SUFFIX}`,\n merge({ symbolType: 'circle' }, titleAttr.shape, {\n visible: isVisible(titleAttr) && isVisible(titleAttr.shape)\n }),\n 'symbol'\n ) as ISymbol;\n\n // 文本\n if (titleAttr.value.type === 'rich') {\n this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(\n `${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`,\n {\n visible: isVisible(titleAttr) && isVisible(titleAttr.value),\n width: titleAttr.value.width,\n height: titleAttr.value.height,\n wordBreak: titleAttr.value.wordBreak as any,\n textAlign: titleAttr.value.textAlign as any,\n textBaseline: titleAttr.value.textBaseline as any,\n singleLine: false,\n textConfig: titleAttr.value.text as IRichTextCharacter[],\n ...titleAttr.value\n },\n 'richtext'\n ) as IRichText;\n } else if (titleAttr.value.type === 'html') {\n this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(\n `${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`,\n {\n html: {\n dom: titleAttr.value.text as string,\n container: '',\n width: 30,\n height: 30,\n style: {},\n ...titleAttr.value\n },\n visible: isVisible(titleAttr) && isVisible(titleAttr.value),\n width: titleAttr.value.width,\n height: titleAttr.value.height,\n wordBreak: titleAttr.value.wordBreak as any,\n textAlign: titleAttr.value.textAlign as any,\n textBaseline: titleAttr.value.textBaseline as any,\n singleLine: false,\n textConfig: [],\n ...titleAttr.value\n },\n 'richtext'\n ) as IRichText;\n } else if (titleAttr.value.multiLine) {\n this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(\n `${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`,\n {\n visible: isVisible(titleAttr) && isVisible(titleAttr.value),\n ...getRichTextAttribute(titleAttr.value)\n },\n 'richtext'\n ) as IRichText;\n } else {\n this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(\n `${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`,\n {\n text: '',\n visible: isVisible(titleAttr) && isVisible(titleAttr.value),\n ...titleAttr.value\n },\n 'text'\n ) as IText;\n }\n\n // 调整标题的位置\n const titlePaddingLeft = isVisible(titleAttr.shape) ? titleAttr.shape.size + titleAttr.shape.spacing : 0;\n const { textAlign, textBaseline } = titleAttr.value;\n const contentWidth = panel.width - padding[3] - padding[0] - titlePaddingLeft;\n if (textAlign === 'center') {\n this._tooltipTitle.setAttribute('x', titlePaddingLeft + contentWidth / 2);\n } else if (textAlign === 'right' || textAlign === 'end') {\n // 右对齐\n this._tooltipTitle.setAttribute('x', titlePaddingLeft + contentWidth);\n } else {\n // 默认左对齐\n this._tooltipTitle.setAttribute('x', titlePaddingLeft);\n }\n if (textBaseline === 'bottom') {\n this._tooltipTitle.setAttribute('y', titleAttr.height);\n } else if (textBaseline === 'middle') {\n this._tooltipTitle.setAttribute('y', titleAttr.height / 2);\n } else {\n this._tooltipTitle.setAttribute('y', 0);\n }\n const titleHeight = isVisible(titleAttr) ? titleAttr.height + titleAttr.spaceRow : 0;\n\n // 创建内容层\n this._tooltipContent = this.createOrUpdateChild(TOOLTIP_CONTENT_NAME, { visible: true }, 'group') as IGroup;\n this._tooltipContent.removeAllChild(); // 清空内容区\n\n if (content?.length) {\n this._tooltipContent.setAttribute('x', padding[3]);\n this._tooltipContent.setAttribute('y', padding[0] + titleHeight);\n\n let lastYPos = 0;\n content.forEach((item, i) => {\n // 合并样式\n const itemAttr = Tooltip.getContentAttr(this.attribute, i);\n\n if (!isVisible(itemAttr)) {\n return;\n }\n\n const itemGroupName = `${TOOLTIP_CONTENT_NAME}-${i}`;\n const itemGroup = this._tooltipContent.createOrUpdateChild(\n itemGroupName,\n { visible: true, x: 0, y: lastYPos },\n 'group'\n ) as IGroup;\n\n let x = 0;\n if (isVisible(itemAttr.shape)) {\n // 存在 symbol\n itemGroup.createOrUpdateChild(\n `${itemGroupName}-${TOOLTIP_SHAPE_NAME_SUFFIX}`,\n {\n visible: true,\n x: itemAttr.shape.size / 2,\n y:\n itemAttr.shape.size / 2 +\n ((itemAttr.key.lineHeight ?? itemAttr.key.fontSize) - itemAttr.shape.size) / 2,\n ...itemAttr.shape\n },\n 'symbol'\n ) as ISymbol;\n }\n if (hasContentShape) {\n x += itemAttr.shape.size + itemAttr.shape.spacing;\n }\n\n if (isVisible(itemAttr.key)) {\n let element: IRichText | IText;\n if (itemAttr.key.multiLine) {\n element = itemGroup.createOrUpdateChild(\n `${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`,\n {\n visible: true,\n ...getRichTextAttribute(itemAttr.key),\n textBaseline: 'top'\n },\n 'richtext'\n ) as IRichText;\n } else {\n element = itemGroup.createOrUpdateChild(\n `${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`,\n {\n visible: true,\n ...itemAttr.key,\n textBaseline: 'top'\n },\n 'text'\n ) as IText;\n }\n\n const { textAlign } = itemAttr.key;\n if (textAlign === 'center') {\n element.setAttribute('x', x + keyWidth / 2);\n } else if (textAlign === 'right' || textAlign === 'end') {\n // 右对齐\n element.setAttribute('x', x + keyWidth);\n } else {\n // 默认左对齐\n element.setAttribute('x', x);\n }\n\n element.setAttribute('y', 0);\n x += keyWidth + itemAttr.key.spacing;\n }\n\n if (isVisible(itemAttr.value)) {\n let element: IRichText | IText;\n if (itemAttr.value.multiLine) {\n element = itemGroup.createOrUpdateChild(\n `${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`,\n {\n visible: true,\n ...getRichTextAttribute(itemAttr.value),\n textBaseline: 'top'\n },\n 'richtext'\n ) as IRichText;\n } else {\n element = itemGroup.createOrUpdateChild(\n `${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`,\n {\n visible: true,\n ...itemAttr.value,\n textBaseline: 'top'\n },\n 'text'\n ) as IText;\n }\n\n let textAlign = 'right';\n if (isValid(itemAttr.value.textAlign)) {\n textAlign = itemAttr.value.textAlign;\n } else if (!isVisible(itemAttr.key)) {\n textAlign = 'left';\n }\n element.setAttribute('textAlign', textAlign);\n\n if (textAlign === 'center') {\n element.setAttribute('x', x + valueWidth / 2);\n } else if (textAlign === 'right' || textAlign === 'end') {\n // 右对齐\n element.setAttribute('x', x + valueWidth);\n } else {\n // 默认左对齐\n element.setAttribute('x', x);\n }\n x += valueWidth;\n\n element.setAttribute('y', 0);\n\n itemGroup.add(element);\n }\n\n lastYPos += itemAttr.height + itemAttr.spaceRow;\n });\n }\n }\n\n setAttributes(params: Partial<Required<TooltipAttributes>>, forceUpdateTag?: boolean | undefined): void {\n const keys = Object.keys(params) as (keyof TooltipAttributes)[];\n // 优化:只更改 tooltip 位置\n if (this.attribute.autoCalculatePosition && keys.every(key => TOOLTIP_POSITION_ATTRIBUTES.includes(key))) {\n this._mergeAttributes(params, keys);\n // 计算 x y\n if (isNil(this.attribute.panel.width) && this.attribute.autoMeasure) {\n Tooltip.measureTooltip(this.attribute);\n }\n Tooltip.calculateTooltipPosition(this.attribute);\n // 应用 x y\n super.setAttributes(\n {\n x: this.attribute.x,\n y: this.attribute.y\n },\n forceUpdateTag\n );\n } else {\n super.setAttributes(params, forceUpdateTag);\n }\n }\n\n static calculateTooltipPosition(attribute: Partial<TooltipAttributes>): Partial<TooltipAttributes> {\n const { width: tooltipBoxWidth = 0, height: tooltipBoxHeight = 0 } = attribute.panel;\n\n const { offsetX, offsetY, pointerX, pointerY, positionX, positionY, parentBounds } = attribute;\n\n let x = pointerX;\n let y = pointerY;\n if (positionX === 'left') {\n x -= tooltipBoxWidth + offsetX;\n } else if (positionX === 'center') {\n x -= tooltipBoxWidth / 2;\n } else {\n x += offsetX;\n }\n if (positionY === 'top') {\n y -= tooltipBoxHeight + offsetY;\n } else if (positionY === 'middle') {\n y -= tooltipBoxHeight / 2;\n } else {\n y += offsetY;\n }\n\n /* 确保tooltip在视区内 */\n if (x + tooltipBoxWidth > parentBounds.x2) {\n // 位置不超出视区右界\n x -= tooltipBoxWidth + offsetX;\n }\n if (y + tooltipBoxHeight > parentBounds.y2) {\n // 位置不超出视区下界\n y -= tooltipBoxHeight + offsetY;\n }\n if (x < parentBounds.x1) {\n // 位置不超出视区左界\n x = parentBounds.x1;\n }\n if (y < parentBounds.y1) {\n // 位置不超出视区上界\n y = parentBounds.y1;\n }\n\n attribute.x = x;\n attribute.y = y;\n\n return attribute;\n }\n\n static measureTooltip(attribute: Partial<TooltipAttributes>): Partial<TooltipAttributes> {\n const { content, contentStyle } = attribute;\n const padding = normalizePadding(attribute.padding);\n // 合并样式\n const titleAttr = Tooltip.getTitleAttr(attribute);\n\n let maxWidth = 0;\n let containerHeight = padding[0] + padding[2];\n\n // calculate title\n let titleMaxHeight = 0;\n const { value: titleValue, shape: titleShape } = titleAttr;\n const { visible: titleHasShape = false, symbolType: titleShapeType = '' } = titleShape ?? {};\n\n if (isValid(titleValue)) {\n const { width, height } = initTextMeasure(titleValue).quickMeasure(titleValue.text);\n maxWidth = width;\n titleMaxHeight = height;\n }\n if (titleHasShape && builtinSymbolsMap[titleShapeType]) {\n maxWidth += titleShape.size + titleShape.spacing;\n titleMaxHeight = Math.max(titleShape.size, titleMaxHeight);\n }\n\n if (attribute.title) {\n attribute.title.width = maxWidth;\n attribute.title.height = titleMaxHeight;\n }\n\n if (isVisible(titleAttr)) {\n containerHeight += titleMaxHeight + titleAttr.spaceRow;\n }\n\n // calculate content\n if (content?.length) {\n // filter content\n const filteredContent: [TooltipRowAttrs, TooltipRowAttrs][] = [];\n content.forEach((item, i) => {\n // 合并样式\n const itemAttr = Tooltip.getContentAttr(attribute, i);\n if ((item.key || item.value) && isVisible(itemAttr)) {\n filteredContent.push([item, itemAttr]);\n }\n });\n\n if (filteredContent.length) {\n let hasContentShape = false;\n const shapeWidths: number[] = [];\n const keyWidths: number[] = [];\n const valueWidths: number[] = [];\n\n filteredContent.forEach(([item, itemAttr], i) => {\n const { key, value, shape, spaceRow } = itemAttr;\n const itemHasShape = isVisible(shape);\n const itemShapeType = shape?.symbolType ?? '';\n\n const keyTextMeasure = initTextMeasure(key);\n const valueTextMeasure = initTextMeasure(value);\n\n let itemHeight = 0;\n if (isVisible(key)) {\n const { width, height } = keyTextMeasure.quickMeasure(key.text);\n keyWidths.push(width);\n itemHeight = Math.max(itemHeight, height);\n }\n if (isVisible(value)) {\n const { width, height } = valueTextMeasure.quickMeasure(value.text);\n valueWidths.push(width);\n itemHeight = Math.max(itemHeight, height);\n }\n if (itemHasShape && builtinSymbolsMap[itemShapeType]) {\n hasContentShape = true;\n shapeWidths.push(shape.size);\n itemHeight = Math.max(shape.size, itemHeight);\n }\n\n item.height = itemHeight;\n containerHeight += itemHeight;\n if (i < filteredContent.length - 1) {\n containerHeight += spaceRow ?? contentStyle.spaceRow;\n }\n });\n\n const maxShapeWidth = shapeWidths.length ? Math.max(...shapeWidths) : 0; // shape 需要对齐\n const maxKeyWidth = keyWidths.length ? Math.max(...keyWidths) : 0; // name 需要对齐\n const maxValueWidth = valueWidths.length ? Math.max(...valueWidths) : 0; // value 需要对齐\n maxWidth = Math.max(\n maxKeyWidth +\n maxValueWidth +\n contentStyle.key.spacing +\n contentStyle.value.spacing +\n (hasContentShape ? maxShapeWidth + contentStyle.shape.spacing : 0),\n maxWidth\n );\n content.forEach(item => {\n item.width = maxWidth;\n });\n attribute.hasContentShape = hasContentShape;\n attribute.keyWidth = maxKeyWidth;\n attribute.valueWidth = maxValueWidth;\n }\n }\n\n attribute.panel.width = maxWidth + padding[1] + padding[3];\n attribute.panel.height = containerHeight;\n\n return attribute;\n }\n\n static getTitleAttr(attribute: Partial<TooltipAttributes>): TooltipRowAttrs & TooltipRowStyleAttrs {\n return mergeRowAttrs(\n {},\n Tooltip.defaultAttributes.titleStyle,\n Tooltip.defaultAttributes.title,\n attribute.titleStyle,\n attribute.title\n );\n }\n\n static getContentAttr(attribute: Partial<TooltipAttributes>, index: number): TooltipRowAttrs & TooltipRowStyleAttrs {\n return mergeRowAttrs({}, Tooltip.defaultAttributes.contentStyle, attribute.contentStyle, attribute.content[index]);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/tooltip/tooltip.ts"],"names":[],"mappings":";;;AAIA,yDAAgF;AAChF,6CAA2E;AAC3E,uCAAiD;AACjD,uCAA+C;AAC/C,kCAAoC;AAEpC,iCAA6D;AAC7D,qCAA0E;AAE1E,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AACrD,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAC3C,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAE/C,MAAM,yBAAyB,GAAG,OA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CAAC,SAAqC;QACvD,OAAO,IAAA,oBAAa,EAClB,EAAE,EACF,OAAO,CAAC,iBAAiB,CAAC,UAAU,EACpC,OAAO,CAAC,iBAAiB,CAAC,KAAK,EAC/B,SAAS,CAAC,UAAU,EACpB,SAAS,CAAC,KAAK,CAChB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,SAAqC,EAAE,KAAa;QACxE,OAAO,IAAA,oBAAa,EAAC,EAAE,EAAE,OAAO,CAAC,iBAAiB,CAAC,YAAY,EAAE,SAAS,CAAC,YAAY,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IACrH,CAAC;;AAheH,0BAieC;AAndQ,yBAAiB,GAA+B,0BAAiB,CAAC","file":"tooltip.js","sourcesContent":["/**\n * @description 标题组件\n */\nimport type { IGroup, IText, IRichText, IRect, ISymbol, IRichTextCharacter } from '@visactor/vrender-core';\nimport { builtinSymbolsMap, calculateLineHeight } from '@visactor/vrender-core';\nimport { merge, isValid, normalizePadding, isNil } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { initTextMeasure } from '../util/text';\nimport { isVisible } from '../util';\nimport type { TooltipAttributes, TooltipRowAttrs, TooltipRowStyleAttrs } from './type';\nimport { getRichTextAttribute, mergeRowAttrs } from './util';\nimport { defaultAttributes, TOOLTIP_POSITION_ATTRIBUTES } from './config';\n\nconst TOOLTIP_BACKGROUND_NAME = 'tooltip-background';\nconst TOOLTIP_TITLE_NAME = 'tooltip-title';\nconst TOOLTIP_CONTENT_NAME = 'tooltip-content';\n\nconst TOOLTIP_SHAPE_NAME_SUFFIX = 'shape';\nconst TOOLTIP_KEY_NAME_SUFFIX = 'key';\nconst TOOLTIP_VALUE_NAME_SUFFIX = 'value';\n\nexport class Tooltip extends AbstractComponent<Required<TooltipAttributes>> {\n name = 'tooltip';\n\n // tooltip 背景\n private _tooltipPanel!: IRect;\n // tooltip title 容器\n private _tooltipTitleContainer!: IGroup;\n // tooltip title shape\n private _tooltipTitleSymbol!: ISymbol;\n // tooltip title 文本\n private _tooltipTitle!: IText | IRichText;\n // tooltip 内容项容器\n private _tooltipContent!: IGroup;\n\n static defaultAttributes: Partial<TooltipAttributes> = defaultAttributes;\n\n constructor(attributes: TooltipAttributes) {\n super(merge({}, Tooltip.defaultAttributes, attributes));\n }\n\n protected render() {\n const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure } =\n this.attribute;\n\n if (!visible) {\n this.hideAll();\n return;\n }\n\n if (autoMeasure) {\n Tooltip.measureTooltip(this.attribute);\n }\n if (autoCalculatePosition) {\n Tooltip.calculateTooltipPosition(this.attribute);\n }\n\n const padding = normalizePadding(this.attribute.padding);\n\n // 创建背景层\n this._tooltipPanel = this.createOrUpdateChild(\n TOOLTIP_BACKGROUND_NAME,\n {\n visible: true,\n ...panel\n },\n 'rect'\n ) as IRect;\n\n // 创建标题层\n this._tooltipTitleContainer = this.createOrUpdateChild(\n TOOLTIP_TITLE_NAME,\n { visible: true, x: padding[3], y: padding[0] },\n 'group'\n ) as IGroup;\n\n // 合并样式\n const titleAttr = Tooltip.getTitleAttr(this.attribute);\n\n // 创建标题 shape\n // 创建 symbol\n this._tooltipTitleSymbol = this._tooltipTitleContainer.createOrUpdateChild(\n `${TOOLTIP_TITLE_NAME}-${TOOLTIP_SHAPE_NAME_SUFFIX}`,\n merge({ symbolType: 'circle' }, titleAttr.shape, {\n visible: isVisible(titleAttr) && isVisible(titleAttr.shape)\n }),\n 'symbol'\n ) as ISymbol;\n\n // 文本\n if (titleAttr.value.type === 'rich') {\n this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(\n `${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`,\n {\n visible: isVisible(titleAttr) && isVisible(titleAttr.value),\n width: titleAttr.value.width,\n height: titleAttr.value.height,\n wordBreak: titleAttr.value.wordBreak as any,\n textAlign: titleAttr.value.textAlign as any,\n textBaseline: titleAttr.value.textBaseline as any,\n singleLine: false,\n textConfig: titleAttr.value.text as IRichTextCharacter[],\n ...titleAttr.value\n },\n 'richtext'\n ) as IRichText;\n } else if (titleAttr.value.type === 'html') {\n this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(\n `${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`,\n {\n html: {\n dom: titleAttr.value.text as string,\n container: '',\n width: 30,\n height: 30,\n style: {},\n ...titleAttr.value\n },\n visible: isVisible(titleAttr) && isVisible(titleAttr.value),\n width: titleAttr.value.width,\n height: titleAttr.value.height,\n wordBreak: titleAttr.value.wordBreak as any,\n textAlign: titleAttr.value.textAlign as any,\n textBaseline: titleAttr.value.textBaseline as any,\n singleLine: false,\n textConfig: [],\n ...titleAttr.value\n },\n 'richtext'\n ) as IRichText;\n } else if (titleAttr.value.multiLine) {\n this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(\n `${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`,\n {\n visible: isVisible(titleAttr) && isVisible(titleAttr.value),\n ...getRichTextAttribute(titleAttr.value)\n },\n 'richtext'\n ) as IRichText;\n } else {\n this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(\n `${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`,\n {\n text: '',\n visible: isVisible(titleAttr) && isVisible(titleAttr.value),\n ...titleAttr.value\n },\n 'text'\n ) as IText;\n }\n\n // 调整标题的位置\n const titlePaddingLeft = isVisible(titleAttr.shape) ? titleAttr.shape.size + titleAttr.shape.spacing : 0;\n const { textAlign, textBaseline } = titleAttr.value;\n const contentWidth = panel.width - padding[3] - padding[0] - titlePaddingLeft;\n if (textAlign === 'center') {\n this._tooltipTitle.setAttribute('x', titlePaddingLeft + contentWidth / 2);\n } else if (textAlign === 'right' || textAlign === 'end') {\n // 右对齐\n this._tooltipTitle.setAttribute('x', titlePaddingLeft + contentWidth);\n } else {\n // 默认左对齐\n this._tooltipTitle.setAttribute('x', titlePaddingLeft);\n }\n if (textBaseline === 'bottom') {\n this._tooltipTitle.setAttribute('y', titleAttr.height);\n } else if (textBaseline === 'middle') {\n this._tooltipTitle.setAttribute('y', titleAttr.height / 2);\n } else {\n this._tooltipTitle.setAttribute('y', 0);\n }\n const titleHeight = isVisible(titleAttr) ? titleAttr.height + titleAttr.spaceRow : 0;\n\n // 创建内容层\n this._tooltipContent = this.createOrUpdateChild(TOOLTIP_CONTENT_NAME, { visible: true }, 'group') as IGroup;\n this._tooltipContent.removeAllChild(); // 清空内容区\n\n if (content?.length) {\n this._tooltipContent.setAttribute('x', padding[3]);\n this._tooltipContent.setAttribute('y', padding[0] + titleHeight);\n\n let lastYPos = 0;\n content.forEach((item, i) => {\n // 合并样式\n const itemAttr = Tooltip.getContentAttr(this.attribute, i);\n\n if (!isVisible(itemAttr)) {\n return;\n }\n\n const itemGroupName = `${TOOLTIP_CONTENT_NAME}-${i}`;\n const itemGroup = this._tooltipContent.createOrUpdateChild(\n itemGroupName,\n { visible: true, x: 0, y: lastYPos },\n 'group'\n ) as IGroup;\n\n let x = 0;\n if (isVisible(itemAttr.shape)) {\n // 存在 symbol\n itemGroup.createOrUpdateChild(\n `${itemGroupName}-${TOOLTIP_SHAPE_NAME_SUFFIX}`,\n {\n visible: true,\n x: itemAttr.shape.size / 2,\n y:\n itemAttr.shape.size / 2 +\n ((calculateLineHeight(itemAttr.key.lineHeight, itemAttr.key.fontSize) ?? itemAttr.key.fontSize) -\n itemAttr.shape.size) /\n 2,\n ...itemAttr.shape\n },\n 'symbol'\n ) as ISymbol;\n }\n if (hasContentShape) {\n x += itemAttr.shape.size + itemAttr.shape.spacing;\n }\n\n if (isVisible(itemAttr.key)) {\n let element: IRichText | IText;\n if (itemAttr.key.multiLine) {\n element = itemGroup.createOrUpdateChild(\n `${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`,\n {\n visible: true,\n ...getRichTextAttribute(itemAttr.key),\n textBaseline: 'top'\n },\n 'richtext'\n ) as IRichText;\n } else {\n element = itemGroup.createOrUpdateChild(\n `${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`,\n {\n visible: true,\n ...itemAttr.key,\n textBaseline: 'top'\n },\n 'text'\n ) as IText;\n }\n\n const { textAlign } = itemAttr.key;\n if (textAlign === 'center') {\n element.setAttribute('x', x + keyWidth / 2);\n } else if (textAlign === 'right' || textAlign === 'end') {\n // 右对齐\n element.setAttribute('x', x + keyWidth);\n } else {\n // 默认左对齐\n element.setAttribute('x', x);\n }\n\n element.setAttribute('y', 0);\n x += keyWidth + itemAttr.key.spacing;\n }\n\n if (isVisible(itemAttr.value)) {\n let element: IRichText | IText;\n if (itemAttr.value.multiLine) {\n element = itemGroup.createOrUpdateChild(\n `${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`,\n {\n visible: true,\n ...getRichTextAttribute(itemAttr.value),\n textBaseline: 'top'\n },\n 'richtext'\n ) as IRichText;\n } else {\n element = itemGroup.createOrUpdateChild(\n `${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`,\n {\n visible: true,\n ...itemAttr.value,\n textBaseline: 'top'\n },\n 'text'\n ) as IText;\n }\n\n let textAlign = 'right';\n if (isValid(itemAttr.value.textAlign)) {\n textAlign = itemAttr.value.textAlign;\n } else if (!isVisible(itemAttr.key)) {\n textAlign = 'left';\n }\n element.setAttribute('textAlign', textAlign);\n\n if (textAlign === 'center') {\n element.setAttribute('x', x + valueWidth / 2);\n } else if (textAlign === 'right' || textAlign === 'end') {\n // 右对齐\n element.setAttribute('x', x + valueWidth);\n } else {\n // 默认左对齐\n element.setAttribute('x', x);\n }\n x += valueWidth;\n\n element.setAttribute('y', 0);\n\n itemGroup.add(element);\n }\n\n lastYPos += itemAttr.height + itemAttr.spaceRow;\n });\n }\n }\n\n setAttributes(params: Partial<Required<TooltipAttributes>>, forceUpdateTag?: boolean | undefined): void {\n const keys = Object.keys(params) as (keyof TooltipAttributes)[];\n // 优化:只更改 tooltip 位置\n if (this.attribute.autoCalculatePosition && keys.every(key => TOOLTIP_POSITION_ATTRIBUTES.includes(key))) {\n this._mergeAttributes(params, keys);\n // 计算 x y\n if (isNil(this.attribute.panel.width) && this.attribute.autoMeasure) {\n Tooltip.measureTooltip(this.attribute);\n }\n Tooltip.calculateTooltipPosition(this.attribute);\n // 应用 x y\n super.setAttributes(\n {\n x: this.attribute.x,\n y: this.attribute.y\n },\n forceUpdateTag\n );\n } else {\n super.setAttributes(params, forceUpdateTag);\n }\n }\n\n static calculateTooltipPosition(attribute: Partial<TooltipAttributes>): Partial<TooltipAttributes> {\n const { width: tooltipBoxWidth = 0, height: tooltipBoxHeight = 0 } = attribute.panel;\n\n const { offsetX, offsetY, pointerX, pointerY, positionX, positionY, parentBounds } = attribute;\n\n let x = pointerX;\n let y = pointerY;\n if (positionX === 'left') {\n x -= tooltipBoxWidth + offsetX;\n } else if (positionX === 'center') {\n x -= tooltipBoxWidth / 2;\n } else {\n x += offsetX;\n }\n if (positionY === 'top') {\n y -= tooltipBoxHeight + offsetY;\n } else if (positionY === 'middle') {\n y -= tooltipBoxHeight / 2;\n } else {\n y += offsetY;\n }\n\n /* 确保tooltip在视区内 */\n if (x + tooltipBoxWidth > parentBounds.x2) {\n // 位置不超出视区右界\n x -= tooltipBoxWidth + offsetX;\n }\n if (y + tooltipBoxHeight > parentBounds.y2) {\n // 位置不超出视区下界\n y -= tooltipBoxHeight + offsetY;\n }\n if (x < parentBounds.x1) {\n // 位置不超出视区左界\n x = parentBounds.x1;\n }\n if (y < parentBounds.y1) {\n // 位置不超出视区上界\n y = parentBounds.y1;\n }\n\n attribute.x = x;\n attribute.y = y;\n\n return attribute;\n }\n\n static measureTooltip(attribute: Partial<TooltipAttributes>): Partial<TooltipAttributes> {\n const { content, contentStyle } = attribute;\n const padding = normalizePadding(attribute.padding);\n // 合并样式\n const titleAttr = Tooltip.getTitleAttr(attribute);\n\n let maxWidth = 0;\n let containerHeight = padding[0] + padding[2];\n\n // calculate title\n let titleMaxHeight = 0;\n const { value: titleValue, shape: titleShape } = titleAttr;\n const { visible: titleHasShape = false, symbolType: titleShapeType = '' } = titleShape ?? {};\n\n if (isValid(titleValue)) {\n const { width, height } = initTextMeasure(titleValue).quickMeasure(titleValue.text);\n maxWidth = width;\n titleMaxHeight = height;\n }\n if (titleHasShape && builtinSymbolsMap[titleShapeType]) {\n maxWidth += titleShape.size + titleShape.spacing;\n titleMaxHeight = Math.max(titleShape.size, titleMaxHeight);\n }\n\n if (attribute.title) {\n attribute.title.width = maxWidth;\n attribute.title.height = titleMaxHeight;\n }\n\n if (isVisible(titleAttr)) {\n containerHeight += titleMaxHeight + titleAttr.spaceRow;\n }\n\n // calculate content\n if (content?.length) {\n // filter content\n const filteredContent: [TooltipRowAttrs, TooltipRowAttrs][] = [];\n content.forEach((item, i) => {\n // 合并样式\n const itemAttr = Tooltip.getContentAttr(attribute, i);\n if ((item.key || item.value) && isVisible(itemAttr)) {\n filteredContent.push([item, itemAttr]);\n }\n });\n\n if (filteredContent.length) {\n let hasContentShape = false;\n const shapeWidths: number[] = [];\n const keyWidths: number[] = [];\n const valueWidths: number[] = [];\n\n filteredContent.forEach(([item, itemAttr], i) => {\n const { key, value, shape, spaceRow } = itemAttr;\n const itemHasShape = isVisible(shape);\n const itemShapeType = shape?.symbolType ?? '';\n\n const keyTextMeasure = initTextMeasure(key);\n const valueTextMeasure = initTextMeasure(value);\n\n let itemHeight = 0;\n if (isVisible(key)) {\n const { width, height } = keyTextMeasure.quickMeasure(key.text);\n keyWidths.push(width);\n itemHeight = Math.max(itemHeight, height);\n }\n if (isVisible(value)) {\n const { width, height } = valueTextMeasure.quickMeasure(value.text);\n valueWidths.push(width);\n itemHeight = Math.max(itemHeight, height);\n }\n if (itemHasShape && builtinSymbolsMap[itemShapeType]) {\n hasContentShape = true;\n shapeWidths.push(shape.size);\n itemHeight = Math.max(shape.size, itemHeight);\n }\n\n item.height = itemHeight;\n containerHeight += itemHeight;\n if (i < filteredContent.length - 1) {\n containerHeight += spaceRow ?? contentStyle.spaceRow;\n }\n });\n\n const maxShapeWidth = shapeWidths.length ? Math.max(...shapeWidths) : 0; // shape 需要对齐\n const maxKeyWidth = keyWidths.length ? Math.max(...keyWidths) : 0; // name 需要对齐\n const maxValueWidth = valueWidths.length ? Math.max(...valueWidths) : 0; // value 需要对齐\n maxWidth = Math.max(\n maxKeyWidth +\n maxValueWidth +\n contentStyle.key.spacing +\n contentStyle.value.spacing +\n (hasContentShape ? maxShapeWidth + contentStyle.shape.spacing : 0),\n maxWidth\n );\n content.forEach(item => {\n item.width = maxWidth;\n });\n attribute.hasContentShape = hasContentShape;\n attribute.keyWidth = maxKeyWidth;\n attribute.valueWidth = maxValueWidth;\n }\n }\n\n attribute.panel.width = maxWidth + padding[1] + padding[3];\n attribute.panel.height = containerHeight;\n\n return attribute;\n }\n\n static getTitleAttr(attribute: Partial<TooltipAttributes>): TooltipRowAttrs & TooltipRowStyleAttrs {\n return mergeRowAttrs(\n {},\n Tooltip.defaultAttributes.titleStyle,\n Tooltip.defaultAttributes.title,\n attribute.titleStyle,\n attribute.title\n );\n }\n\n static getContentAttr(attribute: Partial<TooltipAttributes>, index: number): TooltipRowAttrs & TooltipRowStyleAttrs {\n return mergeRowAttrs({}, Tooltip.defaultAttributes.contentStyle, attribute.contentStyle, attribute.content[index]);\n }\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -4470,7 +4470,10 @@
|
|
|
4470
4470
|
direction: "horizontal",
|
|
4471
4471
|
wordBreak: "break-all",
|
|
4472
4472
|
ignoreBuf: !1,
|
|
4473
|
-
verticalMode: 0
|
|
4473
|
+
verticalMode: 0,
|
|
4474
|
+
whiteSpace: "no-wrap",
|
|
4475
|
+
heightLimit: 1 / 0,
|
|
4476
|
+
lineClamp: 1 / 0
|
|
4474
4477
|
};
|
|
4475
4478
|
var DefaultStyle = Object.assign(Object.assign(Object.assign({
|
|
4476
4479
|
opacity: 1,
|
|
@@ -7460,6 +7463,12 @@
|
|
|
7460
7463
|
}();
|
|
7461
7464
|
RafBasedSTO.TimeOut = 1e3 / 60;
|
|
7462
7465
|
new RafBasedSTO();
|
|
7466
|
+
var calculateLineHeight = function calculateLineHeight(lineHeight, fontSize) {
|
|
7467
|
+
if (vutils.isString(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
7468
|
+
return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
|
|
7469
|
+
}
|
|
7470
|
+
return lineHeight;
|
|
7471
|
+
};
|
|
7463
7472
|
|
|
7464
7473
|
var IncreaseCount = /*#__PURE__*/function (_ACustomAnimate) {
|
|
7465
7474
|
_inherits(IncreaseCount, _ACustomAnimate);
|
|
@@ -9963,7 +9972,7 @@
|
|
|
9963
9972
|
return CanvasTextLayout;
|
|
9964
9973
|
}();
|
|
9965
9974
|
|
|
9966
|
-
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
9975
|
+
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
9967
9976
|
var Text = /*#__PURE__*/function (_Graphic) {
|
|
9968
9977
|
_inherits(Text, _Graphic);
|
|
9969
9978
|
var _super = _createSuper(Text);
|
|
@@ -10037,6 +10046,117 @@
|
|
|
10037
10046
|
paddingArray = parsePadding(boundsPadding);
|
|
10038
10047
|
return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
|
|
10039
10048
|
}
|
|
10049
|
+
}, {
|
|
10050
|
+
key: "updateWrapAABBBounds",
|
|
10051
|
+
value: function updateWrapAABBBounds(text) {
|
|
10052
|
+
var _a, _b, _c, _d;
|
|
10053
|
+
var textTheme = getTheme(this).text,
|
|
10054
|
+
_this$attribute = this.attribute,
|
|
10055
|
+
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
10056
|
+
fontFamily = _this$attribute$fontF === void 0 ? textTheme.fontFamily : _this$attribute$fontF,
|
|
10057
|
+
_this$attribute$textA = _this$attribute.textAlign,
|
|
10058
|
+
textAlign = _this$attribute$textA === void 0 ? textTheme.textAlign : _this$attribute$textA,
|
|
10059
|
+
_this$attribute$textB = _this$attribute.textBaseline,
|
|
10060
|
+
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
10061
|
+
_this$attribute$fontS = _this$attribute.fontSize,
|
|
10062
|
+
fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
|
|
10063
|
+
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
10064
|
+
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
10065
|
+
maxLineWidth = _this$attribute.maxLineWidth,
|
|
10066
|
+
_this$attribute$strok = _this$attribute.stroke,
|
|
10067
|
+
stroke = _this$attribute$strok === void 0 ? textTheme.stroke : _this$attribute$strok,
|
|
10068
|
+
_this$attribute$lineW = _this$attribute.lineWidth,
|
|
10069
|
+
lineWidth = _this$attribute$lineW === void 0 ? textTheme.lineWidth : _this$attribute$lineW,
|
|
10070
|
+
_this$attribute$wordB = _this$attribute.wordBreak,
|
|
10071
|
+
wordBreak = _this$attribute$wordB === void 0 ? textTheme.wordBreak : _this$attribute$wordB,
|
|
10072
|
+
_this$attribute$fontW = _this$attribute.fontWeight,
|
|
10073
|
+
fontWeight = _this$attribute$fontW === void 0 ? textTheme.fontWeight : _this$attribute$fontW,
|
|
10074
|
+
_this$attribute$ignor = _this$attribute.ignoreBuf,
|
|
10075
|
+
ignoreBuf = _this$attribute$ignor === void 0 ? textTheme.ignoreBuf : _this$attribute$ignor,
|
|
10076
|
+
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
10077
|
+
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
10078
|
+
lineClamp = _this$attribute.lineClamp,
|
|
10079
|
+
lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
|
|
10080
|
+
buf = ignoreBuf ? 0 : 2;
|
|
10081
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
10082
|
+
var _bbox = this.cache.layoutData.bbox;
|
|
10083
|
+
return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10084
|
+
}
|
|
10085
|
+
var textMeasure = application.graphicUtil.textMeasure,
|
|
10086
|
+
layoutObj = new CanvasTextLayout(fontFamily, {
|
|
10087
|
+
fontSize: fontSize,
|
|
10088
|
+
fontWeight: fontWeight,
|
|
10089
|
+
fontFamily: fontFamily
|
|
10090
|
+
}, textMeasure),
|
|
10091
|
+
lines = vutils.isArray(text) ? text.map(function (l) {
|
|
10092
|
+
return l.toString();
|
|
10093
|
+
}) : [text.toString()],
|
|
10094
|
+
linesLayout = [],
|
|
10095
|
+
bboxWH = [0, 0];
|
|
10096
|
+
var lineCountLimit = 1 / 0;
|
|
10097
|
+
if (heightLimit > 0 && (lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1)), lineClamp && (lineCountLimit = Math.min(lineCountLimit, lineClamp)), "number" == typeof maxLineWidth && maxLineWidth !== 1 / 0) {
|
|
10098
|
+
if (maxLineWidth > 0) for (var i = 0; i < lines.length; i++) {
|
|
10099
|
+
var str = lines[i];
|
|
10100
|
+
var needCut = !0;
|
|
10101
|
+
if (i === lineCountLimit - 1) {
|
|
10102
|
+
var _clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
10103
|
+
linesLayout.push({
|
|
10104
|
+
str: _clip.str,
|
|
10105
|
+
width: _clip.width
|
|
10106
|
+
});
|
|
10107
|
+
break;
|
|
10108
|
+
}
|
|
10109
|
+
var clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-word" === wordBreak);
|
|
10110
|
+
if ("" !== str && "" === clip.str) {
|
|
10111
|
+
if (ellipsis) {
|
|
10112
|
+
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
10113
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
10114
|
+
} else clip.str = "", clip.width = 0;
|
|
10115
|
+
needCut = !1;
|
|
10116
|
+
}
|
|
10117
|
+
if (linesLayout.push({
|
|
10118
|
+
str: clip.str,
|
|
10119
|
+
width: clip.width
|
|
10120
|
+
}), clip.str.length === str.length) ;else if (needCut) {
|
|
10121
|
+
var newStr = str.substring(clip.str.length);
|
|
10122
|
+
lines.splice(i + 1, 0, newStr);
|
|
10123
|
+
}
|
|
10124
|
+
}
|
|
10125
|
+
var maxWidth = 0;
|
|
10126
|
+
linesLayout.forEach(function (layout) {
|
|
10127
|
+
maxWidth = Math.max(maxWidth, layout.width);
|
|
10128
|
+
}), bboxWH[0] = maxWidth;
|
|
10129
|
+
} else {
|
|
10130
|
+
var width,
|
|
10131
|
+
_text,
|
|
10132
|
+
_lineWidth = 0;
|
|
10133
|
+
for (var _i = 0, len = lines.length; _i < len; _i++) {
|
|
10134
|
+
if (_i === lineCountLimit - 1) {
|
|
10135
|
+
var _clip2 = layoutObj.textMeasure.clipTextWithSuffix(lines[_i], layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
10136
|
+
linesLayout.push({
|
|
10137
|
+
str: _clip2.str,
|
|
10138
|
+
width: _clip2.width
|
|
10139
|
+
}), _lineWidth = Math.max(_lineWidth, _clip2.width);
|
|
10140
|
+
break;
|
|
10141
|
+
}
|
|
10142
|
+
_text = lines[_i], width = layoutObj.textMeasure.measureTextWidth(_text, layoutObj.textOptions, "break-word" === wordBreak), _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
|
|
10143
|
+
str: _text,
|
|
10144
|
+
width: width
|
|
10145
|
+
});
|
|
10146
|
+
}
|
|
10147
|
+
bboxWH[0] = _lineWidth;
|
|
10148
|
+
}
|
|
10149
|
+
bboxWH[1] = linesLayout.length * (lineHeight + buf);
|
|
10150
|
+
var bbox = {
|
|
10151
|
+
xOffset: 0,
|
|
10152
|
+
yOffset: 0,
|
|
10153
|
+
width: bboxWH[0],
|
|
10154
|
+
height: bboxWH[1]
|
|
10155
|
+
};
|
|
10156
|
+
layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
|
|
10157
|
+
var layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
10158
|
+
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10159
|
+
}
|
|
10040
10160
|
}, {
|
|
10041
10161
|
key: "updateSingallineAABBBounds",
|
|
10042
10162
|
value: function updateSingallineAABBBounds(text) {
|
|
@@ -10083,9 +10203,12 @@
|
|
|
10083
10203
|
_attribute$wordBreak === void 0 ? textTheme.wordBreak : _attribute$wordBreak;
|
|
10084
10204
|
var _attribute$ignoreBuf = attribute.ignoreBuf,
|
|
10085
10205
|
ignoreBuf = _attribute$ignoreBuf === void 0 ? textTheme.ignoreBuf : _attribute$ignoreBuf,
|
|
10086
|
-
|
|
10087
|
-
_attribute$
|
|
10088
|
-
|
|
10206
|
+
_attribute$whiteSpace = attribute.whiteSpace,
|
|
10207
|
+
whiteSpace = _attribute$whiteSpace === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace;
|
|
10208
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
10209
|
+
var buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
|
|
10210
|
+
textFontSize = attribute.fontSize || textTheme.fontSize,
|
|
10211
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
|
|
10089
10212
|
if (!this.shouldUpdateShape() && this.cache) {
|
|
10090
10213
|
width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
|
|
10091
10214
|
var _dx = textDrawOffsetX(textAlign, width),
|
|
@@ -10155,12 +10278,11 @@
|
|
|
10155
10278
|
fontFamily = _attribute$fontFamily2 === void 0 ? textTheme.fontFamily : _attribute$fontFamily2,
|
|
10156
10279
|
_attribute$stroke2 = attribute.stroke,
|
|
10157
10280
|
stroke = _attribute$stroke2 === void 0 ? textTheme.stroke : _attribute$stroke2,
|
|
10158
|
-
_attribute$lineHeight2 = attribute.lineHeight,
|
|
10159
|
-
lineHeight = _attribute$lineHeight2 === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight2,
|
|
10160
10281
|
_attribute$lineWidth2 = attribute.lineWidth,
|
|
10161
10282
|
lineWidth = _attribute$lineWidth2 === void 0 ? textTheme.lineWidth : _attribute$lineWidth2,
|
|
10162
10283
|
_attribute$verticalMo = attribute.verticalMode,
|
|
10163
|
-
verticalMode = _attribute$verticalMo === void 0 ? textTheme.verticalMode : _attribute$verticalMo
|
|
10284
|
+
verticalMode = _attribute$verticalMo === void 0 ? textTheme.verticalMode : _attribute$verticalMo,
|
|
10285
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
10164
10286
|
var _attribute$textAlign2 = attribute.textAlign,
|
|
10165
10287
|
textAlign = _attribute$textAlign2 === void 0 ? textTheme.textAlign : _attribute$textAlign2,
|
|
10166
10288
|
_attribute$textBaseli2 = attribute.textBaseline,
|
|
@@ -10210,7 +10332,7 @@
|
|
|
10210
10332
|
}, {
|
|
10211
10333
|
key: "updateHorizontalMultilineAABBBounds",
|
|
10212
10334
|
value: function updateHorizontalMultilineAABBBounds(text) {
|
|
10213
|
-
var _a;
|
|
10335
|
+
var _a, _b;
|
|
10214
10336
|
var textTheme = getTheme(this).text,
|
|
10215
10337
|
attribute = this.attribute,
|
|
10216
10338
|
_attribute$fontFamily3 = attribute.fontFamily,
|
|
@@ -10223,8 +10345,6 @@
|
|
|
10223
10345
|
fontSize = _attribute$fontSize3 === void 0 ? textTheme.fontSize : _attribute$fontSize3,
|
|
10224
10346
|
_attribute$fontWeight3 = attribute.fontWeight,
|
|
10225
10347
|
fontWeight = _attribute$fontWeight3 === void 0 ? textTheme.fontWeight : _attribute$fontWeight3,
|
|
10226
|
-
_attribute$lineHeight3 = attribute.lineHeight,
|
|
10227
|
-
lineHeight = _attribute$lineHeight3 === void 0 ? attribute.lineHeight || attribute.fontSize || textTheme.fontSize : _attribute$lineHeight3,
|
|
10228
10348
|
_attribute$ellipsis3 = attribute.ellipsis,
|
|
10229
10349
|
ellipsis = _attribute$ellipsis3 === void 0 ? textTheme.ellipsis : _attribute$ellipsis3,
|
|
10230
10350
|
maxLineWidth = attribute.maxLineWidth,
|
|
@@ -10232,11 +10352,13 @@
|
|
|
10232
10352
|
stroke = _attribute$stroke3 === void 0 ? textTheme.stroke : _attribute$stroke3,
|
|
10233
10353
|
_attribute$lineWidth3 = attribute.lineWidth,
|
|
10234
10354
|
lineWidth = _attribute$lineWidth3 === void 0 ? textTheme.lineWidth : _attribute$lineWidth3,
|
|
10235
|
-
_attribute$
|
|
10236
|
-
_attribute$
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
|
|
10355
|
+
_attribute$whiteSpace2 = attribute.whiteSpace,
|
|
10356
|
+
whiteSpace = _attribute$whiteSpace2 === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace2,
|
|
10357
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
|
|
10358
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
10359
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
10360
|
+
var _bbox2 = this.cache.layoutData.bbox;
|
|
10361
|
+
return this._AABBBounds.set(_bbox2.xOffset, _bbox2.yOffset, _bbox2.xOffset + _bbox2.width, _bbox2.yOffset + _bbox2.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10240
10362
|
}
|
|
10241
10363
|
var textMeasure = application.graphicUtil.textMeasure,
|
|
10242
10364
|
layoutData = new CanvasTextLayout(fontFamily, {
|
|
@@ -10270,12 +10392,11 @@
|
|
|
10270
10392
|
fontWeight = _attribute$fontWeight4 === void 0 ? textTheme.fontWeight : _attribute$fontWeight4,
|
|
10271
10393
|
_attribute$stroke4 = attribute.stroke,
|
|
10272
10394
|
stroke = _attribute$stroke4 === void 0 ? textTheme.stroke : _attribute$stroke4,
|
|
10273
|
-
_attribute$lineHeight4 = attribute.lineHeight,
|
|
10274
|
-
lineHeight = _attribute$lineHeight4 === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight4,
|
|
10275
10395
|
_attribute$lineWidth4 = attribute.lineWidth,
|
|
10276
10396
|
lineWidth = _attribute$lineWidth4 === void 0 ? textTheme.lineWidth : _attribute$lineWidth4,
|
|
10277
10397
|
_attribute$verticalMo2 = attribute.verticalMode,
|
|
10278
|
-
verticalMode = _attribute$verticalMo2 === void 0 ? textTheme.verticalMode : _attribute$verticalMo2
|
|
10398
|
+
verticalMode = _attribute$verticalMo2 === void 0 ? textTheme.verticalMode : _attribute$verticalMo2,
|
|
10399
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
10279
10400
|
var _attribute$textAlign4 = attribute.textAlign,
|
|
10280
10401
|
textAlign = _attribute$textAlign4 === void 0 ? textTheme.textAlign : _attribute$textAlign4,
|
|
10281
10402
|
_attribute$textBaseli4 = attribute.textBaseline,
|
|
@@ -10408,7 +10529,7 @@
|
|
|
10408
10529
|
}, {
|
|
10409
10530
|
key: "updateMultilineAABBBounds",
|
|
10410
10531
|
value: function updateMultilineAABBBounds(text) {
|
|
10411
|
-
var _a, _b, _c;
|
|
10532
|
+
var _a, _b, _c, _d;
|
|
10412
10533
|
var textTheme = getTheme(this).text,
|
|
10413
10534
|
_this$attribute = this.attribute,
|
|
10414
10535
|
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
@@ -10419,8 +10540,6 @@
|
|
|
10419
10540
|
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
10420
10541
|
_this$attribute$fontS = _this$attribute.fontSize,
|
|
10421
10542
|
fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
|
|
10422
|
-
_this$attribute$lineH = _this$attribute.lineHeight,
|
|
10423
|
-
lineHeight = _this$attribute$lineH === void 0 ? this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize : _this$attribute$lineH,
|
|
10424
10543
|
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
10425
10544
|
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
10426
10545
|
maxLineWidth = _this$attribute.maxLineWidth,
|
|
@@ -10437,8 +10556,9 @@
|
|
|
10437
10556
|
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
10438
10557
|
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
10439
10558
|
lineClamp = _this$attribute.lineClamp,
|
|
10559
|
+
lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
|
|
10440
10560
|
buf = ignoreBuf ? 0 : 2;
|
|
10441
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
10561
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
10442
10562
|
var _bbox = this.cache.layoutData.bbox;
|
|
10443
10563
|
return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10444
10564
|
}
|
|
@@ -10470,7 +10590,7 @@
|
|
|
10470
10590
|
if ("" !== str && "" === clip.str) {
|
|
10471
10591
|
if (ellipsis) {
|
|
10472
10592
|
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
10473
|
-
clip.str = null !== (
|
|
10593
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
10474
10594
|
} else clip.str = "", clip.width = 0;
|
|
10475
10595
|
needCut = !1;
|
|
10476
10596
|
}
|
|
@@ -11286,6 +11406,13 @@
|
|
|
11286
11406
|
builtinSymbols.forEach(function (symbol) {
|
|
11287
11407
|
builtinSymbolsMap[symbol.type] = symbol;
|
|
11288
11408
|
});
|
|
11409
|
+
var builtInSymbolStrMap = {
|
|
11410
|
+
arrowLeft: "M 0.25 -0.5 L -0.25 0 l 0.5 0.5",
|
|
11411
|
+
arrowRight: "M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",
|
|
11412
|
+
rect: "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",
|
|
11413
|
+
rectRound: "M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",
|
|
11414
|
+
roundLine: "M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"
|
|
11415
|
+
};
|
|
11289
11416
|
|
|
11290
11417
|
var SYMBOL_UPDATE_TAG_KEY = ["symbolType", "size"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
11291
11418
|
var _Symbol = /*#__PURE__*/function (_Graphic) {
|
|
@@ -11319,12 +11446,13 @@
|
|
|
11319
11446
|
}, {
|
|
11320
11447
|
key: "doUpdateParsedPath",
|
|
11321
11448
|
value: function doUpdateParsedPath() {
|
|
11322
|
-
var symbolTheme = getTheme(this).symbol
|
|
11323
|
-
|
|
11324
|
-
symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo
|
|
11325
|
-
|
|
11449
|
+
var symbolTheme = getTheme(this).symbol;
|
|
11450
|
+
var _this$attribute$symbo = this.attribute.symbolType,
|
|
11451
|
+
symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo,
|
|
11452
|
+
path = builtinSymbolsMap[symbolType];
|
|
11326
11453
|
if (path) return this._parsedPath = path, path;
|
|
11327
11454
|
if (path = _Symbol.userSymbolMap[symbolType], path) return this._parsedPath = path, path;
|
|
11455
|
+
symbolType = builtInSymbolStrMap[symbolType] || symbolType;
|
|
11328
11456
|
if (!0 === isSvg(symbolType)) {
|
|
11329
11457
|
var parser = new XMLParser(),
|
|
11330
11458
|
_parser$parse = parser.parse(symbolType),
|
|
@@ -11810,7 +11938,9 @@
|
|
|
11810
11938
|
var Paragraph = /*#__PURE__*/function () {
|
|
11811
11939
|
function Paragraph(text, newLine, character) {
|
|
11812
11940
|
_classCallCheck(this, Paragraph);
|
|
11813
|
-
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic"
|
|
11941
|
+
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic";
|
|
11942
|
+
var lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
|
|
11943
|
+
this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
|
|
11814
11944
|
var _measureTextCanvas = measureTextCanvas(text, character),
|
|
11815
11945
|
ascent = _measureTextCanvas.ascent,
|
|
11816
11946
|
height = _measureTextCanvas.height,
|
|
@@ -15341,7 +15471,7 @@
|
|
|
15341
15471
|
var t = textAlign;
|
|
15342
15472
|
textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
|
|
15343
15473
|
}
|
|
15344
|
-
var lineHeight = null !== (_c = text.attribute.lineHeight) && void 0 !== _c ? _c : fontSize,
|
|
15474
|
+
var lineHeight = null !== (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _c ? _c : fontSize,
|
|
15345
15475
|
data = this.valid(text, textAttribute, fillCb, strokeCb);
|
|
15346
15476
|
if (!data) return;
|
|
15347
15477
|
var fVisible = data.fVisible,
|
|
@@ -31002,7 +31132,9 @@
|
|
|
31002
31132
|
let x = 0;
|
|
31003
31133
|
if (isVisible(itemAttr.shape)) {
|
|
31004
31134
|
itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_SHAPE_NAME_SUFFIX}`, Object.assign({ visible: true, x: itemAttr.shape.size / 2, y: itemAttr.shape.size / 2 +
|
|
31005
|
-
(((_a = itemAttr.key.lineHeight) !== null && _a !== void 0 ? _a : itemAttr.key.fontSize) -
|
|
31135
|
+
(((_a = calculateLineHeight(itemAttr.key.lineHeight, itemAttr.key.fontSize)) !== null && _a !== void 0 ? _a : itemAttr.key.fontSize) -
|
|
31136
|
+
itemAttr.shape.size) /
|
|
31137
|
+
2 }, itemAttr.shape), 'symbol');
|
|
31006
31138
|
}
|
|
31007
31139
|
if (hasContentShape) {
|
|
31008
31140
|
x += itemAttr.shape.size + itemAttr.shape.spacing;
|
|
@@ -31383,7 +31515,7 @@
|
|
|
31383
31515
|
}
|
|
31384
31516
|
};
|
|
31385
31517
|
|
|
31386
|
-
const version = "0.16.14-alpha.
|
|
31518
|
+
const version = "0.16.14-alpha.7";
|
|
31387
31519
|
|
|
31388
31520
|
exports.AbstractComponent = AbstractComponent;
|
|
31389
31521
|
exports.ArcInfo = ArcInfo;
|