@visactor/vrender-core 0.21.0-alpha.3 → 0.21.0-beta.0
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/animate/Ticker/default-ticker.d.ts +4 -2
- package/cjs/animate/Ticker/default-ticker.js +8 -5
- package/cjs/animate/Ticker/default-ticker.js.map +1 -1
- package/cjs/animate/custom-animate.d.ts +2 -0
- package/cjs/animate/custom-animate.js +11 -2
- package/cjs/animate/custom-animate.js.map +1 -1
- package/cjs/common/3d-interceptor.js +1 -2
- package/cjs/common/bounds-context.js +2 -1
- package/cjs/common/morphing-utils.js +1 -1
- package/cjs/common/path-svg.js +1 -1
- package/cjs/common/polygon.js +2 -2
- package/cjs/common/rect-utils.js +1 -1
- package/cjs/common/render-area.js +1 -1
- package/cjs/common/render-command-list.js +1 -2
- package/cjs/common/render-curve.js +1 -1
- package/cjs/common/render-utils.js +1 -1
- package/cjs/common/seg-context.js +1 -1
- package/cjs/common/simplify.js +1 -1
- package/cjs/common/sort.js +1 -1
- package/cjs/common/split-path.js +1 -1
- package/cjs/common/store.js +1 -1
- package/cjs/common/text.js.map +1 -1
- package/cjs/core/application.js +2 -1
- package/cjs/core/camera.js +1 -1
- package/cjs/core/constants.js +1 -1
- package/cjs/core/contributions/textMeasure/AtextMeasure.d.ts +4 -55
- package/cjs/core/contributions/textMeasure/AtextMeasure.js +13 -92
- package/cjs/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/cjs/core/contributions/textMeasure/layout.d.ts +1 -0
- package/cjs/core/contributions/textMeasure/layout.js +30 -20
- package/cjs/core/contributions/textMeasure/layout.js.map +1 -1
- package/cjs/core/core-modules.js +1 -1
- package/cjs/core/global-module.js +2 -0
- package/cjs/core/global.js +1 -1
- package/cjs/core/graphic-utils.js +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/layer-service.js +1 -1
- package/cjs/core/layer.js +1 -1
- package/cjs/core/light.js +1 -1
- package/cjs/core/stage.d.ts +2 -0
- package/cjs/core/stage.js +10 -6
- package/cjs/core/stage.js.map +1 -1
- package/cjs/core/window.js +1 -1
- package/cjs/graphic/builtin-symbol/arrow.js +2 -2
- package/cjs/graphic/builtin-symbol/arrow.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-down.js +2 -2
- package/cjs/graphic/builtin-symbol/arrow2-down.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-left.js +2 -2
- package/cjs/graphic/builtin-symbol/arrow2-left.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-right.js +2 -2
- package/cjs/graphic/builtin-symbol/arrow2-right.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-up.js +2 -2
- package/cjs/graphic/builtin-symbol/arrow2-up.js.map +1 -1
- package/cjs/graphic/builtin-symbol/base.d.ts +1 -0
- package/cjs/graphic/builtin-symbol/base.js +3 -0
- package/cjs/graphic/builtin-symbol/base.js.map +1 -1
- package/cjs/graphic/builtin-symbol/circle.js +3 -3
- package/cjs/graphic/builtin-symbol/circle.js.map +1 -1
- package/cjs/graphic/builtin-symbol/close.js +3 -3
- package/cjs/graphic/builtin-symbol/close.js.map +1 -1
- package/cjs/graphic/builtin-symbol/cross.js +2 -2
- package/cjs/graphic/builtin-symbol/cross.js.map +1 -1
- package/cjs/graphic/builtin-symbol/diamond.js +3 -3
- package/cjs/graphic/builtin-symbol/diamond.js.map +1 -1
- package/cjs/graphic/builtin-symbol/line-h.js +3 -3
- package/cjs/graphic/builtin-symbol/line-h.js.map +1 -1
- package/cjs/graphic/builtin-symbol/line-v.js +3 -3
- package/cjs/graphic/builtin-symbol/line-v.js.map +1 -1
- package/cjs/graphic/builtin-symbol/square.js +2 -2
- package/cjs/graphic/builtin-symbol/square.js.map +1 -1
- package/cjs/graphic/builtin-symbol/star.js +2 -2
- package/cjs/graphic/builtin-symbol/star.js.map +1 -1
- package/cjs/graphic/builtin-symbol/stroke.js +2 -2
- package/cjs/graphic/builtin-symbol/stroke.js.map +1 -1
- package/cjs/graphic/builtin-symbol/thin-triangle.js +2 -2
- package/cjs/graphic/builtin-symbol/thin-triangle.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-down.js +2 -2
- package/cjs/graphic/builtin-symbol/triangle-down.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-left.js +2 -2
- package/cjs/graphic/builtin-symbol/triangle-left.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-right.js +2 -2
- package/cjs/graphic/builtin-symbol/triangle-right.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-up.js +2 -2
- package/cjs/graphic/builtin-symbol/triangle-up.js.map +1 -1
- package/cjs/graphic/builtin-symbol/utils.d.ts +1 -0
- package/cjs/graphic/builtin-symbol/utils.js +6 -3
- package/cjs/graphic/builtin-symbol/utils.js.map +1 -1
- package/cjs/graphic/builtin-symbol/wedge.js +2 -2
- package/cjs/graphic/builtin-symbol/wedge.js.map +1 -1
- package/cjs/graphic/builtin-symbol/wye.js +2 -2
- package/cjs/graphic/builtin-symbol/wye.js.map +1 -1
- package/cjs/graphic/config.js +2 -2
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/richtext/paragraph.js +3 -1
- package/cjs/graphic/richtext/paragraph.js.map +1 -1
- package/cjs/graphic/text.d.ts +11 -10
- package/cjs/graphic/text.js +174 -91
- package/cjs/graphic/text.js.map +1 -1
- package/cjs/graphic/wrap-text.js +4 -12
- package/cjs/graphic/wrap-text.js.map +1 -1
- package/cjs/interface/animate.d.ts +3 -1
- package/cjs/interface/animate.js.map +1 -1
- package/cjs/interface/context.d.ts +1 -0
- package/cjs/interface/context.js.map +1 -1
- package/cjs/interface/graphic/text.d.ts +3 -3
- package/cjs/interface/graphic/text.js.map +1 -1
- package/cjs/interface/graphic.d.ts +1 -0
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/interface/stage.d.ts +1 -0
- package/cjs/interface/stage.js.map +1 -1
- package/cjs/interface/text.d.ts +1 -6
- package/cjs/interface/text.js.map +1 -1
- package/cjs/render/contributions/render/contributions/arc-contribution-render.js +2 -2
- package/cjs/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/circle-contribution-render.js +2 -2
- package/cjs/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js +2 -2
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +2 -2
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/text-render.js +23 -1
- package/cjs/render/contributions/render/text-render.js.map +1 -1
- package/dist/index.es.js +524 -386
- package/es/animate/Ticker/default-ticker.d.ts +4 -2
- package/es/animate/Ticker/default-ticker.js +9 -6
- package/es/animate/Ticker/default-ticker.js.map +1 -1
- package/es/animate/custom-animate.d.ts +2 -0
- package/es/animate/custom-animate.js +11 -2
- package/es/animate/custom-animate.js.map +1 -1
- package/es/common/3d-interceptor.js +1 -2
- package/es/common/bounds-context.js +2 -1
- package/es/common/morphing-utils.js +1 -1
- package/es/common/path-svg.js +1 -1
- package/es/common/polygon.js +1 -1
- package/es/common/rect-utils.js +1 -1
- package/es/common/render-area.js +1 -1
- package/es/common/render-command-list.js +1 -2
- package/es/common/render-curve.js +1 -1
- package/es/common/render-utils.js +1 -1
- package/es/common/seg-context.js +1 -1
- package/es/common/simplify.js +1 -1
- package/es/common/sort.js +1 -1
- package/es/common/split-path.js +1 -1
- package/es/common/store.js +1 -1
- package/es/common/text.js.map +1 -1
- package/es/core/application.js +2 -1
- package/es/core/camera.js +1 -1
- package/es/core/constants.js +1 -1
- package/es/core/contributions/textMeasure/AtextMeasure.d.ts +4 -55
- package/es/core/contributions/textMeasure/AtextMeasure.js +13 -92
- package/es/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/es/core/contributions/textMeasure/layout.d.ts +1 -0
- package/es/core/contributions/textMeasure/layout.js +30 -20
- package/es/core/contributions/textMeasure/layout.js.map +1 -1
- package/es/core/core-modules.js +1 -1
- package/es/core/global-module.js +2 -0
- package/es/core/global.js +1 -1
- package/es/core/graphic-utils.js +1 -1
- package/es/core/index.js +1 -1
- package/es/core/layer-service.js +1 -1
- package/es/core/layer.js +1 -1
- package/es/core/light.js +1 -1
- package/es/core/stage.d.ts +2 -0
- package/es/core/stage.js +10 -6
- package/es/core/stage.js.map +1 -1
- package/es/core/window.js +1 -1
- package/es/graphic/builtin-symbol/arrow.js +2 -2
- package/es/graphic/builtin-symbol/arrow.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-down.js +2 -2
- package/es/graphic/builtin-symbol/arrow2-down.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-left.js +2 -2
- package/es/graphic/builtin-symbol/arrow2-left.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-right.js +2 -2
- package/es/graphic/builtin-symbol/arrow2-right.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-up.js +2 -2
- package/es/graphic/builtin-symbol/arrow2-up.js.map +1 -1
- package/es/graphic/builtin-symbol/base.d.ts +1 -0
- package/es/graphic/builtin-symbol/base.js +3 -0
- package/es/graphic/builtin-symbol/base.js.map +1 -1
- package/es/graphic/builtin-symbol/circle.js +3 -3
- package/es/graphic/builtin-symbol/circle.js.map +1 -1
- package/es/graphic/builtin-symbol/close.js +3 -3
- package/es/graphic/builtin-symbol/close.js.map +1 -1
- package/es/graphic/builtin-symbol/cross.js +2 -2
- package/es/graphic/builtin-symbol/cross.js.map +1 -1
- package/es/graphic/builtin-symbol/diamond.js +3 -3
- package/es/graphic/builtin-symbol/diamond.js.map +1 -1
- package/es/graphic/builtin-symbol/line-h.js +3 -3
- package/es/graphic/builtin-symbol/line-h.js.map +1 -1
- package/es/graphic/builtin-symbol/line-v.js +3 -3
- package/es/graphic/builtin-symbol/line-v.js.map +1 -1
- package/es/graphic/builtin-symbol/square.js +2 -2
- package/es/graphic/builtin-symbol/square.js.map +1 -1
- package/es/graphic/builtin-symbol/star.js +2 -2
- package/es/graphic/builtin-symbol/star.js.map +1 -1
- package/es/graphic/builtin-symbol/stroke.js +2 -2
- package/es/graphic/builtin-symbol/stroke.js.map +1 -1
- package/es/graphic/builtin-symbol/thin-triangle.js +2 -2
- package/es/graphic/builtin-symbol/thin-triangle.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-down.js +2 -2
- package/es/graphic/builtin-symbol/triangle-down.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-left.js +2 -2
- package/es/graphic/builtin-symbol/triangle-left.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-right.js +2 -2
- package/es/graphic/builtin-symbol/triangle-right.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-up.js +2 -2
- package/es/graphic/builtin-symbol/triangle-up.js.map +1 -1
- package/es/graphic/builtin-symbol/utils.d.ts +1 -0
- package/es/graphic/builtin-symbol/utils.js +7 -4
- package/es/graphic/builtin-symbol/utils.js.map +1 -1
- package/es/graphic/builtin-symbol/wedge.js +2 -2
- package/es/graphic/builtin-symbol/wedge.js.map +1 -1
- package/es/graphic/builtin-symbol/wye.js +2 -2
- package/es/graphic/builtin-symbol/wye.js.map +1 -1
- package/es/graphic/config.js +2 -2
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/richtext/paragraph.js +4 -2
- package/es/graphic/richtext/paragraph.js.map +1 -1
- package/es/graphic/text.d.ts +11 -10
- package/es/graphic/text.js +169 -90
- package/es/graphic/text.js.map +1 -1
- package/es/graphic/wrap-text.js +4 -12
- package/es/graphic/wrap-text.js.map +1 -1
- package/es/interface/animate.d.ts +3 -1
- package/es/interface/animate.js.map +1 -1
- package/es/interface/context.d.ts +1 -0
- package/es/interface/context.js.map +1 -1
- package/es/interface/graphic/text.d.ts +3 -3
- package/es/interface/graphic/text.js.map +1 -1
- package/es/interface/graphic.d.ts +1 -0
- package/es/interface/graphic.js.map +1 -1
- package/es/interface/stage.d.ts +1 -0
- package/es/interface/stage.js.map +1 -1
- package/es/interface/text.d.ts +1 -6
- package/es/interface/text.js.map +1 -1
- package/es/render/contributions/render/contributions/arc-contribution-render.js +2 -2
- package/es/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/circle-contribution-render.js +2 -2
- package/es/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/rect-contribution-render.js +2 -2
- package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/symbol-contribution-render.js +2 -2
- package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
- package/es/render/contributions/render/text-render.js +23 -1
- package/es/render/contributions/render/text-render.js.map +1 -1
- package/package.json +4 -3
- package/cjs/graphic/text2.d.ts +0 -81
- package/cjs/graphic/text2.js +0 -288
- package/cjs/graphic/text2.js.map +0 -1
- package/es/graphic/text2.d.ts +0 -81
- package/es/graphic/text2.js +0 -293
- package/es/graphic/text2.js.map +0 -1
package/es/graphic/text.js
CHANGED
|
@@ -16,7 +16,7 @@ import { TEXT_NUMBER_TYPE } from "./constants";
|
|
|
16
16
|
|
|
17
17
|
import { boundStroke, TextDirection, verticalLayout } from "./tools";
|
|
18
18
|
|
|
19
|
-
const TEXT_UPDATE_TAG_KEY = [ "text", "maxLineWidth", "
|
|
19
|
+
const TEXT_UPDATE_TAG_KEY = [ "text", "maxLineWidth", "textAlign", "textBaseline", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp", ...GRAPHIC_UPDATE_TAG_KEY ];
|
|
20
20
|
|
|
21
21
|
export class Text extends Graphic {
|
|
22
22
|
get font() {
|
|
@@ -25,17 +25,18 @@ export class Text extends Graphic {
|
|
|
25
25
|
}
|
|
26
26
|
get clipedText() {
|
|
27
27
|
var _a;
|
|
28
|
-
const attribute = this.attribute, textTheme = this.getGraphicTheme()
|
|
29
|
-
|
|
28
|
+
const attribute = this.attribute, textTheme = this.getGraphicTheme();
|
|
29
|
+
if (!this.isSimplify()) return;
|
|
30
|
+
const {maxLineWidth: maxLineWidth = textTheme.maxLineWidth} = attribute;
|
|
31
|
+
return Number.isFinite(maxLineWidth) ? (this.tryUpdateAABBBounds(), this.cache.clipedText) : (null !== (_a = attribute.text) && void 0 !== _a ? _a : textTheme.text).toString();
|
|
30
32
|
}
|
|
31
33
|
get clipedWidth() {
|
|
32
|
-
return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
|
|
34
|
+
if (this.isSimplify()) return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
|
|
33
35
|
}
|
|
34
36
|
get cliped() {
|
|
35
37
|
var _a, _b;
|
|
36
|
-
const textTheme = this.getGraphicTheme(), attribute = this.attribute,
|
|
37
|
-
if (!Number.isFinite(
|
|
38
|
-
const {text: text} = this.attribute;
|
|
38
|
+
const textTheme = this.getGraphicTheme(), attribute = this.attribute, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, text: text, whiteSpace: whiteSpace = textTheme.whiteSpace} = attribute;
|
|
39
|
+
if (!Number.isFinite(maxLineWidth)) return !1;
|
|
39
40
|
if (this.tryUpdateAABBBounds(), null === (_b = null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData) || void 0 === _b ? void 0 : _b.lines) {
|
|
40
41
|
let mergedText = "";
|
|
41
42
|
this.cache.layoutData.lines.forEach((item => {
|
|
@@ -46,7 +47,10 @@ export class Text extends Graphic {
|
|
|
46
47
|
return "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map((item => item.text)).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString();
|
|
47
48
|
}
|
|
48
49
|
get multilineLayout() {
|
|
49
|
-
return this.tryUpdateAABBBounds(), this.cache.layoutData;
|
|
50
|
+
if (this.isMultiLine) return this.tryUpdateAABBBounds(), this.cache.layoutData;
|
|
51
|
+
}
|
|
52
|
+
isSimplify() {
|
|
53
|
+
return !this.isMultiLine && "vertical" !== this.attribute.direction;
|
|
50
54
|
}
|
|
51
55
|
get isMultiLine() {
|
|
52
56
|
return Array.isArray(this.attribute.text) || "normal" === this.attribute.whiteSpace;
|
|
@@ -99,50 +103,19 @@ export class Text extends Graphic {
|
|
|
99
103
|
return application.graphicService.combindShadowAABBBounds(aabbBounds, this), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds),
|
|
100
104
|
transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix), aabbBounds;
|
|
101
105
|
}
|
|
102
|
-
updateSingallineAABBBounds(text) {
|
|
103
|
-
this.updateMultilineAABBBounds([ text ]);
|
|
104
|
-
const layoutData = this.cache.layoutData;
|
|
105
|
-
if (layoutData) {
|
|
106
|
-
const line = layoutData.lines[0];
|
|
107
|
-
this.cache.clipedText = line.str, this.cache.clipedWidth = line.width;
|
|
108
|
-
}
|
|
109
|
-
return this._AABBBounds;
|
|
110
|
-
}
|
|
111
|
-
updateMultilineAABBBounds(text) {
|
|
112
|
-
const textTheme = this.getGraphicTheme(), {direction: direction = textTheme.direction, underlineOffset: underlineOffset = textTheme.underlineOffset} = this.attribute, b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
|
|
113
|
-
return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset),
|
|
114
|
-
b;
|
|
115
|
-
}
|
|
116
|
-
updateHorizontalMultilineAABBBounds(text) {
|
|
117
|
-
var _a;
|
|
118
|
-
const textTheme = this.getGraphicTheme(), attribute = this.attribute, {fontFamily: fontFamily = textTheme.fontFamily, textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, ellipsis: ellipsis = textTheme.ellipsis, maxLineWidth: maxLineWidth, stroke: stroke = textTheme.stroke, wrap: wrap = textTheme.wrap, ignoreBuf: ignoreBuf = textTheme.ignoreBuf, lineWidth: lineWidth = textTheme.lineWidth, whiteSpace: whiteSpace = textTheme.whiteSpace, suffixPosition: suffixPosition = textTheme.suffixPosition} = attribute, buf = ignoreBuf ? 0 : 2, lineHeight = this.getLineHeight(attribute, textTheme) + buf;
|
|
119
|
-
if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
|
|
120
|
-
if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
|
|
121
|
-
const bbox = this.cache.layoutData.bbox;
|
|
122
|
-
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height),
|
|
123
|
-
stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
124
|
-
}
|
|
125
|
-
const textMeasure = application.graphicUtil.textMeasure, layoutData = new CanvasTextLayout(fontFamily, {
|
|
126
|
-
fontSize: fontSize,
|
|
127
|
-
fontWeight: fontWeight,
|
|
128
|
-
fontFamily: fontFamily
|
|
129
|
-
}, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth, suffixPosition), {bbox: bbox} = layoutData;
|
|
130
|
-
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height),
|
|
131
|
-
stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
132
|
-
}
|
|
133
106
|
updateWrapAABBBounds(text) {
|
|
134
|
-
var _a, _b, _c;
|
|
135
|
-
const textTheme = this.getGraphicTheme(), {fontFamily: fontFamily = textTheme.fontFamily, textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline, fontSize: fontSize = textTheme.fontSize, ellipsis: ellipsis = textTheme.ellipsis, maxLineWidth: maxLineWidth, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, wordBreak: wordBreak = textTheme.wordBreak, fontWeight: fontWeight = textTheme.fontWeight, ignoreBuf: ignoreBuf = textTheme.ignoreBuf, suffixPosition: suffixPosition = textTheme.suffixPosition, heightLimit: heightLimit = 0, lineClamp: lineClamp} = this.attribute,
|
|
136
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
107
|
+
var _a, _b, _c, _d;
|
|
108
|
+
const textTheme = this.getGraphicTheme(), {fontFamily: fontFamily = textTheme.fontFamily, textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline, fontSize: fontSize = textTheme.fontSize, ellipsis: ellipsis = textTheme.ellipsis, maxLineWidth: maxLineWidth, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, wordBreak: wordBreak = textTheme.wordBreak, fontWeight: fontWeight = textTheme.fontWeight, ignoreBuf: ignoreBuf = textTheme.ignoreBuf, suffixPosition: suffixPosition = textTheme.suffixPosition, heightLimit: heightLimit = 0, lineClamp: lineClamp} = this.attribute, lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize, buf = ignoreBuf ? 0 : 2;
|
|
109
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
137
110
|
const bbox = this.cache.layoutData.bbox;
|
|
138
111
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height),
|
|
139
112
|
stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
140
113
|
}
|
|
141
|
-
const textMeasure = application.graphicUtil.textMeasure,
|
|
114
|
+
const textMeasure = application.graphicUtil.textMeasure, layoutObj = new CanvasTextLayout(fontFamily, {
|
|
142
115
|
fontSize: fontSize,
|
|
143
116
|
fontWeight: fontWeight,
|
|
144
117
|
fontFamily: fontFamily
|
|
145
|
-
},
|
|
118
|
+
}, textMeasure), lines = isArray(text) ? text.map((l => l.toString())) : [ text.toString() ], linesLayout = [], bboxWH = [ 0, 0 ];
|
|
146
119
|
let lineCountLimit = 1 / 0;
|
|
147
120
|
if (heightLimit > 0 && (lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1)),
|
|
148
121
|
lineClamp && (lineCountLimit = Math.min(lineCountLimit, lineClamp)), "number" == typeof maxLineWidth && maxLineWidth !== 1 / 0) {
|
|
@@ -150,32 +123,30 @@ export class Text extends Graphic {
|
|
|
150
123
|
const str = lines[i];
|
|
151
124
|
let needCut = !0;
|
|
152
125
|
if (i === lineCountLimit - 1) {
|
|
153
|
-
const clip = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1)
|
|
126
|
+
const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1);
|
|
154
127
|
linesLayout.push({
|
|
155
128
|
str: clip.str,
|
|
156
|
-
width: clip.width
|
|
157
|
-
ascent: matrics.ascent,
|
|
158
|
-
descent: matrics.descent
|
|
129
|
+
width: clip.width
|
|
159
130
|
});
|
|
160
131
|
break;
|
|
161
132
|
}
|
|
162
|
-
const clip = textMeasure.clipText(str, textOptions, maxLineWidth, "break-
|
|
163
|
-
if ("" !== str && "" === clip.str) {
|
|
133
|
+
const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
|
|
134
|
+
if ("" !== str && "" === clip.str || clip.wordBreaked) {
|
|
164
135
|
if (ellipsis) {
|
|
165
|
-
const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
166
|
-
clip.str = null !== (
|
|
136
|
+
const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
137
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
167
138
|
} else clip.str = "", clip.width = 0;
|
|
168
139
|
needCut = !1;
|
|
169
140
|
}
|
|
170
|
-
|
|
171
|
-
if (linesLayout.push({
|
|
141
|
+
linesLayout.push({
|
|
172
142
|
str: clip.str,
|
|
173
|
-
width: clip.width
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
143
|
+
width: clip.width
|
|
144
|
+
});
|
|
145
|
+
let cutLength = clip.str.length;
|
|
146
|
+
if (!clip.wordBreaked || "" !== str && "" === clip.str || (needCut = !0, cutLength = clip.wordBreaked),
|
|
147
|
+
clip.str.length === str.length) ; else if (needCut) {
|
|
148
|
+
let newStr = str.substring(cutLength);
|
|
149
|
+
"keep-all" === wordBreak && (newStr = newStr.replace(/^\s+/g, "")), lines.splice(i + 1, 0, newStr);
|
|
179
150
|
}
|
|
180
151
|
}
|
|
181
152
|
let maxWidth = 0;
|
|
@@ -186,27 +157,22 @@ export class Text extends Graphic {
|
|
|
186
157
|
let width, text, lineWidth = 0;
|
|
187
158
|
for (let i = 0, len = lines.length; i < len; i++) {
|
|
188
159
|
if (i === lineCountLimit - 1) {
|
|
189
|
-
const clip = textMeasure.clipTextWithSuffix(lines[i], textOptions, maxLineWidth, ellipsis, !1, suffixPosition)
|
|
160
|
+
const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
190
161
|
linesLayout.push({
|
|
191
162
|
str: clip.str,
|
|
192
|
-
width: clip.width
|
|
193
|
-
ascent: matrics.ascent,
|
|
194
|
-
descent: matrics.descent
|
|
163
|
+
width: clip.width
|
|
195
164
|
}), lineWidth = Math.max(lineWidth, clip.width);
|
|
196
165
|
break;
|
|
197
166
|
}
|
|
198
|
-
text = lines[i], width = textMeasure.measureTextWidth(text, textOptions
|
|
199
|
-
|
|
200
|
-
linesLayout.push({
|
|
167
|
+
text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak),
|
|
168
|
+
lineWidth = Math.max(lineWidth, width), linesLayout.push({
|
|
201
169
|
str: text,
|
|
202
|
-
width: width
|
|
203
|
-
ascent: matrics.ascent,
|
|
204
|
-
descent: matrics.descent
|
|
170
|
+
width: width
|
|
205
171
|
});
|
|
206
172
|
}
|
|
207
173
|
bboxWH[0] = lineWidth;
|
|
208
174
|
}
|
|
209
|
-
bboxWH[1] = linesLayout.length * lineHeight;
|
|
175
|
+
bboxWH[1] = linesLayout.length * (lineHeight + buf);
|
|
210
176
|
const bbox = {
|
|
211
177
|
xOffset: 0,
|
|
212
178
|
yOffset: 0,
|
|
@@ -218,16 +184,144 @@ export class Text extends Graphic {
|
|
|
218
184
|
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height),
|
|
219
185
|
stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
220
186
|
}
|
|
221
|
-
|
|
187
|
+
updateSingallineAABBBounds(text) {
|
|
188
|
+
const textTheme = this.getGraphicTheme(), {direction: direction = textTheme.direction, underlineOffset: underlineOffset = textTheme.underlineOffset} = this.attribute, b = "horizontal" === direction ? this.updateHorizontalSinglelineAABBBounds(text) : this.updateVerticalSinglelineAABBBounds(text);
|
|
189
|
+
return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset),
|
|
190
|
+
b;
|
|
191
|
+
}
|
|
192
|
+
updateMultilineAABBBounds(text) {
|
|
193
|
+
const textTheme = this.getGraphicTheme(), {direction: direction = textTheme.direction, underlineOffset: underlineOffset = textTheme.underlineOffset} = this.attribute, b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
|
|
194
|
+
return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset),
|
|
195
|
+
b;
|
|
196
|
+
}
|
|
197
|
+
updateHorizontalSinglelineAABBBounds(text) {
|
|
198
|
+
var _a, _b;
|
|
199
|
+
const textTheme = this.getGraphicTheme(), {wrap: wrap = textTheme.wrap} = this.attribute;
|
|
200
|
+
if (wrap) return this.updateWrapAABBBounds([ text ]);
|
|
201
|
+
const textMeasure = application.graphicUtil.textMeasure;
|
|
202
|
+
let width, str;
|
|
203
|
+
const attribute = this.attribute, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis, textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline, fontFamily: fontFamily = textTheme.fontFamily, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, ignoreBuf: ignoreBuf = textTheme.ignoreBuf, whiteSpace: whiteSpace = textTheme.whiteSpace, suffixPosition: suffixPosition = textTheme.suffixPosition} = attribute;
|
|
204
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
205
|
+
const buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize), textFontSize = attribute.fontSize || textTheme.fontSize, lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
|
|
206
|
+
if (!this.shouldUpdateShape() && this.cache) {
|
|
207
|
+
width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
|
|
208
|
+
const dx = textDrawOffsetX(textAlign, width), dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
|
|
209
|
+
return this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight), stroke && this._AABBBounds.expand(lineWidth / 2),
|
|
210
|
+
this._AABBBounds;
|
|
211
|
+
}
|
|
212
|
+
if (Number.isFinite(maxLineWidth)) {
|
|
213
|
+
if (ellipsis) {
|
|
214
|
+
const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis, data = textMeasure.clipTextWithSuffix(text.toString(), {
|
|
215
|
+
fontSize: fontSize,
|
|
216
|
+
fontWeight: fontWeight,
|
|
217
|
+
fontFamily: fontFamily
|
|
218
|
+
}, maxLineWidth, strEllipsis, !1, suffixPosition);
|
|
219
|
+
str = data.str, width = data.width;
|
|
220
|
+
} else {
|
|
221
|
+
const data = textMeasure.clipText(text.toString(), {
|
|
222
|
+
fontSize: fontSize,
|
|
223
|
+
fontWeight: fontWeight,
|
|
224
|
+
fontFamily: fontFamily
|
|
225
|
+
}, maxLineWidth, !1);
|
|
226
|
+
str = data.str, width = data.width;
|
|
227
|
+
}
|
|
228
|
+
this.cache.clipedText = str, this.cache.clipedWidth = width;
|
|
229
|
+
} else width = textMeasure.measureTextWidth(text.toString(), {
|
|
230
|
+
fontSize: fontSize,
|
|
231
|
+
fontWeight: fontWeight,
|
|
232
|
+
fontFamily: fontFamily
|
|
233
|
+
}), this.cache.clipedText = text.toString(), this.cache.clipedWidth = width;
|
|
234
|
+
this.clearUpdateShapeTag();
|
|
235
|
+
const dx = textDrawOffsetX(textAlign, width);
|
|
236
|
+
let lh = lineHeight;
|
|
237
|
+
application.global && application.global.isSafari() && (lh += .2 * fontSize);
|
|
238
|
+
const dy = textLayoutOffsetY(textBaseline, lh, fontSize, buf);
|
|
239
|
+
return this._AABBBounds.set(dx, dy, dx + width, dy + lh), stroke && this._AABBBounds.expand(lineWidth / 2),
|
|
240
|
+
this._AABBBounds;
|
|
241
|
+
}
|
|
242
|
+
getBaselineMapAlign() {
|
|
243
|
+
return Text.baselineMapAlign;
|
|
244
|
+
}
|
|
245
|
+
getAlignMapBaseline() {
|
|
246
|
+
return Text.alignMapBaseline;
|
|
247
|
+
}
|
|
248
|
+
updateVerticalSinglelineAABBBounds(text) {
|
|
249
|
+
var _a, _b, _c;
|
|
250
|
+
const textTheme = this.getGraphicTheme(), textMeasure = application.graphicUtil.textMeasure;
|
|
251
|
+
let width;
|
|
252
|
+
const attribute = this.attribute, {ignoreBuf: ignoreBuf = textTheme.ignoreBuf} = attribute, buf = ignoreBuf ? 0 : 2, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, fontFamily: fontFamily = textTheme.fontFamily, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, verticalMode: verticalMode = textTheme.verticalMode, suffixPosition: suffixPosition = textTheme.suffixPosition} = attribute, lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
253
|
+
let {textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline} = attribute;
|
|
254
|
+
if (!verticalMode) {
|
|
255
|
+
const t = textAlign;
|
|
256
|
+
textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left",
|
|
257
|
+
textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
|
|
258
|
+
}
|
|
259
|
+
if (!this.shouldUpdateShape() && this.cache) {
|
|
260
|
+
width = this.cache.clipedWidth;
|
|
261
|
+
const dx = textDrawOffsetX(textAlign, width), dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
|
|
262
|
+
return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2),
|
|
263
|
+
this._AABBBounds;
|
|
264
|
+
}
|
|
265
|
+
let verticalList = [ verticalLayout(text.toString()) ];
|
|
266
|
+
if (Number.isFinite(maxLineWidth)) {
|
|
267
|
+
if (ellipsis) {
|
|
268
|
+
const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis, data = textMeasure.clipTextWithSuffixVertical(verticalList[0], {
|
|
269
|
+
fontSize: fontSize,
|
|
270
|
+
fontWeight: fontWeight,
|
|
271
|
+
fontFamily: fontFamily
|
|
272
|
+
}, maxLineWidth, strEllipsis, !1, suffixPosition);
|
|
273
|
+
verticalList = [ data.verticalList ], width = data.width;
|
|
274
|
+
} else {
|
|
275
|
+
const data = textMeasure.clipTextVertical(verticalList[0], {
|
|
276
|
+
fontSize: fontSize,
|
|
277
|
+
fontWeight: fontWeight,
|
|
278
|
+
fontFamily: fontFamily
|
|
279
|
+
}, maxLineWidth, !1);
|
|
280
|
+
verticalList = [ data.verticalList ], width = data.width;
|
|
281
|
+
}
|
|
282
|
+
this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
|
|
283
|
+
} else width = 0, verticalList[0].forEach((t => {
|
|
284
|
+
const w = t.direction === TextDirection.HORIZONTAL ? fontSize : textMeasure.measureTextWidth(t.text, {
|
|
285
|
+
fontSize: fontSize,
|
|
286
|
+
fontWeight: fontWeight,
|
|
287
|
+
fontFamily: fontFamily
|
|
288
|
+
});
|
|
289
|
+
width += w, t.width = w;
|
|
290
|
+
})), this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
|
|
291
|
+
this.clearUpdateShapeTag();
|
|
292
|
+
const dx = textDrawOffsetX(textAlign, width), dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
|
|
293
|
+
return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2),
|
|
294
|
+
this._AABBBounds;
|
|
295
|
+
}
|
|
296
|
+
updateHorizontalMultilineAABBBounds(text) {
|
|
222
297
|
var _a, _b;
|
|
298
|
+
const textTheme = this.getGraphicTheme(), {wrap: wrap = textTheme.wrap} = this.attribute;
|
|
299
|
+
if (wrap) return this.updateWrapAABBBounds(text);
|
|
300
|
+
const attribute = this.attribute, {fontFamily: fontFamily = textTheme.fontFamily, textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, ellipsis: ellipsis = textTheme.ellipsis, maxLineWidth: maxLineWidth, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, whiteSpace: whiteSpace = textTheme.whiteSpace, suffixPosition: suffixPosition = textTheme.suffixPosition} = attribute, lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
|
|
301
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
302
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
303
|
+
const bbox = this.cache.layoutData.bbox;
|
|
304
|
+
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height),
|
|
305
|
+
stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
306
|
+
}
|
|
307
|
+
const textMeasure = application.graphicUtil.textMeasure, layoutData = new CanvasTextLayout(fontFamily, {
|
|
308
|
+
fontSize: fontSize,
|
|
309
|
+
fontWeight: fontWeight,
|
|
310
|
+
fontFamily: fontFamily
|
|
311
|
+
}, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth, suffixPosition), {bbox: bbox} = layoutData;
|
|
312
|
+
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height),
|
|
313
|
+
stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
314
|
+
}
|
|
315
|
+
updateVerticalMultilineAABBBounds(text) {
|
|
316
|
+
var _a, _b, _c;
|
|
223
317
|
const textTheme = this.getGraphicTheme(), textMeasure = application.graphicUtil.textMeasure;
|
|
224
318
|
let width;
|
|
225
|
-
const attribute = this.attribute, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis, fontFamily: fontFamily = textTheme.fontFamily, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, verticalMode: verticalMode = textTheme.verticalMode, suffixPosition: suffixPosition = textTheme.suffixPosition} = attribute, lineHeight =
|
|
319
|
+
const attribute = this.attribute, {ignoreBuf: ignoreBuf = textTheme.ignoreBuf} = attribute, buf = ignoreBuf ? 0 : 2, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis, fontFamily: fontFamily = textTheme.fontFamily, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, verticalMode: verticalMode = textTheme.verticalMode, suffixPosition: suffixPosition = textTheme.suffixPosition} = attribute, lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
226
320
|
let {textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline} = attribute;
|
|
227
321
|
if (!verticalMode) {
|
|
228
322
|
const t = textAlign;
|
|
229
|
-
textAlign = null !== (
|
|
230
|
-
textBaseline = null !== (
|
|
323
|
+
textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left",
|
|
324
|
+
textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
|
|
231
325
|
}
|
|
232
326
|
if (width = 0, !this.shouldUpdateShape() && this.cache) {
|
|
233
327
|
this.cache.verticalList.forEach((item => {
|
|
@@ -270,15 +364,6 @@ export class Text extends Graphic {
|
|
|
270
364
|
return this._AABBBounds.set(dy, dx, dy + height, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2),
|
|
271
365
|
this._AABBBounds;
|
|
272
366
|
}
|
|
273
|
-
getMaxWidth(theme) {
|
|
274
|
-
var _a, _b;
|
|
275
|
-
const attribute = this.attribute;
|
|
276
|
-
return null !== (_b = null !== (_a = attribute.maxLineWidth) && void 0 !== _a ? _a : attribute.maxWidth) && void 0 !== _b ? _b : theme.maxWidth;
|
|
277
|
-
}
|
|
278
|
-
getLineHeight(attribute, textTheme) {
|
|
279
|
-
var _a;
|
|
280
|
-
return null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
|
|
281
|
-
}
|
|
282
367
|
needUpdateTags(keys, k = TEXT_UPDATE_TAG_KEY) {
|
|
283
368
|
return super.needUpdateTags(keys, k);
|
|
284
369
|
}
|
|
@@ -291,12 +376,6 @@ export class Text extends Graphic {
|
|
|
291
376
|
getNoWorkAnimateAttr() {
|
|
292
377
|
return Text.NOWORK_ANIMATE_ATTR;
|
|
293
378
|
}
|
|
294
|
-
getBaselineMapAlign() {
|
|
295
|
-
return Text.baselineMapAlign;
|
|
296
|
-
}
|
|
297
|
-
getAlignMapBaseline() {
|
|
298
|
-
return Text.alignMapBaseline;
|
|
299
|
-
}
|
|
300
379
|
}
|
|
301
380
|
|
|
302
381
|
Text.NOWORK_ANIMATE_ATTR = Object.assign({
|
package/es/graphic/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,WAAW,EA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,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;AAC9B,CAAC","file":"text.js","sourcesContent":["import type { IAABBBounds, IOBBBounds } from '@visactor/vutils';\nimport { max, isArray, getContextFont, transformBoundsWithMatrix, rotatePoint } from '@visactor/vutils';\nimport { textDrawOffsetX, textLayoutOffsetY } from '../common/text';\nimport { CanvasTextLayout } from '../core/contributions/textMeasure/layout';\nimport { application } from '../application';\nimport type { IText, ITextCache, ITextGraphicAttribute, LayoutItemType, LayoutType } from '../interface';\nimport { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from './graphic';\nimport { getTheme } from './theme';\nimport { calculateLineHeight } from '../common/utils';\nimport { TEXT_NUMBER_TYPE } from './constants';\nimport { boundStroke, TextDirection, verticalLayout } from './tools';\n\nconst TEXT_UPDATE_TAG_KEY = [\n 'text',\n 'maxLineWidth',\n 'maxWidth',\n // 多行文本要用到\n 'textAlign',\n 'textBaseline',\n 'heightLimit',\n 'lineClamp',\n 'fontSize',\n 'fontFamily',\n 'fontWeight',\n 'ellipsis',\n 'lineHeight',\n 'direction',\n 'wordBreak',\n 'heightLimit',\n 'lineClamp',\n ...GRAPHIC_UPDATE_TAG_KEY\n];\n\nexport class Text extends Graphic<ITextGraphicAttribute> implements IText {\n type: 'text' = 'text';\n\n static NOWORK_ANIMATE_ATTR = {\n ellipsis: 1,\n wordBreak: 1,\n direction: 1,\n textAlign: 1,\n textBaseline: 1,\n fontFamily: 1,\n fontWeight: 1,\n ...NOWORK_ANIMATE_ATTR\n };\n\n cache: ITextCache;\n _font: string;\n\n protected declare obbText?: Text;\n\n /**\n * 获取font字符串\n */\n get font(): string {\n const textTheme = this.getGraphicTheme();\n if (!this._font) {\n this._font = getContextFont(this.attribute, textTheme);\n }\n return this._font as string;\n }\n\n get clipedText(): string | undefined {\n const attribute = this.attribute;\n const textTheme = this.getGraphicTheme();\n const maxWidth = this.getMaxWidth(textTheme);\n if (!Number.isFinite(maxWidth)) {\n return (attribute.text ?? textTheme.text).toString();\n }\n this.tryUpdateAABBBounds();\n return this.cache.clipedText;\n }\n\n get clipedWidth(): number | undefined {\n this.tryUpdateAABBBounds();\n return this.cache.clipedWidth;\n }\n\n /**\n * 支持单行文本,横排纵排均支持\n * TODO 支持多行文本\n */\n get cliped(): boolean | undefined {\n const textTheme = this.getGraphicTheme();\n const attribute = this.attribute;\n const maxWidth = this.getMaxWidth(textTheme);\n if (!Number.isFinite(maxWidth)) {\n return false;\n }\n const { text } = this.attribute;\n this.tryUpdateAABBBounds();\n if (this.cache?.layoutData?.lines) {\n let mergedText = '';\n this.cache.layoutData.lines.forEach(item => {\n mergedText += item.str;\n });\n const originText = Array.isArray(text) ? text.join('') : text;\n\n return originText !== mergedText;\n }\n if (attribute.direction === 'vertical' && this.cache.verticalList && this.cache.verticalList[0]) {\n return this.cache.verticalList[0].map(item => item.text).join('') !== attribute.text.toString();\n }\n if (this.clipedText == null) {\n return false;\n }\n return this.clipedText !== attribute.text.toString();\n }\n\n get multilineLayout(): LayoutType | undefined {\n this.tryUpdateAABBBounds();\n return this.cache.layoutData;\n }\n /**\n * 是否是多行文本\n */\n get isMultiLine(): boolean {\n return Array.isArray(this.attribute.text) || this.attribute.whiteSpace === 'normal';\n }\n\n constructor(params: ITextGraphicAttribute = { text: '', fontSize: 16 }) {\n super(params);\n this.numberType = TEXT_NUMBER_TYPE;\n this.cache = {};\n }\n\n /**\n * 图元属性合法,且文字不为空或者null/undefined\n * @returns\n */\n isValid(): boolean {\n return super.isValid() && this._isValid();\n }\n\n protected _isValid(): boolean {\n const { text } = this.attribute;\n if (isArray(text)) {\n return !(text as any[]).every((t: any) => t == null || t === '');\n }\n return text != null && text !== '';\n }\n\n getGraphicTheme(): Required<ITextGraphicAttribute> {\n return getTheme(this).text;\n }\n\n protected doUpdateOBBBounds(): IOBBBounds {\n const graphicTheme = this.getGraphicTheme();\n this._OBBBounds.clear();\n const attribute = this.attribute;\n const { angle = graphicTheme.angle } = attribute;\n if (!angle) {\n const b = this.AABBBounds;\n this._OBBBounds.setValue(b.x1, b.y1, b.x2, b.y2);\n return this._OBBBounds;\n }\n if (!this.obbText) {\n this.obbText = new Text({});\n }\n this.obbText.setAttributes({ ...attribute, angle: 0 });\n const bounds1 = this.obbText.AABBBounds;\n const { x, y } = attribute;\n const boundsCenter = { x: (bounds1.x1 + bounds1.x2) / 2, y: (bounds1.y1 + bounds1.y2) / 2 };\n const center = rotatePoint(boundsCenter, angle, { x, y });\n this._OBBBounds.copy(bounds1);\n this._OBBBounds.translate(center.x - boundsCenter.x, center.y - boundsCenter.y);\n this._OBBBounds.angle = angle;\n return this._OBBBounds;\n }\n\n protected updateAABBBounds(\n attribute: ITextGraphicAttribute,\n textTheme: Required<ITextGraphicAttribute>,\n aabbBounds: IAABBBounds\n ) {\n const { text = textTheme.text } = this.attribute;\n if (Array.isArray(text)) {\n this.updateMultilineAABBBounds(text as (number | string)[]);\n } else {\n this.updateSingallineAABBBounds(text as number | string);\n }\n\n const { tb1 } = application.graphicService.updateTempAABBBounds(aabbBounds);\n\n const {\n scaleX = textTheme.scaleX,\n scaleY = textTheme.scaleY,\n shadowBlur = textTheme.shadowBlur,\n strokeBoundsBuffer = textTheme.strokeBoundsBuffer\n } = attribute;\n if (shadowBlur) {\n const shadowBlurHalfWidth = shadowBlur / Math.abs(scaleX + scaleY);\n boundStroke(tb1, shadowBlurHalfWidth, true, strokeBoundsBuffer);\n aabbBounds.union(tb1);\n }\n // 合并shadowRoot的bounds\n application.graphicService.combindShadowAABBBounds(aabbBounds, this);\n\n if (attribute.forceBoundsHeight != null || attribute.forceBoundsWidth != null) {\n application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds);\n }\n\n transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix);\n return aabbBounds;\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateSingallineAABBBounds(text: number | string): IAABBBounds {\n this.updateMultilineAABBBounds([text]);\n const layoutData = this.cache.layoutData;\n if (layoutData) {\n const line = layoutData.lines[0];\n this.cache.clipedText = line.str;\n this.cache.clipedWidth = line.width;\n }\n return this._AABBBounds;\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n protected updateMultilineAABBBounds(text: (number | string)[]): IAABBBounds {\n const textTheme = this.getGraphicTheme();\n const { direction = textTheme.direction, underlineOffset = textTheme.underlineOffset } = this.attribute;\n\n const b =\n direction === 'horizontal'\n ? this.updateHorizontalMultilineAABBBounds(text)\n : this.updateVerticalMultilineAABBBounds(text);\n\n if (direction === 'horizontal') {\n if (underlineOffset) {\n this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset);\n }\n }\n return b;\n }\n\n /**\n * 计算多行文字的bounds,缓存每行文字的布局位置\n * @param text\n */\n updateHorizontalMultilineAABBBounds(text: (number | string)[]): IAABBBounds {\n const textTheme = this.getGraphicTheme();\n\n const attribute = this.attribute;\n const {\n fontFamily = textTheme.fontFamily,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n ellipsis = textTheme.ellipsis,\n maxLineWidth,\n stroke = textTheme.stroke,\n wrap = textTheme.wrap,\n ignoreBuf = textTheme.ignoreBuf,\n lineWidth = textTheme.lineWidth,\n whiteSpace = textTheme.whiteSpace,\n suffixPosition = textTheme.suffixPosition\n } = attribute;\n\n const buf = ignoreBuf ? 0 : 2;\n const lineHeight = this.getLineHeight(attribute, textTheme) + buf;\n\n if (whiteSpace === 'normal' || wrap) {\n return this.updateWrapAABBBounds(text);\n }\n if (!this.shouldUpdateShape() && this.cache?.layoutData) {\n const bbox = this.cache.layoutData.bbox;\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n const textMeasure = application.graphicUtil.textMeasure;\n const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure);\n const layoutData = layoutObj.GetLayoutByLines(\n text,\n textAlign,\n textBaseline as any,\n lineHeight,\n ellipsis === true ? (textTheme.ellipsis as string) : ellipsis || undefined,\n false,\n maxLineWidth,\n suffixPosition\n );\n const { bbox } = layoutData;\n this.cache.layoutData = layoutData;\n this.clearUpdateShapeTag();\n\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算多行文字的bounds,缓存每行文字的布局位置\n * 自动折行params.text是数组,因此只重新updateMultilineAABBBounds\n * @param text\n */\n updateWrapAABBBounds(text: (number | string) | (number | string)[]) {\n const textTheme = this.getGraphicTheme();\n const {\n fontFamily = textTheme.fontFamily,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontSize = textTheme.fontSize,\n ellipsis = textTheme.ellipsis,\n maxLineWidth,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n wordBreak = textTheme.wordBreak,\n fontWeight = textTheme.fontWeight,\n // widthLimit,\n ignoreBuf = textTheme.ignoreBuf,\n suffixPosition = textTheme.suffixPosition,\n heightLimit = 0,\n lineClamp\n } = this.attribute;\n\n const buf = ignoreBuf ? 0 : 2;\n const lineHeight = this.getLineHeight(this.attribute, textTheme) + buf;\n\n if (!this.shouldUpdateShape() && this.cache?.layoutData) {\n const bbox = this.cache.layoutData.bbox;\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n const textMeasure = application.graphicUtil.textMeasure;\n const textOptions = { fontSize, fontWeight, fontFamily };\n const layoutObj = new CanvasTextLayout(fontFamily, textOptions, textMeasure as any);\n\n // layoutObj内逻辑\n const lines = isArray(text) ? (text.map(l => l.toString()) as string[]) : [text.toString()];\n const linesLayout: LayoutItemType[] = [];\n const bboxWH: [number, number] = [0, 0];\n\n let lineCountLimit = Infinity;\n if (heightLimit > 0) {\n lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1);\n }\n if (lineClamp) {\n // 处理行数限制\n lineCountLimit = Math.min(lineCountLimit, lineClamp);\n }\n\n if (typeof maxLineWidth === 'number' && maxLineWidth !== Infinity) {\n // widthLimit > 0\n if (maxLineWidth > 0) {\n for (let i = 0; i < lines.length; i++) {\n const str = lines[i] as string;\n let needCut = true;\n\n // 判断是否超过高度限制\n if (i === lineCountLimit - 1) {\n // 当前行为最后一行,如果后面还有行,需要显示省略号\n const clip = textMeasure.clipTextWithSuffix(\n str,\n textOptions,\n maxLineWidth,\n ellipsis,\n false,\n suffixPosition,\n i !== lines.length - 1\n );\n const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);\n linesLayout.push({\n str: clip.str,\n width: clip.width,\n ascent: matrics.ascent,\n descent: matrics.descent\n });\n break; // 不处理后续行\n }\n\n // 测量截断位置\n const clip = textMeasure.clipText(str, textOptions, maxLineWidth, wordBreak === 'break-word');\n if (str !== '' && clip.str === '') {\n if (ellipsis) {\n const clipEllipsis = textMeasure.clipTextWithSuffix(\n str,\n textOptions,\n maxLineWidth,\n ellipsis,\n false,\n suffixPosition\n );\n clip.str = clipEllipsis.str ?? '';\n clip.width = clipEllipsis.width ?? 0;\n } else {\n // 宽度限制不足一个字符,不显示\n clip.str = '';\n clip.width = 0;\n }\n needCut = false;\n }\n const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);\n linesLayout.push({\n str: clip.str,\n width: clip.width,\n ascent: matrics.ascent,\n descent: matrics.descent\n });\n if (clip.str.length === str.length) {\n // 不需要截断\n } else if (needCut) {\n const newStr = str.substring(clip.str.length);\n lines.splice(i + 1, 0, newStr);\n }\n }\n }\n // bboxWH[0] = maxLineWidth;\n let maxWidth = 0;\n linesLayout.forEach(layout => {\n maxWidth = Math.max(maxWidth, layout.width);\n });\n bboxWH[0] = maxWidth;\n } else {\n // 使用所有行中最长的作为lineWidth\n let lineWidth = 0;\n let width: number;\n let text: string;\n for (let i = 0, len = lines.length; i < len; i++) {\n // 判断是否超过高度限制\n if (i === lineCountLimit - 1) {\n // 当前行为最后一行\n const clip = textMeasure.clipTextWithSuffix(\n lines[i],\n textOptions,\n maxLineWidth,\n ellipsis,\n false,\n suffixPosition\n );\n const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);\n linesLayout.push({\n str: clip.str,\n width: clip.width,\n ascent: matrics.ascent,\n descent: matrics.descent\n });\n lineWidth = Math.max(lineWidth, clip.width);\n break; // 不处理后续行\n }\n\n text = lines[i] as string;\n width = textMeasure.measureTextWidth(text, textOptions);\n lineWidth = Math.max(lineWidth, width);\n const matrics = textMeasure.measureTextPixelADscentAndWidth(text, textOptions);\n linesLayout.push({ str: text, width, ascent: matrics.ascent, descent: matrics.descent });\n }\n bboxWH[0] = lineWidth;\n }\n bboxWH[1] = linesLayout.length * lineHeight;\n\n const bbox = {\n xOffset: 0,\n yOffset: 0,\n width: bboxWH[0],\n height: bboxWH[1]\n };\n\n layoutObj.LayoutBBox(bbox, textAlign, textBaseline as any);\n\n const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline as any, lineHeight);\n\n this.cache.layoutData = layoutData;\n this.clearUpdateShapeTag();\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算垂直布局的多行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateVerticalMultilineAABBBounds(text: (number | string)[]): IAABBBounds {\n const textTheme = this.getGraphicTheme();\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n const attribute = this.attribute;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n fontFamily = textTheme.fontFamily,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n // wordBreak = textTheme.wordBreak,\n verticalMode = textTheme.verticalMode,\n suffixPosition = textTheme.suffixPosition\n } = attribute;\n\n const lineHeight = this.getLineHeight(attribute, textTheme);\n\n let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;\n if (!verticalMode) {\n const t = textAlign;\n textAlign = (Text.baselineMapAlign as any)[textBaseline] ?? 'left';\n textBaseline = (Text.alignMapBaseline as any)[t] ?? 'top';\n }\n width = 0;\n if (!this.shouldUpdateShape() && this.cache) {\n this.cache.verticalList.forEach(item => {\n const w = item.reduce((a, b) => a + b.width, 0);\n width = max(w, width);\n });\n const dx = textDrawOffsetX(textAlign, width);\n const height = this.cache.verticalList.length * lineHeight;\n const dy = textLayoutOffsetY(textBaseline, height, fontSize);\n this._AABBBounds.set(dy, dx, dy + height, dx + width);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n const verticalLists: { text: string; width?: number; direction: TextDirection }[][] = text.map(str => {\n return verticalLayout(str.toString());\n });\n verticalLists.forEach((verticalData, i) => {\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffixVertical(\n verticalData,\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false,\n suffixPosition\n );\n verticalLists[i] = data.verticalList;\n width = data.width;\n } else {\n const data = textMeasure.clipTextVertical(\n verticalData,\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n false\n );\n verticalLists[i] = data.verticalList;\n width = data.width;\n }\n // this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = 0;\n verticalData.forEach(t => {\n const w =\n t.direction === TextDirection.HORIZONTAL\n ? fontSize\n : textMeasure.measureTextWidth(t.text, { fontSize, fontWeight, fontFamily });\n\n width += w;\n t.width = w;\n });\n }\n });\n this.cache.verticalList = verticalLists;\n this.clearUpdateShapeTag();\n\n this.cache.verticalList.forEach(item => {\n const w = item.reduce((a, b) => a + b.width, 0);\n width = max(w, width);\n });\n\n const dx = textDrawOffsetX(textAlign, width);\n const height = this.cache.verticalList.length * lineHeight;\n const dy = textLayoutOffsetY(textBaseline, height, fontSize);\n this._AABBBounds.set(dy, dx, dy + height, dx + width);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n // /**\n // * 是否是简单文字\n // * 单行,横排\n // * @returns\n // */\n // protected isSinglelineAndHorizontal(): boolean {\n // return !this.isMultiLine && this.attribute.direction !== 'vertical';\n // }\n\n protected getMaxWidth(theme: ITextGraphicAttribute): number {\n // 传入了maxLineWidth就优先使用,否则使用maxWidth\n const attribute = this.attribute;\n return attribute.maxLineWidth ?? attribute.maxWidth ?? theme.maxWidth;\n }\n\n protected getLineHeight(attribute: ITextGraphicAttribute, textTheme: ITextGraphicAttribute) {\n return (\n calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize) ??\n (attribute.fontSize || textTheme.fontSize)\n );\n }\n\n protected needUpdateTags(keys: string[], k = TEXT_UPDATE_TAG_KEY): boolean {\n return super.needUpdateTags(keys, k);\n }\n protected needUpdateTag(key: string, k = TEXT_UPDATE_TAG_KEY): boolean {\n return super.needUpdateTag(key, k);\n }\n\n clone(): Text {\n return new Text({ ...this.attribute });\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return Text.NOWORK_ANIMATE_ATTR;\n }\n\n /**\n * 用于垂直布局时align和baseline相互转换\n * @returns\n */\n getBaselineMapAlign(): Record<string, string> {\n return Text.baselineMapAlign;\n }\n\n /**\n * 用于垂直布局时align和baseline相互转换\n * @returns\n */\n getAlignMapBaseline(): Record<string, string> {\n return Text.alignMapBaseline;\n }\n\n static baselineMapAlign = {\n top: 'left',\n bottom: 'right',\n middle: 'center'\n };\n\n static alignMapBaseline = {\n left: 'top',\n right: 'bottom',\n center: 'middle'\n };\n}\n\nexport function createText(attributes: ITextGraphicAttribute): IText {\n return new Text(attributes);\n}\n\n// addAttributeToPrototype(DefaultLineStyle, Text, PURE_STYLE_KEY);\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/graphic/text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxG,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAErE,MAAM,mBAAmB,GAAG;IAC1B,MAAM;IACN,cAAc;IAEd,WAAW;IACX,cAAc;IACd,aAAa;IACb,WAAW;IACX,UAAU;IACV,YAAY;IACZ,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,WAAW;IACX,WAAW;IACX,aAAa;IACb,WAAW;IACX,GAAG,sBAAsB;CAC1B,CAAC;AAEF,MAAM,OAAO,IAAK,SAAQ,OAA8B;IAmBtD,IAAI,IAAI;QACN,MAAM,SAAS,GAAG,IAAI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C;SACxC;QAED,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAES,cAAc,CAAC,IAAc,EAAE,CAAC,GAAG,mBAAmB;QAC9D,OAAO,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACvC,CAAC;IACS,aAAa,CAAC,GAAW,EAAE,CAAC,GAAG,mBAAmB;QAC1D,OAAO,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,KAAK;QACH,OAAO,IAAI,IAAI,mBAAM,IAAI,CAAC,SAAS,EAAG,CAAC;IACzC,CAAC;IAED,oBAAoB;QAClB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;;AA9yBM,wBAAmB,mBACxB,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,CAAC,EACZ,SAAS,EAAE,CAAC,EACZ,SAAS,EAAE,CAAC,EACZ,YAAY,EAAE,CAAC,EACf,UAAU,EAAE,CAAC,EACb,UAAU,EAAE,CAAC,IACV,mBAAmB,EACtB;AAufK,qBAAgB,GAAG;IACxB,GAAG,EAAE,MAAM;IACX,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEK,qBAAgB,GAAG;IACxB,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;CACjB,CAAC;AAuSJ,MAAM,UAAU,UAAU,CAAC,UAAiC;IAC1D,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;AAC9B,CAAC","file":"text.js","sourcesContent":["import type { IAABBBounds, IOBBBounds } from '@visactor/vutils';\nimport { max, isArray, getContextFont, transformBoundsWithMatrix, rotatePoint } from '@visactor/vutils';\nimport { textDrawOffsetX, textLayoutOffsetY } from '../common/text';\nimport { CanvasTextLayout } from '../core/contributions/textMeasure/layout';\nimport { application } from '../application';\nimport type { IText, ITextCache, ITextGraphicAttribute, LayoutItemType, LayoutType } from '../interface';\nimport { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from './graphic';\nimport { getTheme } from './theme';\nimport { calculateLineHeight } from '../common/utils';\nimport { TEXT_NUMBER_TYPE } from './constants';\nimport { boundStroke, TextDirection, verticalLayout } from './tools';\n\nconst TEXT_UPDATE_TAG_KEY = [\n 'text',\n 'maxLineWidth',\n // 多行文本要用到\n 'textAlign',\n 'textBaseline',\n 'heightLimit',\n 'lineClamp',\n 'fontSize',\n 'fontFamily',\n 'fontWeight',\n 'ellipsis',\n 'lineHeight',\n 'direction',\n 'wordBreak',\n 'heightLimit',\n 'lineClamp',\n ...GRAPHIC_UPDATE_TAG_KEY\n];\n\nexport class Text extends Graphic<ITextGraphicAttribute> implements IText {\n type: 'text' = 'text';\n\n static NOWORK_ANIMATE_ATTR = {\n ellipsis: 1,\n wordBreak: 1,\n direction: 1,\n textAlign: 1,\n textBaseline: 1,\n fontFamily: 1,\n fontWeight: 1,\n ...NOWORK_ANIMATE_ATTR\n };\n\n cache: ITextCache;\n _font: string;\n\n protected declare obbText?: Text;\n\n get font(): string {\n const textTheme = this.getGraphicTheme();\n if (!this._font) {\n this._font = getContextFont(this.attribute, textTheme);\n }\n return this._font as string;\n }\n\n get clipedText(): string | undefined {\n const attribute = this.attribute;\n const textTheme = this.getGraphicTheme();\n if (!this.isSimplify()) {\n return undefined;\n }\n const { maxLineWidth = textTheme.maxLineWidth } = attribute;\n if (!Number.isFinite(maxLineWidth)) {\n return (attribute.text ?? textTheme.text).toString();\n }\n this.tryUpdateAABBBounds();\n return this.cache.clipedText;\n }\n get clipedWidth(): number | undefined {\n if (!this.isSimplify()) {\n return undefined;\n }\n this.tryUpdateAABBBounds();\n return this.cache.clipedWidth;\n }\n get cliped(): boolean | undefined {\n const textTheme = this.getGraphicTheme();\n const attribute = this.attribute;\n const { maxLineWidth = textTheme.maxLineWidth, text, whiteSpace = textTheme.whiteSpace } = attribute;\n if (!Number.isFinite(maxLineWidth)) {\n return false;\n }\n this.tryUpdateAABBBounds();\n if (this.cache?.layoutData?.lines) {\n let mergedText = '';\n this.cache.layoutData.lines.forEach(item => {\n mergedText += item.str;\n });\n const originText = Array.isArray(text) ? text.join('') : text;\n\n return originText !== mergedText;\n }\n if (attribute.direction === 'vertical' && this.cache.verticalList && this.cache.verticalList[0]) {\n return this.cache.verticalList[0].map(item => item.text).join('') !== attribute.text.toString();\n }\n if (this.clipedText == null) {\n return false;\n }\n return this.clipedText !== attribute.text.toString();\n }\n get multilineLayout(): LayoutType | undefined {\n if (!this.isMultiLine) {\n return undefined;\n }\n this.tryUpdateAABBBounds();\n return this.cache.layoutData;\n }\n\n // 是否是简单文字\n // 单行,横排\n private isSimplify(): boolean {\n return !this.isMultiLine && this.attribute.direction !== 'vertical';\n }\n get isMultiLine(): boolean {\n return Array.isArray(this.attribute.text) || this.attribute.whiteSpace === 'normal';\n }\n\n constructor(params: ITextGraphicAttribute = { text: '', fontSize: 16 }) {\n super(params);\n this.numberType = TEXT_NUMBER_TYPE;\n this.cache = {};\n }\n\n isValid(): boolean {\n return super.isValid() && this._isValid();\n }\n protected _isValid(): boolean {\n const { text } = this.attribute;\n if (isArray(text)) {\n return !(text as any[]).every((t: any) => t == null || t === '');\n }\n return text != null && text !== '';\n }\n\n getGraphicTheme(): Required<ITextGraphicAttribute> {\n return getTheme(this).text;\n }\n\n protected doUpdateOBBBounds(): IOBBBounds {\n const graphicTheme = this.getGraphicTheme();\n this._OBBBounds.clear();\n const attribute = this.attribute;\n const { angle = graphicTheme.angle } = attribute;\n if (!angle) {\n const b = this.AABBBounds;\n this._OBBBounds.setValue(b.x1, b.y1, b.x2, b.y2);\n return this._OBBBounds;\n }\n if (!this.obbText) {\n this.obbText = new Text({});\n }\n this.obbText.setAttributes({ ...attribute, angle: 0 });\n const bounds1 = this.obbText.AABBBounds;\n const { x, y } = attribute;\n const boundsCenter = { x: (bounds1.x1 + bounds1.x2) / 2, y: (bounds1.y1 + bounds1.y2) / 2 };\n const center = rotatePoint(boundsCenter, angle, { x, y });\n this._OBBBounds.copy(bounds1);\n this._OBBBounds.translate(center.x - boundsCenter.x, center.y - boundsCenter.y);\n this._OBBBounds.angle = angle;\n return this._OBBBounds;\n }\n\n protected updateAABBBounds(\n attribute: ITextGraphicAttribute,\n textTheme: Required<ITextGraphicAttribute>,\n aabbBounds: IAABBBounds\n ) {\n const { text = textTheme.text } = this.attribute;\n if (Array.isArray(text)) {\n this.updateMultilineAABBBounds(text as (number | string)[]);\n } else {\n this.updateSingallineAABBBounds(text as number | string);\n }\n\n const { tb1 } = application.graphicService.updateTempAABBBounds(aabbBounds);\n\n const {\n scaleX = textTheme.scaleX,\n scaleY = textTheme.scaleY,\n shadowBlur = textTheme.shadowBlur,\n strokeBoundsBuffer = textTheme.strokeBoundsBuffer\n } = attribute;\n if (shadowBlur) {\n const shadowBlurHalfWidth = shadowBlur / Math.abs(scaleX + scaleY);\n boundStroke(tb1, shadowBlurHalfWidth, true, strokeBoundsBuffer);\n aabbBounds.union(tb1);\n }\n // 合并shadowRoot的bounds\n application.graphicService.combindShadowAABBBounds(aabbBounds, this);\n\n if (attribute.forceBoundsHeight != null || attribute.forceBoundsWidth != null) {\n application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds);\n }\n\n transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix);\n return aabbBounds;\n }\n\n /**\n * 计算多行文字的bounds,缓存每行文字的布局位置\n * 自动折行params.text是数组,因此只重新updateMultilineAABBBounds\n * @param text\n */\n updateWrapAABBBounds(text: (number | string) | (number | string)[]) {\n const textTheme = this.getGraphicTheme();\n const {\n fontFamily = textTheme.fontFamily,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontSize = textTheme.fontSize,\n ellipsis = textTheme.ellipsis,\n maxLineWidth,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n wordBreak = textTheme.wordBreak,\n fontWeight = textTheme.fontWeight,\n // widthLimit,\n ignoreBuf = textTheme.ignoreBuf,\n suffixPosition = textTheme.suffixPosition,\n heightLimit = 0,\n lineClamp\n } = this.attribute;\n const lineHeight =\n calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize) ??\n (this.attribute.fontSize || textTheme.fontSize);\n const buf = ignoreBuf ? 0 : 2;\n if (!this.shouldUpdateShape() && this.cache?.layoutData) {\n const bbox = this.cache.layoutData.bbox;\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n const textMeasure = application.graphicUtil.textMeasure;\n const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure as any) as any;\n\n // layoutObj内逻辑\n const lines = isArray(text) ? (text.map(l => l.toString()) as string[]) : [text.toString()];\n const linesLayout: LayoutItemType[] = [];\n const bboxWH: [number, number] = [0, 0];\n\n let lineCountLimit = Infinity;\n if (heightLimit > 0) {\n lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1);\n }\n if (lineClamp) {\n // 处理行数限制\n lineCountLimit = Math.min(lineCountLimit, lineClamp);\n }\n\n if (typeof maxLineWidth === 'number' && maxLineWidth !== Infinity) {\n // widthLimit > 0\n if (maxLineWidth > 0) {\n for (let i = 0; i < lines.length; i++) {\n const str = lines[i] as string;\n let needCut = true;\n // // 测量当前行宽度\n // width = Math.min(\n // layoutObj.textMeasure.measureTextWidth(str, layoutObj.textOptions),\n // maxLineWidth\n // );\n\n // 判断是否超过高度限制\n if (i === lineCountLimit - 1) {\n // 当前行为最后一行,如果后面还有行,需要显示省略号\n const clip = layoutObj.textMeasure.clipTextWithSuffix(\n str,\n layoutObj.textOptions,\n maxLineWidth,\n ellipsis,\n false,\n suffixPosition,\n i !== lines.length - 1\n );\n linesLayout.push({\n str: clip.str,\n width: clip.width\n });\n break; // 不处理后续行\n }\n\n // 测量截断位置\n const clip = layoutObj.textMeasure.clipText(\n str,\n layoutObj.textOptions,\n maxLineWidth,\n wordBreak !== 'break-all',\n wordBreak === 'keep-all'\n );\n if ((str !== '' && clip.str === '') || clip.wordBreaked) {\n if (ellipsis) {\n const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(\n str,\n layoutObj.textOptions,\n maxLineWidth,\n ellipsis,\n false,\n suffixPosition\n );\n clip.str = clipEllipsis.str ?? '';\n clip.width = clipEllipsis.width ?? 0;\n } else {\n // 宽度限制不足一个字符,不显示\n clip.str = '';\n clip.width = 0;\n }\n needCut = false;\n }\n\n linesLayout.push({\n str: clip.str,\n width: clip.width\n });\n let cutLength = clip.str.length;\n if (clip.wordBreaked && !(str !== '' && clip.str === '')) {\n needCut = true;\n cutLength = clip.wordBreaked;\n }\n if (clip.str.length === str.length) {\n // 不需要截断\n } else if (needCut) {\n let newStr = str.substring(cutLength);\n // 截断后,避免开头有空格很尬,去掉\n if (wordBreak === 'keep-all') {\n newStr = newStr.replace(/^\\s+/g, '');\n }\n lines.splice(i + 1, 0, newStr);\n }\n }\n }\n // bboxWH[0] = maxLineWidth;\n let maxWidth = 0;\n linesLayout.forEach(layout => {\n maxWidth = Math.max(maxWidth, layout.width);\n });\n bboxWH[0] = maxWidth;\n } else {\n // 使用所有行中最长的作为lineWidth\n let lineWidth = 0;\n let width: number;\n let text: string;\n for (let i = 0, len = lines.length; i < len; i++) {\n // 判断是否超过高度限制\n if (i === lineCountLimit - 1) {\n // 当前行为最后一行\n const clip = layoutObj.textMeasure.clipTextWithSuffix(\n lines[i],\n layoutObj.textOptions,\n maxLineWidth,\n ellipsis,\n false,\n suffixPosition\n );\n linesLayout.push({\n str: clip.str,\n width: clip.width\n });\n lineWidth = Math.max(lineWidth, clip.width);\n break; // 不处理后续行\n }\n\n text = lines[i] as string;\n width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, wordBreak === 'break-word');\n lineWidth = Math.max(lineWidth, width);\n linesLayout.push({ str: text, width });\n }\n bboxWH[0] = lineWidth;\n }\n bboxWH[1] = linesLayout.length * (lineHeight + buf);\n\n const bbox = {\n xOffset: 0,\n yOffset: 0,\n width: bboxWH[0],\n height: bboxWH[1]\n };\n\n layoutObj.LayoutBBox(bbox, textAlign, textBaseline as any);\n\n const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline as any, lineHeight);\n\n // const layoutData = layoutObj.GetLayoutByLines(\n // text,\n // textAlign,\n // textBaseline as any,\n // lineHeight,\n // ellipsis === true ? (DefaultTextAttribute.ellipsis as string) : ellipsis || undefined,\n // maxLineWidth\n // );\n // const { bbox } = layoutData;\n this.cache.layoutData = layoutData;\n this.clearUpdateShapeTag();\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateSingallineAABBBounds(text: number | string): IAABBBounds {\n const textTheme = this.getGraphicTheme();\n const { direction = textTheme.direction, underlineOffset = textTheme.underlineOffset } = this.attribute;\n\n const b =\n direction === 'horizontal'\n ? this.updateHorizontalSinglelineAABBBounds(text)\n : this.updateVerticalSinglelineAABBBounds(text);\n if (direction === 'horizontal') {\n if (underlineOffset) {\n this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset);\n }\n }\n return b;\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateMultilineAABBBounds(text: (number | string)[]): IAABBBounds {\n const textTheme = this.getGraphicTheme();\n const { direction = textTheme.direction, underlineOffset = textTheme.underlineOffset } = this.attribute;\n\n const b =\n direction === 'horizontal'\n ? this.updateHorizontalMultilineAABBBounds(text)\n : this.updateVerticalMultilineAABBBounds(text);\n\n if (direction === 'horizontal') {\n if (underlineOffset) {\n this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset);\n }\n }\n return b;\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateHorizontalSinglelineAABBBounds(text: number | string): IAABBBounds {\n const textTheme = this.getGraphicTheme();\n const { wrap = textTheme.wrap } = this.attribute;\n if (wrap) {\n return this.updateWrapAABBBounds([text]);\n }\n\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n let str: string;\n const attribute = this.attribute;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontFamily = textTheme.fontFamily,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n // wordBreak = textTheme.wordBreak,\n ignoreBuf = textTheme.ignoreBuf,\n whiteSpace = textTheme.whiteSpace,\n suffixPosition = textTheme.suffixPosition\n } = attribute;\n if (whiteSpace === 'normal') {\n return this.updateWrapAABBBounds(text);\n }\n const buf = ignoreBuf ? 0 : Math.max(2, fontSize * 0.075);\n const textFontSize = attribute.fontSize || textTheme.fontSize;\n const lineHeight = calculateLineHeight(attribute.lineHeight, textFontSize) ?? textFontSize + buf;\n if (!this.shouldUpdateShape() && this.cache) {\n width = this.cache.clipedWidth ?? 0;\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffix(\n text.toString(),\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false,\n suffixPosition\n );\n str = data.str;\n width = data.width;\n } else {\n const data = textMeasure.clipText(text.toString(), { fontSize, fontWeight, fontFamily }, maxLineWidth, false);\n str = data.str;\n width = data.width;\n }\n this.cache.clipedText = str;\n this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = textMeasure.measureTextWidth(text.toString(), { fontSize, fontWeight, fontFamily });\n this.cache.clipedText = text.toString();\n this.cache.clipedWidth = width;\n }\n this.clearUpdateShapeTag();\n\n const dx = textDrawOffsetX(textAlign, width);\n let lh = lineHeight;\n if (application.global && application.global.isSafari()) {\n // 如果是safari,那么需要额外增加高度\n lh += fontSize * 0.2;\n }\n const dy = textLayoutOffsetY(textBaseline, lh, fontSize, buf);\n this._AABBBounds.set(dx, dy, dx + width, dy + lh);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n getBaselineMapAlign(): Record<string, string> {\n return Text.baselineMapAlign;\n }\n\n getAlignMapBaseline(): Record<string, string> {\n return Text.alignMapBaseline;\n }\n\n static baselineMapAlign = {\n top: 'left',\n bottom: 'right',\n middle: 'center'\n };\n\n static alignMapBaseline = {\n left: 'top',\n right: 'bottom',\n center: 'middle'\n };\n\n /**\n * 计算垂直布局的单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateVerticalSinglelineAABBBounds(text: number | string): IAABBBounds {\n const textTheme = this.getGraphicTheme();\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n let str: string;\n const attribute = this.attribute;\n const { ignoreBuf = textTheme.ignoreBuf } = attribute;\n const buf = ignoreBuf ? 0 : 2;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n fontFamily = textTheme.fontFamily,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n verticalMode = textTheme.verticalMode,\n suffixPosition = textTheme.suffixPosition\n } = attribute;\n\n const lineHeight =\n calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize) ??\n (attribute.fontSize || textTheme.fontSize) + buf;\n\n let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;\n if (!verticalMode) {\n const t = textAlign;\n textAlign = (Text.baselineMapAlign as any)[textBaseline] ?? 'left';\n textBaseline = (Text.alignMapBaseline as any)[t] ?? 'top';\n }\n if (!this.shouldUpdateShape() && this.cache) {\n width = this.cache.clipedWidth;\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n let verticalList: { text: string; width?: number; direction: TextDirection }[][] = [\n verticalLayout(text.toString())\n ];\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffixVertical(\n verticalList[0],\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false,\n suffixPosition\n );\n verticalList = [data.verticalList];\n width = data.width;\n } else {\n const data = textMeasure.clipTextVertical(\n verticalList[0],\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n false\n );\n verticalList = [data.verticalList];\n width = data.width;\n }\n this.cache.verticalList = verticalList;\n this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = 0;\n verticalList[0].forEach(t => {\n const w =\n t.direction === TextDirection.HORIZONTAL\n ? fontSize\n : textMeasure.measureTextWidth(t.text, { fontSize, fontWeight, fontFamily });\n\n width += w;\n t.width = w;\n });\n this.cache.verticalList = verticalList;\n this.cache.clipedWidth = width;\n }\n this.clearUpdateShapeTag();\n\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算多行文字的bounds,缓存每行文字的布局位置\n * @param text\n */\n updateHorizontalMultilineAABBBounds(text: (number | string)[]): IAABBBounds {\n const textTheme = this.getGraphicTheme();\n const { wrap = textTheme.wrap } = this.attribute;\n if (wrap) {\n return this.updateWrapAABBBounds(text);\n }\n\n const attribute = this.attribute;\n const {\n fontFamily = textTheme.fontFamily,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n ellipsis = textTheme.ellipsis,\n maxLineWidth,\n stroke = textTheme.stroke,\n // ignoreBuf = textTheme.ignoreBuf,\n lineWidth = textTheme.lineWidth,\n whiteSpace = textTheme.whiteSpace,\n suffixPosition = textTheme.suffixPosition\n } = attribute;\n // const buf = ignoreBuf ? 0 : Math.max(2, fontSize * 0.075);\n const lineHeight =\n calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize) ??\n (attribute.fontSize || textTheme.fontSize);\n if (whiteSpace === 'normal') {\n return this.updateWrapAABBBounds(text);\n }\n if (!this.shouldUpdateShape() && this.cache?.layoutData) {\n const bbox = this.cache.layoutData.bbox;\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n const textMeasure = application.graphicUtil.textMeasure;\n const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure);\n const layoutData = layoutObj.GetLayoutByLines(\n text,\n textAlign,\n textBaseline as any,\n lineHeight,\n ellipsis === true ? (textTheme.ellipsis as string) : ellipsis || undefined,\n false,\n maxLineWidth,\n suffixPosition\n );\n const { bbox } = layoutData;\n this.cache.layoutData = layoutData;\n this.clearUpdateShapeTag();\n\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算垂直布局的多行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateVerticalMultilineAABBBounds(text: (number | string)[]): IAABBBounds {\n const textTheme = this.getGraphicTheme();\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n const attribute = this.attribute;\n const { ignoreBuf = textTheme.ignoreBuf } = attribute;\n const buf = ignoreBuf ? 0 : 2;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n fontFamily = textTheme.fontFamily,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n // wordBreak = textTheme.wordBreak,\n verticalMode = textTheme.verticalMode,\n suffixPosition = textTheme.suffixPosition\n } = attribute;\n const lineHeight =\n calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize) ??\n (attribute.fontSize || textTheme.fontSize) + buf;\n let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;\n if (!verticalMode) {\n const t = textAlign;\n textAlign = (Text.baselineMapAlign as any)[textBaseline] ?? 'left';\n textBaseline = (Text.alignMapBaseline as any)[t] ?? 'top';\n }\n width = 0;\n if (!this.shouldUpdateShape() && this.cache) {\n this.cache.verticalList.forEach(item => {\n const w = item.reduce((a, b) => a + b.width, 0);\n width = max(w, width);\n });\n const dx = textDrawOffsetX(textAlign, width);\n const height = this.cache.verticalList.length * lineHeight;\n const dy = textLayoutOffsetY(textBaseline, height, fontSize);\n this._AABBBounds.set(dy, dx, dy + height, dx + width);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n const verticalLists: { text: string; width?: number; direction: TextDirection }[][] = text.map(str => {\n return verticalLayout(str.toString());\n });\n verticalLists.forEach((verticalData, i) => {\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffixVertical(\n verticalData,\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false,\n suffixPosition\n );\n verticalLists[i] = data.verticalList;\n width = data.width;\n } else {\n const data = textMeasure.clipTextVertical(\n verticalData,\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n false\n );\n verticalLists[i] = data.verticalList;\n width = data.width;\n }\n // this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = 0;\n verticalData.forEach(t => {\n const w =\n t.direction === TextDirection.HORIZONTAL\n ? fontSize\n : textMeasure.measureTextWidth(t.text, { fontSize, fontWeight, fontFamily });\n\n width += w;\n t.width = w;\n });\n }\n });\n this.cache.verticalList = verticalLists;\n this.clearUpdateShapeTag();\n\n this.cache.verticalList.forEach(item => {\n const w = item.reduce((a, b) => a + b.width, 0);\n width = max(w, width);\n });\n\n const dx = textDrawOffsetX(textAlign, width);\n const height = this.cache.verticalList.length * lineHeight;\n const dy = textLayoutOffsetY(textBaseline, height, fontSize);\n this._AABBBounds.set(dy, dx, dy + height, dx + width);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n protected needUpdateTags(keys: string[], k = TEXT_UPDATE_TAG_KEY): boolean {\n return super.needUpdateTags(keys, k);\n }\n protected needUpdateTag(key: string, k = TEXT_UPDATE_TAG_KEY): boolean {\n return super.needUpdateTag(key, k);\n }\n\n clone(): Text {\n return new Text({ ...this.attribute });\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return Text.NOWORK_ANIMATE_ATTR;\n }\n}\n\nexport function createText(attributes: ITextGraphicAttribute): IText {\n return new Text(attributes);\n}\n\n// addAttributeToPrototype(DefaultLineStyle, Text, PURE_STYLE_KEY);\n"]}
|