@visactor/vrender-core 0.20.16 → 0.21.0-alpha.10
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/color-utils.js +2 -2
- package/cjs/common/color-utils.js.map +1 -1
- package/cjs/core/contributions/textMeasure/AtextMeasure.d.ts +56 -4
- package/cjs/core/contributions/textMeasure/AtextMeasure.js +107 -14
- package/cjs/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/cjs/core/contributions/textMeasure/layout.d.ts +7 -3
- package/cjs/core/contributions/textMeasure/layout.js +40 -39
- package/cjs/core/contributions/textMeasure/layout.js.map +1 -1
- package/cjs/core/stage.d.ts +2 -0
- package/cjs/core/stage.js +9 -5
- package/cjs/core/stage.js.map +1 -1
- package/cjs/graphic/config.d.ts +1 -1
- package/cjs/graphic/config.js +4 -2
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-service.d.ts +2 -0
- package/cjs/graphic/graphic-service/graphic-service.js +10 -5
- package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
- package/cjs/graphic/richtext/line.js +2 -9
- package/cjs/graphic/richtext/line.js.map +1 -1
- package/cjs/graphic/richtext/paragraph.js +3 -2
- package/cjs/graphic/richtext/paragraph.js.map +1 -1
- package/cjs/graphic/richtext/utils.d.ts +1 -2
- package/cjs/graphic/richtext/utils.js +3 -5
- package/cjs/graphic/richtext/utils.js.map +1 -1
- package/cjs/graphic/text.d.ts +11 -11
- package/cjs/graphic/text.js +99 -170
- package/cjs/graphic/text.js.map +1 -1
- package/cjs/graphic/wrap-text.js +12 -4
- 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/graphic/text.d.ts +9 -3
- package/cjs/interface/graphic/text.js +6 -1
- package/cjs/interface/graphic/text.js.map +1 -1
- package/cjs/interface/graphic-service.d.ts +2 -0
- package/cjs/interface/graphic-service.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 +9 -1
- package/cjs/interface/text.js.map +1 -1
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +3 -0
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/cjs/render/contributions/render/draw-interceptor.js +2 -3
- package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
- package/cjs/render/contributions/render/text-render.d.ts +1 -1
- package/cjs/render/contributions/render/text-render.js +24 -46
- package/cjs/render/contributions/render/text-render.js.map +1 -1
- package/dist/index.es.js +2725 -2712
- 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/color-utils.js +2 -2
- package/es/common/color-utils.js.map +1 -1
- package/es/core/contributions/textMeasure/AtextMeasure.d.ts +56 -4
- package/es/core/contributions/textMeasure/AtextMeasure.js +108 -13
- package/es/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/es/core/contributions/textMeasure/layout.d.ts +7 -3
- package/es/core/contributions/textMeasure/layout.js +40 -39
- package/es/core/contributions/textMeasure/layout.js.map +1 -1
- package/es/core/stage.d.ts +2 -0
- package/es/core/stage.js +9 -5
- package/es/core/stage.js.map +1 -1
- package/es/graphic/config.d.ts +1 -1
- package/es/graphic/config.js +5 -1
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/graphic-service/graphic-service.d.ts +2 -0
- package/es/graphic/graphic-service/graphic-service.js +11 -4
- package/es/graphic/graphic-service/graphic-service.js.map +1 -1
- package/es/graphic/richtext/line.js +3 -10
- package/es/graphic/richtext/line.js.map +1 -1
- package/es/graphic/richtext/paragraph.js +3 -2
- package/es/graphic/richtext/paragraph.js.map +1 -1
- package/es/graphic/richtext/utils.d.ts +1 -2
- package/es/graphic/richtext/utils.js +2 -6
- package/es/graphic/richtext/utils.js.map +1 -1
- package/es/graphic/text.d.ts +11 -11
- package/es/graphic/text.js +98 -165
- package/es/graphic/text.js.map +1 -1
- package/es/graphic/wrap-text.js +12 -4
- 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/graphic/text.d.ts +9 -3
- package/es/interface/graphic/text.js +6 -1
- package/es/interface/graphic/text.js.map +1 -1
- package/es/interface/graphic-service.d.ts +2 -0
- package/es/interface/graphic-service.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 +9 -1
- package/es/interface/text.js.map +1 -1
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +3 -0
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/es/render/contributions/render/draw-interceptor.js +2 -3
- package/es/render/contributions/render/draw-interceptor.js.map +1 -1
- package/es/render/contributions/render/text-render.d.ts +1 -1
- package/es/render/contributions/render/text-render.js +23 -45
- package/es/render/contributions/render/text-render.js.map +1 -1
- package/package.json +4 -4
|
@@ -4,57 +4,56 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.CanvasTextLayout = void 0;
|
|
6
6
|
|
|
7
|
+
const interface_1 = require("../../../interface");
|
|
8
|
+
|
|
7
9
|
class CanvasTextLayout {
|
|
8
10
|
constructor(fontFamily, options, textMeasure) {
|
|
9
11
|
this.fontFamily = fontFamily, this.textOptions = options, this.textMeasure = textMeasure;
|
|
10
12
|
}
|
|
11
|
-
LayoutBBox(bbox, textAlign, textBaseline) {
|
|
13
|
+
LayoutBBox(bbox, textAlign, textBaseline, linesLayout) {
|
|
12
14
|
if ("left" === textAlign || "start" === textAlign) bbox.xOffset = 0; else if ("center" === textAlign) bbox.xOffset = bbox.width / -2; else {
|
|
13
15
|
if ("right" !== textAlign && "end" !== textAlign) throw new Error("非法的textAlign");
|
|
14
16
|
bbox.xOffset = -bbox.width;
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
width: this.textMeasure.measureTextWidth(clipText, this.textOptions)
|
|
26
|
-
}), str = str.substring(clipText.length);
|
|
27
|
-
}
|
|
28
|
-
"left" === textAlign || "start" === textAlign || ("center" === textAlign ? bboxOffset[0] = bboxWH[0] / -2 : "right" !== textAlign && "end" !== textAlign || (bboxOffset[0] = -bboxWH[0])),
|
|
29
|
-
"top" === textBaseline || ("middle" === textBaseline ? bboxOffset[1] = bboxWH[1] / -2 : "bottom" === textBaseline && (bboxOffset[1] = -bboxWH[1]));
|
|
30
|
-
const bbox = {
|
|
31
|
-
xOffset: bboxOffset[0],
|
|
32
|
-
yOffset: bboxOffset[1],
|
|
33
|
-
width: bboxWH[0],
|
|
34
|
-
height: bboxWH[1]
|
|
35
|
-
};
|
|
36
|
-
return this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
18
|
+
if ("top" === textBaseline) bbox.yOffset = 0; else if ("middle" === textBaseline) bbox.yOffset = bbox.height / -2; else if ("alphabetic" === textBaseline) {
|
|
19
|
+
let percent = .79;
|
|
20
|
+
if (1 === linesLayout.length) {
|
|
21
|
+
const lineInfo = linesLayout[0];
|
|
22
|
+
percent = lineInfo.ascent / (lineInfo.ascent + lineInfo.descent);
|
|
23
|
+
}
|
|
24
|
+
bbox.yOffset = bbox.height * -percent;
|
|
25
|
+
} else bbox.yOffset = -bbox.height;
|
|
26
|
+
return bbox;
|
|
37
27
|
}
|
|
38
|
-
GetLayoutByLines(lines, textAlign, textBaseline, lineHeight, suffix = "", wordBreak,
|
|
28
|
+
GetLayoutByLines(lines, textAlign, textBaseline, lineHeight, suffix = "", wordBreak, params) {
|
|
29
|
+
const {lineWidth: lineWidth, suffixPosition: suffixPosition = "end", measureMode: measureMode = interface_1.MeasureModeEnum.actualBounding} = null != params ? params : {};
|
|
39
30
|
lines = lines.map((l => l.toString()));
|
|
40
31
|
const linesLayout = [], bboxWH = [ 0, 0 ];
|
|
41
32
|
if ("number" == typeof lineWidth && lineWidth !== 1 / 0) {
|
|
42
33
|
let width;
|
|
43
|
-
for (let i = 0, len = lines.length; i < len; i++)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
for (let i = 0, len = lines.length; i < len; i++) {
|
|
35
|
+
const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions, measureMode);
|
|
36
|
+
width = Math.min(metrics.width, lineWidth), linesLayout.push({
|
|
37
|
+
str: metrics.width <= lineWidth ? lines[i].toString() : this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
|
|
38
|
+
width: width,
|
|
39
|
+
ascent: metrics.ascent,
|
|
40
|
+
descent: metrics.descent
|
|
41
|
+
});
|
|
42
|
+
}
|
|
48
43
|
bboxWH[0] = lineWidth;
|
|
49
44
|
} else {
|
|
50
|
-
let width, text;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
let width, text, _lineWidth = 0;
|
|
46
|
+
for (let i = 0, len = lines.length; i < len; i++) {
|
|
47
|
+
text = lines[i];
|
|
48
|
+
const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions, measureMode);
|
|
49
|
+
width = metrics.width, _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
|
|
50
|
+
str: text,
|
|
51
|
+
width: width,
|
|
52
|
+
ascent: metrics.ascent,
|
|
53
|
+
descent: metrics.descent
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
bboxWH[0] = _lineWidth;
|
|
58
57
|
}
|
|
59
58
|
bboxWH[1] = linesLayout.length * lineHeight, bboxWH[0] = linesLayout.reduce(((a, b) => Math.max(a, b.width)), 0);
|
|
60
59
|
const bbox = {
|
|
@@ -63,7 +62,7 @@ class CanvasTextLayout {
|
|
|
63
62
|
width: bboxWH[0],
|
|
64
63
|
height: bboxWH[1]
|
|
65
64
|
};
|
|
66
|
-
return this.LayoutBBox(bbox, textAlign, textBaseline), this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
65
|
+
return this.LayoutBBox(bbox, textAlign, textBaseline, linesLayout), this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
67
66
|
}
|
|
68
67
|
layoutWithBBox(bbox, lines, textAlign, textBaseline, lineHeight) {
|
|
69
68
|
const origin = [ 0, 0 ], totalLineHeight = lines.length * lineHeight;
|
|
@@ -81,8 +80,10 @@ class CanvasTextLayout {
|
|
|
81
80
|
};
|
|
82
81
|
}
|
|
83
82
|
lineOffset(bbox, line, textAlign, textBaseline, lineHeight, origin) {
|
|
84
|
-
|
|
85
|
-
line.topOffset =
|
|
83
|
+
"left" === textAlign || "start" === textAlign ? line.leftOffset = 0 : "center" === textAlign ? line.leftOffset = (bbox.width - line.width) / 2 : "right" !== textAlign && "end" !== textAlign || (line.leftOffset = bbox.width - line.width),
|
|
84
|
+
line.topOffset = lineHeight / 2 + (line.ascent - line.descent) / 2 + origin[1];
|
|
85
|
+
const actualHeightWithBuf = line.ascent + line.descent + 0;
|
|
86
|
+
return actualHeightWithBuf < lineHeight - 0 && ("bottom" === textBaseline ? line.topOffset += (lineHeight - actualHeightWithBuf) / 2 : "top" === textBaseline && (line.topOffset -= (lineHeight - actualHeightWithBuf) / 2)),
|
|
86
87
|
origin[1] += lineHeight, line;
|
|
87
88
|
}
|
|
88
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/contributions/textMeasure/layout.ts"],"names":[],"mappings":";;;AAIA,MAAa,gBAAgB;IAK3B,YAAY,UAAkB,EAAE,OAAwB,EAAE,WAAyB;QACjF,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,UAAU,CAAC,IAAoB,EAAE,SAAwB,EAAE,YAA8B;QACvF,IAAI,SAAS,KAAK,MAAM,IAAI,SAAS,KAAK,OAAO,EAAE;YACjD,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;SAClB;aAAM,IAAI,SAAS,KAAK,QAAQ,EAAE;YACjC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;SAChC;aAAM,IAAI,SAAS,KAAK,OAAO,IAAI,SAAS,KAAK,KAAK,EAAE;YACvD,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;SAC5B;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;SACjC;QAED,IAAI,YAAY,KAAK,KAAK,EAAE;YAC1B,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;SAClB;aAAM,IAAI,YAAY,KAAK,QAAQ,EAAE;YACpC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SACjC;aAAM,IAAI,YAAY,KAAK,YAAY,EAAE;YACxC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC;SACpC;aAAM;YACL,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;SAC7B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B,UAAkB,EAClB,MAAY;QAEZ,IAAI,SAAS,KAAK,MAAM,IAAI,SAAS,KAAK,OAAO,EAAE;YACjD,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;SACrB;aAAM,IAAI,SAAS,KAAK,QAAQ,EAAE;YACjC,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACjD;aAAM,IAAI,SAAS,KAAK,OAAO,IAAI,SAAS,KAAK,KAAK,EAAE;YACvD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;SAC3C;QAGD,IAAI,CAAC,SAAS,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7G,MAAM,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC;QAExB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAjOD,4CAiOC","file":"layout.js","sourcesContent":["import type { vec2 } from '@visactor/vutils';\nimport type { ITextMeasure, TextOptionsType } from '../../../interface/text';\nimport type { TextLayoutBBox, LayoutItemType, LayoutType, TextAlignType, TextBaselineType } from '../../../interface';\n\nexport class CanvasTextLayout {\n private fontFamily: string;\n private textOptions: TextOptionsType;\n private textMeasure: ITextMeasure;\n\n constructor(fontFamily: string, options: TextOptionsType, textMeasure: ITextMeasure) {\n this.fontFamily = fontFamily;\n this.textOptions = options;\n this.textMeasure = textMeasure;\n }\n\n LayoutBBox(bbox: TextLayoutBBox, textAlign: TextAlignType, textBaseline: TextBaselineType): TextLayoutBBox {\n if (textAlign === 'left' || textAlign === 'start') {\n bbox.xOffset = 0;\n } else if (textAlign === 'center') {\n bbox.xOffset = bbox.width / -2;\n } else if (textAlign === 'right' || textAlign === 'end') {\n bbox.xOffset = -bbox.width;\n } else {\n throw new Error('非法的textAlign');\n }\n\n if (textBaseline === 'top') {\n bbox.yOffset = 0;\n } else if (textBaseline === 'middle') {\n bbox.yOffset = bbox.height / -2;\n } else if (textBaseline === 'alphabetic') {\n bbox.yOffset = bbox.height * -0.79;\n } else {\n bbox.yOffset = -bbox.height;\n }\n\n return bbox;\n }\n\n GetLayout(\n str: string,\n width: number,\n height: number,\n textAlign: TextAlignType,\n textBaseline: TextBaselineType,\n lineHeight: number,\n suffix: string,\n wordBreak: boolean,\n suffixPosition: 'start' | 'end' | 'middle'\n ): LayoutType {\n // 拆分str\n const linesLayout: LayoutItemType[] = [];\n // bbox高度可能大于totalHeight\n const bboxWH: vec2 = [width, height];\n const bboxOffset: vec2 = [0, 0];\n\n while (str.length > 0) {\n const { str: clipText } = this.textMeasure.clipTextWithSuffix(\n str,\n this.textOptions,\n width,\n suffix,\n wordBreak,\n suffixPosition\n );\n linesLayout.push({\n str: clipText,\n width: this.textMeasure.measureTextWidth(clipText, this.textOptions)\n });\n str = str.substring(clipText.length);\n }\n\n if (textAlign === 'left' || textAlign === 'start') {\n // origin[0] = 0;\n } else if (textAlign === 'center') {\n bboxOffset[0] = bboxWH[0] / -2;\n } else if (textAlign === 'right' || textAlign === 'end') {\n bboxOffset[0] = -bboxWH[0];\n }\n\n if (textBaseline === 'top') {\n // origin[1] = 0;\n } else if (textBaseline === 'middle') {\n bboxOffset[1] = bboxWH[1] / -2;\n } else if (textBaseline === 'bottom') {\n bboxOffset[1] = -bboxWH[1];\n }\n\n const bbox: TextLayoutBBox = {\n xOffset: bboxOffset[0],\n yOffset: bboxOffset[1],\n width: bboxWH[0],\n height: bboxWH[1]\n };\n\n return this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);\n }\n\n /**\n * 给定拆分好的每行字符串进行布局,如果传入lineWidth,那么后面的字符就拆分\n * @param lines\n * @param lineWidth\n */\n GetLayoutByLines(\n lines: (string | number)[],\n textAlign: TextAlignType,\n textBaseline: TextBaselineType,\n lineHeight: number,\n suffix: string = '',\n wordBreak: boolean,\n lineWidth?: number,\n suffixPosition: 'start' | 'end' | 'middle' = 'end'\n ): LayoutType {\n lines = lines.map(l => l.toString()) as string[];\n const linesLayout: LayoutItemType[] = [];\n // bbox高度可能大于totalHeight\n const bboxWH: vec2 = [0, 0];\n if (typeof lineWidth === 'number' && lineWidth !== Infinity) {\n // 直接使用lineWidth,并拆分字符串\n let width: number;\n for (let i = 0, len = lines.length; i < len; i++) {\n width = Math.min(this.textMeasure.measureTextWidth(lines[i] as string, this.textOptions), lineWidth);\n linesLayout.push({\n str: this.textMeasure.clipTextWithSuffix(\n lines[i] as string,\n this.textOptions,\n width,\n suffix,\n wordBreak,\n suffixPosition\n ).str,\n width\n });\n }\n bboxWH[0] = lineWidth;\n } else {\n // 使用所有行中最长的作为lineWidth\n lineWidth = 0;\n let width: number;\n let text: string;\n for (let i = 0, len = lines.length; i < len; i++) {\n text = lines[i] as string;\n width = this.textMeasure.measureTextWidth(text, this.textOptions);\n lineWidth = Math.max(lineWidth, width);\n linesLayout.push({ str: text, width });\n }\n bboxWH[0] = lineWidth;\n }\n bboxWH[1] = linesLayout.length * lineHeight;\n\n bboxWH[0] = linesLayout.reduce((a, b) => Math.max(a, b.width), 0);\n\n const bbox: TextLayoutBBox = {\n xOffset: 0,\n yOffset: 0,\n width: bboxWH[0],\n height: bboxWH[1]\n };\n\n this.LayoutBBox(bbox, textAlign, textBaseline);\n\n return this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);\n }\n\n layoutWithBBox(\n bbox: TextLayoutBBox,\n lines: LayoutItemType[],\n textAlign: TextAlignType,\n textBaseline: TextBaselineType,\n lineHeight: number\n ): LayoutType {\n const origin: vec2 = [0, 0];\n const totalLineHeight = lines.length * lineHeight; // 总高度\n // origin在y方向需要初始化,然后递增即可\n if (textBaseline === 'top') {\n // origin[1] = 0;\n } else if (textBaseline === 'middle') {\n origin[1] = (bbox.height - totalLineHeight) / 2;\n } else if (textBaseline === 'bottom') {\n origin[1] = bbox.height - totalLineHeight;\n }\n\n for (let i = 0; i < lines.length; i++) {\n this.lineOffset(bbox, lines[i], textAlign, textBaseline, lineHeight, origin);\n }\n\n return {\n bbox,\n lines,\n fontFamily: this.fontFamily,\n fontSize: this.textOptions.fontSize,\n fontWeight: this.textOptions.fontWeight,\n lineHeight,\n textAlign,\n textBaseline\n };\n }\n\n /**\n * 计算line在bbox中的位置,需要配合layoutWithBBox使用\n * @param bbox\n * @param line\n * @param textAlign\n * @param textBaseline\n * @param lineHeight\n * @param origin 这个line的左上角位置,会复用并修改\n */\n private lineOffset(\n bbox: TextLayoutBBox,\n line: LayoutItemType,\n textAlign: TextAlignType,\n textBaseline: TextBaselineType,\n lineHeight: number,\n origin: vec2\n ): LayoutItemType {\n if (textAlign === 'left' || textAlign === 'start') {\n line.leftOffset = 0;\n } else if (textAlign === 'center') {\n line.leftOffset = (bbox.width - line.width) / 2;\n } else if (textAlign === 'right' || textAlign === 'end') {\n line.leftOffset = bbox.width - line.width;\n }\n\n // line.topOffset = lineHeight * 0.79 + origin[1]; // 渲染默认使用alphabetic\n line.topOffset = (lineHeight - this.textOptions.fontSize) / 2 + this.textOptions.fontSize * 0.79 + origin[1];\n origin[1] += lineHeight;\n\n return line;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/contributions/textMeasure/layout.ts"],"names":[],"mappings":";;;AAGA,kDAAqD;AAErD,MAAa,gBAAgB;IAK3B,YAAY,UAAkB,EAAE,OAAwB,EAAE,WAAyB;QACjF,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IASD,UAAU,CACR,IAAoB,EACpB,SAAwB,EACxB,YAA8B,EAC9B,WAA6B;QAE7B,IAAI,SAAS,KAAK,MAAM,IAAI,SAAS,KAAK,OAAO,E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,KAAK,QAAQ,EAAE;YACjC,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACjD;aAAM,IAAI,SAAS,KAAK,OAAO,IAAI,SAAS,KAAK,KAAK,EAAE;YACvD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;SAC3C;QAED,IAAI,CAAC,SAAS,GAAG,UAAU,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAE/E,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAChD,MAAM,GAAG,GAAG,CAAC,CAAC;QACd,MAAM,mBAAmB,GAAG,YAAY,GAAG,GAAG,CAAC;QAC/C,IAAI,mBAAmB,GAAG,UAAU,GAAG,GAAG,EAAE;YAC1C,IAAI,YAAY,KAAK,QAAQ,EAAE;gBAC7B,IAAI,CAAC,SAAS,IAAI,CAAC,UAAU,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;aAC1D;iBAAM,IAAI,YAAY,KAAK,KAAK,EAAE;gBACjC,IAAI,CAAC,SAAS,IAAI,CAAC,UAAU,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;aAC1D;SACF;QACD,MAAM,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC;QAExB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA9ND,4CA8NC","file":"layout.js","sourcesContent":["import type { vec2 } from '@visactor/vutils';\nimport type { ITextMeasure, TextOptionsType } from '../../../interface/text';\nimport type { TextLayoutBBox, LayoutItemType, LayoutType, TextAlignType, TextBaselineType } from '../../../interface';\nimport { MeasureModeEnum } from '../../../interface';\n\nexport class CanvasTextLayout {\n private fontFamily: string;\n private textOptions: TextOptionsType;\n private textMeasure: ITextMeasure;\n\n constructor(fontFamily: string, options: TextOptionsType, textMeasure: ITextMeasure) {\n this.fontFamily = fontFamily;\n this.textOptions = options;\n this.textMeasure = textMeasure;\n }\n\n /**\n * 布局外部的盒子,盒子的alphabetic属性模拟文字的效果\n * @param bbox\n * @param textAlign\n * @param textBaseline\n * @returns\n */\n LayoutBBox(\n bbox: TextLayoutBBox,\n textAlign: TextAlignType,\n textBaseline: TextBaselineType,\n linesLayout: LayoutItemType[]\n ): TextLayoutBBox {\n if (textAlign === 'left' || textAlign === 'start') {\n bbox.xOffset = 0;\n } else if (textAlign === 'center') {\n bbox.xOffset = bbox.width / -2;\n } else if (textAlign === 'right' || textAlign === 'end') {\n bbox.xOffset = -bbox.width;\n } else {\n throw new Error('非法的textAlign');\n }\n\n if (textBaseline === 'top') {\n bbox.yOffset = 0;\n } else if (textBaseline === 'middle') {\n bbox.yOffset = bbox.height / -2;\n } else if (textBaseline === 'alphabetic') {\n // 如果仅有一行,要保证和直接使用canvas绘制的textBaseline一致\n let percent = 0.79;\n if (linesLayout.length === 1) {\n const lineInfo = linesLayout[0];\n percent = lineInfo.ascent / (lineInfo.ascent + lineInfo.descent);\n }\n bbox.yOffset = bbox.height * -percent;\n } else {\n bbox.yOffset = -bbox.height;\n }\n\n return bbox;\n }\n\n /**\n * 给定拆分好的每行字符串进行布局,如果传入lineWidth,那么后面的字符就拆分\n * @param lines\n * @param lineWidth\n */\n GetLayoutByLines(\n lines: (string | number)[],\n textAlign: TextAlignType,\n textBaseline: TextBaselineType,\n lineHeight: number,\n suffix: string = '',\n wordBreak: boolean,\n params?: {\n lineWidth?: number;\n suffixPosition?: 'start' | 'end' | 'middle';\n measureMode?: MeasureModeEnum;\n }\n ): LayoutType {\n const { lineWidth, suffixPosition = 'end', measureMode = MeasureModeEnum.actualBounding } = params ?? {};\n lines = lines.map(l => l.toString()) as string[];\n const linesLayout: LayoutItemType[] = [];\n // bbox高度可能大于totalHeight\n const bboxWH: vec2 = [0, 0];\n if (typeof lineWidth === 'number' && lineWidth !== Infinity) {\n // 直接使用lineWidth,并拆分字符串\n let width: number;\n for (let i = 0, len = lines.length; i < len; i++) {\n const metrics = this.textMeasure.measureTextPixelADscentAndWidth(\n lines[i] as string,\n this.textOptions,\n measureMode\n );\n width = Math.min(metrics.width, lineWidth);\n linesLayout.push({\n str:\n metrics.width <= lineWidth\n ? lines[i].toString()\n : this.textMeasure.clipTextWithSuffix(\n lines[i] as string,\n this.textOptions,\n width,\n suffix,\n wordBreak,\n suffixPosition\n ).str,\n width,\n ascent: metrics.ascent,\n descent: metrics.descent\n });\n }\n bboxWH[0] = lineWidth;\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 text = lines[i] as string;\n const metrics = this.textMeasure.measureTextPixelADscentAndWidth(\n lines[i] as string,\n this.textOptions,\n measureMode\n );\n width = metrics.width;\n _lineWidth = Math.max(_lineWidth, width);\n linesLayout.push({ str: text, width, ascent: metrics.ascent, descent: metrics.descent });\n }\n bboxWH[0] = _lineWidth;\n }\n bboxWH[1] = linesLayout.length * lineHeight;\n\n bboxWH[0] = linesLayout.reduce((a, b) => Math.max(a, b.width), 0);\n\n const bbox: TextLayoutBBox = {\n xOffset: 0,\n yOffset: 0,\n width: bboxWH[0],\n height: bboxWH[1]\n };\n\n this.LayoutBBox(bbox, textAlign, textBaseline, linesLayout);\n\n return this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);\n }\n\n /**\n * 给定了bbox,使用拆分好的每行字符串进行布局\n * @param bbox\n * @param lines\n * @param textAlign\n * @param textBaseline\n * @param lineHeight\n * @returns\n */\n layoutWithBBox(\n bbox: TextLayoutBBox,\n lines: LayoutItemType[],\n textAlign: TextAlignType,\n textBaseline: TextBaselineType,\n lineHeight: number\n ): LayoutType {\n const origin: vec2 = [0, 0];\n const totalLineHeight = lines.length * lineHeight; // 总高度\n // origin在y方向需要初始化,然后递增即可\n if (textBaseline === 'top') {\n // origin[1] = 0;\n } else if (textBaseline === 'middle') {\n origin[1] = (bbox.height - totalLineHeight) / 2;\n } else if (textBaseline === 'bottom') {\n origin[1] = bbox.height - totalLineHeight;\n }\n\n for (let i = 0; i < lines.length; i++) {\n this.lineOffset(bbox, lines[i], textAlign, textBaseline, lineHeight, origin);\n }\n\n return {\n bbox,\n lines,\n fontFamily: this.fontFamily,\n fontSize: this.textOptions.fontSize,\n fontWeight: this.textOptions.fontWeight,\n lineHeight,\n textAlign,\n textBaseline\n };\n }\n\n /**\n * 计算line在bbox中的位置,需要配合layoutWithBBox使用\n * @param bbox\n * @param line\n * @param textAlign\n * @param textBaseline\n * @param lineHeight\n * @param origin 这个line的左上角位置,会复用并修改\n */\n private lineOffset(\n bbox: TextLayoutBBox,\n line: LayoutItemType,\n textAlign: TextAlignType,\n textBaseline: TextBaselineType,\n lineHeight: number,\n origin: vec2\n ): LayoutItemType {\n if (textAlign === 'left' || textAlign === 'start') {\n line.leftOffset = 0;\n } else if (textAlign === 'center') {\n line.leftOffset = (bbox.width - line.width) / 2;\n } else if (textAlign === 'right' || textAlign === 'end') {\n line.leftOffset = bbox.width - line.width;\n }\n\n line.topOffset = lineHeight / 2 + (line.ascent - line.descent) / 2 + origin[1];\n\n const actualHeight = line.ascent + line.descent;\n const buf = 0;\n const actualHeightWithBuf = actualHeight + buf;\n if (actualHeightWithBuf < lineHeight - buf) {\n if (textBaseline === 'bottom') {\n line.topOffset += (lineHeight - actualHeightWithBuf) / 2;\n } else if (textBaseline === 'top') {\n line.topOffset -= (lineHeight - actualHeightWithBuf) / 2;\n }\n }\n origin[1] += lineHeight;\n\n return line;\n }\n}\n"]}
|
package/cjs/core/stage.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export declare class Stage extends Group implements IStage {
|
|
|
64
64
|
protected supportInteractiveLayer: boolean;
|
|
65
65
|
protected timeline: ITimeline;
|
|
66
66
|
params: Partial<IStageParams>;
|
|
67
|
+
protected tickedBeforeRender: boolean;
|
|
67
68
|
constructor(params?: Partial<IStageParams>);
|
|
68
69
|
pauseRender(sr?: number): void;
|
|
69
70
|
resumeRender(): void;
|
|
@@ -98,6 +99,7 @@ export declare class Stage extends Group implements IStage {
|
|
|
98
99
|
set3dOptions(options: IOption3D): void;
|
|
99
100
|
protected beforeRender: (stage: IStage) => void;
|
|
100
101
|
protected afterRender: (stage: IStage) => void;
|
|
102
|
+
protected afterTickCb: () => void;
|
|
101
103
|
setBeforeRender(cb: (stage: IStage) => void): void;
|
|
102
104
|
setAfterRender(cb: (stage: IStage) => void): void;
|
|
103
105
|
afterNextRender(cb: (stage: IStage) => void): void;
|
package/cjs/core/stage.js
CHANGED
|
@@ -78,7 +78,7 @@ class Stage extends group_1.Group {
|
|
|
78
78
|
}
|
|
79
79
|
constructor(params = {}) {
|
|
80
80
|
var _a;
|
|
81
|
-
super({}), this._onVisibleChange = visible => {
|
|
81
|
+
super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
|
|
82
82
|
if (!(this._skipRender < 0)) if (visible) {
|
|
83
83
|
if (this.dirtyBounds) {
|
|
84
84
|
const b = this.window.getViewBox();
|
|
@@ -90,7 +90,10 @@ class Stage extends group_1.Group {
|
|
|
90
90
|
this._beforeRender && this._beforeRender(stage);
|
|
91
91
|
}, this.afterRender = stage => {
|
|
92
92
|
this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach((cb => cb(stage))),
|
|
93
|
-
this._afterNextRenderCbs = null;
|
|
93
|
+
this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
|
|
94
|
+
}, this.afterTickCb = () => {
|
|
95
|
+
var _a;
|
|
96
|
+
this.tickedBeforeRender = !0, "performance" === (null === (_a = this.params.optimize) || void 0 === _a ? void 0 : _a.tickRenderMode) || "rendering" !== this.state && this.render();
|
|
94
97
|
}, this.params = params, this.theme = new theme_1.Theme, this.hooks = {
|
|
95
98
|
beforeRender: new tapable_1.SyncHook([ "stage" ]),
|
|
96
99
|
afterRender: new tapable_1.SyncHook([ "stage" ])
|
|
@@ -121,7 +124,7 @@ class Stage extends group_1.Group {
|
|
|
121
124
|
this.timeline.pause(), params.optimize || (params.optimize = {}), this.optmize(params.optimize),
|
|
122
125
|
params.background && (0, vutils_1.isString)(this._background) && this._background.includes("/") && this.setAttributes({
|
|
123
126
|
background: this._background
|
|
124
|
-
});
|
|
127
|
+
}), this.ticker.on("afterTick", this.afterTickCb);
|
|
125
128
|
}
|
|
126
129
|
pauseRender(sr = -1) {
|
|
127
130
|
this._skipRender = sr;
|
|
@@ -327,7 +330,8 @@ class Stage extends group_1.Group {
|
|
|
327
330
|
if ("released" === this.releaseStatus) return;
|
|
328
331
|
this.ticker.start(), this.timeline.resume();
|
|
329
332
|
const state = this.state;
|
|
330
|
-
this.state = "rendering", this.
|
|
333
|
+
this.state = "rendering", this.tickedBeforeRender || this.ticker.trySyncTickStatus(),
|
|
334
|
+
this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params,
|
|
331
335
|
this.hooks.beforeRender.call(this), this._skipRender || (this.renderLayerList(this.children),
|
|
332
336
|
this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear()), this.hooks.afterRender.call(this)),
|
|
333
337
|
this.state = state, this._skipRender && this._skipRender++;
|
|
@@ -444,7 +448,7 @@ class Stage extends group_1.Group {
|
|
|
444
448
|
})), this.interactiveLayer && (this.interactiveLayer.forEachChildren((item => {
|
|
445
449
|
item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
|
|
446
450
|
})), this.interactiveLayer.release()), this.window.release(), this.ticker.remTimeline(this.timeline),
|
|
447
|
-
this.renderService.renderTreeRoots = [];
|
|
451
|
+
this.ticker.removeListener("afterTick", this.afterTickCb), this.renderService.renderTreeRoots = [];
|
|
448
452
|
}
|
|
449
453
|
setStage(stage) {}
|
|
450
454
|
dirty(b, matrix) {
|
package/cjs/core/stage.js.map
CHANGED
|
@@ -1 +1 @@
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D,sBAygCC","file":"stage.js","sourcesContent":["import type { IAABBBounds, IBounds, IBoundsLike, IMatrix } from '@visactor/vutils';\nimport { Bounds, Point, isString } from '@visactor/vutils';\nimport type {\n IGraphic,\n IExportType,\n IStage,\n IStageParams,\n ILayer,\n IColor,\n IGlobal,\n IOption3D,\n ICamera,\n vec3,\n IDirectionLight,\n ITicker,\n IRenderService,\n IPickerService,\n IPluginService,\n ISyncHook,\n IDrawContext,\n IWindow,\n ILayerService,\n ITimeline,\n IOptimizeType,\n LayerMode,\n PickResult,\n IPlugin\n} from '../interface';\nimport { VWindow } from './window';\nimport type { Layer } from './layer';\nimport { EventSystem } from '../event';\nimport { container } from '../container';\nimport { RenderService } from '../render';\nimport { Group } from '../graphic/group';\nimport { Theme } from '../graphic/theme';\nimport { PickerService } from '../picker/constants';\nimport { PluginService } from '../plugins/constants';\nimport { AutoRenderPlugin } from '../plugins/builtin-plugin/auto-render-plugin';\nimport { AutoRefreshPlugin } from '../plugins/builtin-plugin/auto-refresh-plugin';\nimport { IncrementalAutoRenderPlugin } from '../plugins/builtin-plugin/incremental-auto-render-plugin';\nimport { DirtyBoundsPlugin } from '../plugins/builtin-plugin/dirty-bounds-plugin';\nimport { defaultTicker } from '../animate/default-ticker';\nimport { SyncHook } from '../tapable';\nimport { LayerService } from './constants';\nimport { DefaultTimeline } from '../animate';\nimport { application } from '../application';\nimport { isBrowserEnv } from '../env-check';\nimport { Factory } from '../factory';\n\nconst DefaultConfig = {\n WIDTH: 500,\n HEIGHT: 500,\n X: 0,\n Y: 0,\n BACKGROUND: 'white'\n};\n\ntype IStageState = 'rendering' | 'normal';\n\n/**\n * Stage是一个舞台或一个视口,并不直接对应一个或多个Canvas,逻辑上和Canvas无关\n *\n * 1. Stage对应一个Canvas的整体,Stage的宽高即为Canvas的宽高\n * 2. Stage小于Canvas,Stage作为Canvas某个区域的视口,只管理这个区域\n * 3. 多图层时Stage的多个图层对应多个Canvas\n *\n * 原生环境下Stage可以拥有一个Window或者使用Window的一块区域\n *\n * 【注】如果希望获取完整的Canvas或窗口或者调整窗口信息,请使用Window模块\n */\nexport class Stage extends Group implements IStage {\n declare parent: IStage | null;\n\n declare state: IStageState;\n\n private _background: string | IColor;\n protected nextFrameRenderLayerSet: Set<Layer>;\n protected willNextFrameRender: boolean;\n protected _cursor: string;\n renderCount: number;\n dirtyBounds: IBounds | null;\n option3d?: IOption3D;\n declare light?: IDirectionLight;\n declare camera?: ICamera;\n declare renderStyle?: string;\n\n declare hooks: {\n beforeRender: ISyncHook<[IStage]>;\n afterRender: ISyncHook<[IStage]>;\n };\n\n set viewBox(b: IBoundsLike) {\n this.window.setViewBox(b);\n }\n get viewBox(): IAABBBounds {\n return this.window.getViewBox();\n }\n\n /**\n * @deprecated 不建议使用\n */\n get x(): number {\n return this.window.getViewBox().x1;\n }\n /**\n * @deprecated 不建议使用\n */\n set x(x: number) {\n const b = this.window.getViewBox();\n b.translate(x - b.x1, 0);\n this.window.setViewBox(b);\n }\n /**\n * @deprecated 不建议使用\n */\n get y(): number {\n return this.window.getViewBox().y1;\n }\n /**\n * @deprecated 不建议使用\n */\n set y(y: number) {\n const b = this.window.getViewBox();\n b.translate(0, y - b.y1);\n this.window.setViewBox(b);\n }\n get width(): number {\n return this.window.width;\n }\n set width(w: number) {\n this.resize(w, this.height);\n }\n get viewWidth(): number {\n return this.window.getViewBox().width();\n }\n set viewWidth(w: number) {\n this.resizeView(w, this.viewHeight);\n }\n get viewHeight(): number {\n return this.window.getViewBox().height();\n }\n set viewHeight(h: number) {\n this.resizeView(this.viewWidth, h);\n }\n get height(): number {\n return this.window.height;\n }\n set height(h: number) {\n this.resize(this.width, h);\n }\n get dpr(): number {\n return this.window.dpr;\n }\n set dpr(r: number) {\n this.setDpr(r);\n }\n get background(): string | IColor {\n return this._background ?? DefaultConfig.BACKGROUND;\n }\n set background(b: string | IColor) {\n this._background = b;\n }\n get defaultLayer(): ILayer {\n return this.at(0) as unknown as ILayer;\n }\n\n ticker: ITicker;\n\n autoRender: boolean;\n autoRefresh: boolean;\n _enableLayout: boolean;\n htmlAttribute: boolean | string | any;\n reactAttribute: boolean | string | any;\n increaseAutoRender: boolean;\n view3dTranform: boolean;\n readonly window: IWindow;\n private readonly global: IGlobal;\n readonly renderService: IRenderService;\n protected pickerService?: IPickerService;\n readonly pluginService: IPluginService;\n readonly layerService: ILayerService;\n private _eventSystem?: EventSystem;\n private get eventSystem(): EventSystem {\n return this._eventSystem;\n }\n\n protected _beforeRender?: (stage: IStage) => void;\n protected _afterRender?: (stage: IStage) => void;\n // 0: 正常渲染, > 0: 跳过隐藏canvas的渲染, < 0: 禁止渲染\n protected _skipRender?: number;\n protected _afterNextRenderCbs?: ((stage: IStage) => void)[];\n protected lastRenderparams?: Partial<IDrawContext>;\n\n protected interactiveLayer?: ILayer;\n protected supportInteractiveLayer: boolean;\n protected timeline: ITimeline;\n\n declare params: Partial<IStageParams>;\n\n /**\n * 所有属性都具有默认值。\n * Canvas为字符串或者Canvas元素,那么默认图层就会绑定到这个Canvas上\n * 如果不传入Canvas,那么会新建一个Canvas,用户可以通过Window模块管理这个Canvas\n * 1. 如果没有传入宽高,那么默认为canvas宽高,如果传入了宽高则stage使用传入宽高作为视口宽高\n * @param params\n */\n constructor(params: Partial<IStageParams> = {}) {\n super({});\n this.params = params;\n this.theme = new Theme();\n this.hooks = {\n beforeRender: new SyncHook(['stage']),\n afterRender: new SyncHook(['stage'])\n };\n this.global = application.global;\n if (!this.global.env && isBrowserEnv()) {\n // 如果是浏览器环境,默认设置env\n this.global.setEnv('browser');\n }\n this.window = container.get<IWindow>(VWindow);\n this.renderService = container.get<IRenderService>(RenderService);\n this.pluginService = container.get<IPluginService>(PluginService);\n this.layerService = container.get<ILayerService>(LayerService);\n this.pluginService.active(this, params);\n\n this.window.create({\n width: params.width,\n height: params.height,\n viewBox: params.viewBox,\n container: params.container,\n dpr: params.dpr || this.global.devicePixelRatio,\n canvasControled: params.canvasControled !== false,\n title: params.title || '',\n canvas: params.canvas\n });\n\n this.state = 'normal';\n this.renderCount = 0;\n this.tryInitEventSystem();\n // // 没有传入xy就默认为0\n // this._x = params.x ?? DefaultConfig.X;\n // this._y = params.y ?? DefaultConfig.Y;\n // // 没有传入view的宽高则默认为window的宽高\n // this._viewWidth = params.viewWidth ?? this.window.width;\n // this._viewHeight = params.viewHeight ?? this.window.height;\n // this._AABBBounds.set(this._x, this._y, this._viewWidth + this._x, this._viewHeight + this._y);\n // 背景色默认为纯白色\n this._background = params.background ?? DefaultConfig.BACKGROUND;\n\n // 创建一个默认layer图层\n // this.appendChild(new Layer(this, this.global, this.window, { main: true }));\n this.appendChild(this.layerService.createLayer(this, { main: true }));\n\n this.nextFrameRenderLayerSet = new Set();\n this.willNextFrameRender = false;\n this.stage = this;\n this.renderStyle = params.renderStyle;\n\n // this.autoRender = params.autoRender;\n if (params.autoRender) {\n this.enableAutoRender();\n }\n if (params.autoRefresh) {\n this.enableAutoRefresh();\n }\n // 默认不开启dirtyBounds\n if (params.disableDirtyBounds === false) {\n this.enableDirtyBounds();\n }\n\n if (params.enableHtmlAttribute) {\n this.enableHtmlAttribute(params.enableHtmlAttribute);\n }\n if (params.ReactDOM) {\n this.enableReactAttribute(params.ReactDOM);\n }\n\n params.enableLayout && this.enableLayout();\n this.hooks.beforeRender.tap('constructor', this.beforeRender);\n this.hooks.afterRender.tap('constructor', this.afterRender);\n this._beforeRender = params.beforeRender;\n this._afterRender = params.afterRender;\n this.ticker = params.ticker || defaultTicker;\n this.supportInteractiveLayer = params.interactiveLayer !== false;\n this.timeline = new DefaultTimeline();\n this.ticker.addTimeline(this.timeline);\n this.timeline.pause();\n if (!params.optimize) {\n params.optimize = {};\n }\n this.optmize(params.optimize);\n // 如果背景是图片,触发加载图片操作\n if (params.background && isString(this._background) && this._background.includes('/')) {\n this.setAttributes({ background: this._background });\n }\n }\n\n pauseRender(sr: number = -1) {\n this._skipRender = sr;\n }\n\n resumeRender() {\n this._skipRender = 0;\n }\n\n protected tryInitEventSystem() {\n if (this.global.supportEvent && !this._eventSystem) {\n this._eventSystem = new EventSystem({\n targetElement: this.window,\n resolution: this.window.dpr || this.global.devicePixelRatio,\n rootNode: this as any,\n global: this.global,\n supportsPointerEvents: this.params.supportsPointerEvents,\n supportsTouchEvents: this.params.supportsTouchEvents,\n ...this.params.event\n });\n }\n }\n\n preventRender(prevent: boolean) {\n if (prevent) {\n this._skipRender = -Infinity;\n } else {\n // 判断是否需要outRange优化\n if (this.params.optimize.skipRenderWithOutRange !== false) {\n this._skipRender = this.window.isVisible() ? 0 : 1;\n } else {\n this._skipRender = 0;\n }\n }\n }\n\n // 优化策略\n optmize(params: IOptimizeType) {\n this.optmizeRender(params.skipRenderWithOutRange);\n this.params.optimize = params;\n }\n\n // 优化渲染\n protected optmizeRender(skipRenderWithOutRange: boolean = false) {\n if (!skipRenderWithOutRange) {\n return;\n }\n // 不在视口内的时候,跳过渲染\n this._skipRender = this._skipRender < 0 ? this._skipRender : this.window.isVisible() ? 0 : 1;\n this.window.onVisibleChange(this._onVisibleChange);\n }\n\n protected _onVisibleChange = (visible: boolean) => {\n if (this._skipRender < 0) {\n return;\n }\n if (visible) {\n if (this.dirtyBounds) {\n const b = this.window.getViewBox();\n this.dirtyBounds.setValue(b.x1, b.y1, b.width(), b.height());\n }\n if (this._skipRender > 1) {\n this.renderNextFrame();\n }\n this._skipRender = 0;\n } else {\n this._skipRender = 1;\n }\n };\n\n getTimeline() {\n return this.timeline;\n }\n\n get3dOptions(options: IOption3D) {\n const {\n center = { x: this.width / 2, y: this.height / 2, z: 0, dx: 0, dy: 0, dz: 0 },\n light = {},\n alpha = 0,\n beta = 0,\n camera,\n fieldRatio = 1,\n fieldDepth\n } = options;\n\n return {\n ...options,\n center,\n light,\n alpha,\n beta,\n camera,\n fieldRatio,\n fieldDepth\n };\n }\n\n set3dOptions(options: IOption3D) {\n this.option3d = options;\n const options3d = this.get3dOptions(options);\n const { light, center, camera, alpha, beta, fieldRatio, fieldDepth } = options3d;\n const { dir = [1, 1, -1], color = 'white', ambient } = light;\n\n const centerX = (center.x ?? this.width / 2) + (center.dx ?? 0);\n const centerY = (center.y ?? this.height / 2) + (center.dy ?? 0);\n const centerZ = (center.z ?? 0) + (center.dz ?? 0);\n const centerVec3: vec3 = [centerX, centerY, centerZ];\n const z = 1;\n let cameraX = 0;\n let cameraY = 0;\n let cameraZ = 0;\n if (!camera) {\n cameraX = Math.sin(alpha) + centerX;\n cameraY = Math.sin(beta) + centerY;\n cameraZ = Math.cos(alpha) * Math.cos(beta) * z;\n }\n\n const DirectionalLight = Factory.getPlugin('DirectionalLight');\n\n if (DirectionalLight) {\n this.light = new DirectionalLight(dir, color, ambient);\n }\n const cameraParams = {\n left: 0,\n right: this.width,\n top: 0,\n bottom: this.height,\n fieldRatio: fieldRatio,\n fieldDepth,\n viewParams: {\n pos: [cameraX, cameraY, cameraZ] as vec3,\n center: centerVec3,\n up: [0, 1, 0] as vec3\n }\n };\n if (this.camera) {\n this.camera.params = cameraParams;\n } else {\n const OrthoCamera = Factory.getPlugin('OrthoCamera');\n if (OrthoCamera) {\n this.camera = new OrthoCamera(cameraParams);\n }\n }\n\n if (options.enableView3dTransform) {\n this.enableView3dTransform();\n }\n }\n\n protected beforeRender = (stage: IStage) => {\n this._beforeRender && this._beforeRender(stage);\n };\n\n protected afterRender = (stage: IStage) => {\n this.renderCount++;\n this._afterRender && this._afterRender(stage);\n this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage));\n this._afterNextRenderCbs = null;\n };\n\n setBeforeRender(cb: (stage: IStage) => void) {\n this._beforeRender = cb;\n }\n\n setAfterRender(cb: (stage: IStage) => void) {\n this._afterRender = cb;\n }\n\n afterNextRender(cb: (stage: IStage) => void) {\n if (!this._afterNextRenderCbs) {\n this._afterNextRenderCbs = [];\n }\n this._afterNextRenderCbs.push(cb);\n }\n\n enableView3dTransform() {\n if (this.view3dTranform) {\n return;\n }\n this.view3dTranform = true;\n const ViewTransform3dPlugin = Factory.getPlugin('ViewTransform3dPlugin');\n\n if (ViewTransform3dPlugin) {\n this.pluginService.register(new ViewTransform3dPlugin());\n }\n }\n\n disableView3dTranform() {\n if (!this.view3dTranform) {\n return;\n }\n this.view3dTranform = false;\n this.pluginService.findPluginsByName('ViewTransform3dPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n\n enableAutoRender() {\n if (this.autoRender) {\n return;\n }\n this.autoRender = true;\n this.pluginService.register(new AutoRenderPlugin());\n }\n disableAutoRender() {\n if (!this.autoRender) {\n return;\n }\n this.autoRender = false;\n this.pluginService.findPluginsByName('AutoRenderPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableAutoRefresh() {\n if (this.autoRefresh) {\n return;\n }\n this.autoRefresh = true;\n this.pluginService.register(new AutoRefreshPlugin());\n }\n disableAutoRefresh() {\n if (!this.autoRefresh) {\n return;\n }\n this.autoRefresh = false;\n this.pluginService.findPluginsByName('AutoRefreshPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableIncrementalAutoRender() {\n if (this.increaseAutoRender) {\n return;\n }\n this.increaseAutoRender = true;\n this.pluginService.register(new IncrementalAutoRenderPlugin());\n }\n disableIncrementalAutoRender() {\n if (!this.increaseAutoRender) {\n return;\n }\n this.increaseAutoRender = false;\n this.pluginService.findPluginsByName('IncrementalAutoRenderPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableDirtyBounds() {\n if (this.dirtyBounds) {\n return;\n }\n this.dirtyBounds = new Bounds();\n let plugin = this.pluginService.findPluginsByName('DirtyBoundsPlugin')[0];\n if (!plugin) {\n plugin = new DirtyBoundsPlugin();\n this.pluginService.register(plugin);\n } else {\n plugin.activate(this.pluginService);\n }\n }\n disableDirtyBounds() {\n if (!this.dirtyBounds) {\n return;\n }\n this.dirtyBounds = null;\n this.pluginService.findPluginsByName('DirtyBoundsPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableLayout() {\n if (this._enableLayout) {\n return;\n }\n this._enableLayout = true;\n\n const FlexLayoutPlugin = Factory.getPlugin('FlexLayoutPlugin');\n\n if (FlexLayoutPlugin) {\n this.pluginService.register(new FlexLayoutPlugin());\n }\n }\n disableLayout() {\n if (!this._enableLayout) {\n return;\n }\n this._enableLayout = false;\n this.pluginService.findPluginsByName('FlexLayoutPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableHtmlAttribute(container?: any) {\n if (this.htmlAttribute) {\n return;\n }\n const HtmlAttributePlugin = Factory.getPlugin('HtmlAttributePlugin');\n\n if (HtmlAttributePlugin) {\n this.htmlAttribute = container;\n this.pluginService.register(new HtmlAttributePlugin());\n }\n }\n disableHtmlAttribute() {\n if (!this.htmlAttribute) {\n return;\n }\n this.htmlAttribute = false;\n this.pluginService.findPluginsByName('HtmlAttributePlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableReactAttribute(container?: any) {\n if (this.reactAttribute) {\n return;\n }\n const ReactAttributePlugin = Factory.getPlugin('ReactAttributePlugin');\n\n if (ReactAttributePlugin) {\n this.reactAttribute = container;\n this.pluginService.register(new ReactAttributePlugin());\n }\n }\n disableReactAttribute() {\n if (!this.reactAttribute) {\n return;\n }\n this.reactAttribute = false;\n this.pluginService.findPluginsByName('ReactAttributePlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n\n getPluginsByName(name: string): IPlugin[] {\n return this.pluginService.findPluginsByName(name);\n }\n\n // /**\n // * stage的appendChild,add\n // * @param node\n // * @returns\n // */\n // appendChild<T extends Node>(node: T): T | null {\n // const layer = this.at(0);\n // if (!layer) {\n // return null;\n // }\n // return layer.appendChild<T>(node);\n // }\n\n protected tryUpdateAABBBounds(): IAABBBounds {\n const viewBox = this.window.getViewBox();\n this._AABBBounds.setValue(viewBox.x1, viewBox.y1, viewBox.x2, viewBox.y2);\n return this._AABBBounds;\n }\n\n combineLayer(ILayer1: ILayer, ILayer2: ILayer): ILayer {\n throw new Error('暂不支持');\n }\n // 如果传入CanvasId,如果存在相同Id,说明这两个图层使用相同的Canvas绘制\n // 但需要注意的是依然是两个图层(用于解决Table嵌入ChartSpace不影响Table的绘制)\n createLayer(canvasId?: string, layerMode?: LayerMode): ILayer {\n if (this.releaseStatus === 'released') {\n return;\n }\n // 创建一个默认layer图层\n const layer = this.layerService.createLayer(this, {\n main: false,\n layerMode,\n canvasId\n });\n this.appendChild(layer);\n return layer;\n // const layer = new Layer(this, this.global, this.window, {\n // main: false,\n // canvasId\n // });\n // this.appendChild(layer);\n // return layer;\n }\n sortLayer(cb: (ILayer1: ILayer, layer2: ILayer) => number): void {\n const children = this.children;\n children.sort(cb);\n this.removeAllChild();\n children.forEach(c => {\n this.appendChild(c);\n });\n }\n removeLayer(ILayerId: number): ILayer | false {\n return this.removeChild(this.findChildByUid(ILayerId) as IGraphic) as ILayer;\n }\n tryInitInteractiveLayer() {\n if (this.releaseStatus === 'released') {\n return;\n }\n // TODO:顺序可能会存在问题\n // 支持交互层,且没有创建过,那就创建\n if (this.supportInteractiveLayer && !this.interactiveLayer) {\n this.interactiveLayer = this.createLayer();\n this.interactiveLayer.name = '_builtin_interactive';\n this.interactiveLayer.attribute.pickable = false;\n this.nextFrameRenderLayerSet.add(this.interactiveLayer as any); // to be fixed\n }\n // this.interactiveLayer.afterDraw(l => {\n // l.removeAllChild();\n // });\n }\n\n clearViewBox(color?: string) {\n this.window.clearViewBox(color);\n }\n\n render(layers?: ILayer[], params?: Partial<IDrawContext>): void {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.ticker.start();\n this.timeline.resume();\n const state = this.state;\n this.state = 'rendering';\n this.layerService.prepareStageLayer(this);\n if (!this._skipRender) {\n this.lastRenderparams = params;\n this.hooks.beforeRender.call(this);\n if (!this._skipRender) {\n this.renderLayerList(this.children as ILayer[]);\n this.combineLayersToWindow();\n this.nextFrameRenderLayerSet.clear();\n }\n this.hooks.afterRender.call(this);\n }\n this.state = state;\n this._skipRender && this._skipRender++;\n }\n\n protected combineLayersToWindow() {\n // TODO 后续支持通用的渲染模型\n if (this.global.env === 'harmony') {\n const ctx = this.window.getContext().nativeContext;\n this.forEachChildren<ILayer>((layer, i) => {\n if (i > 0) {\n const image = layer\n .getNativeHandler()\n .getContext()\n .canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();\n ctx.transferFromImageBitmap(image);\n }\n });\n }\n return;\n // this.forEach<ILayer>((layer, i) => {\n // layer.combineTo(this.window, {\n // clear: i === 0,\n // x: this.x,\n // y: this.y,\n // width: this.viewWidth,\n // height: this.viewHeight,\n // renderService: this.renderService,\n // background: layer === this.defaultLayer ? this.background : undefined,\n // updateBounds: !!this.dirtyBounds\n // });\n // });\n }\n\n renderNextFrame(layers?: ILayer[], force?: boolean): void {\n // render状态中调用的不会触发nextFrame,避免loop\n // if (this.state === 'rendering' && !force) {\n // console.log('abc');\n // return;\n // }\n // 性能优化,避免重复add\n if (this.nextFrameRenderLayerSet.size !== this.childrenCount) {\n (layers || this).forEach<ILayer>((layer: any) => {\n this.nextFrameRenderLayerSet.add(layer);\n });\n }\n if (!this.willNextFrameRender) {\n this.willNextFrameRender = true;\n this.global.getRequestAnimationFrame()(() => {\n this._doRenderInThisFrame(), (this.willNextFrameRender = false);\n });\n }\n }\n\n _doRenderInThisFrame() {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.timeline.resume();\n this.ticker.start();\n const state = this.state;\n this.state = 'rendering';\n this.layerService.prepareStageLayer(this);\n if (this.nextFrameRenderLayerSet.size && !this._skipRender) {\n this.hooks.beforeRender.call(this);\n if (!this._skipRender) {\n this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()), this.lastRenderparams || {});\n this.combineLayersToWindow();\n this.nextFrameRenderLayerSet.clear();\n }\n this.hooks.afterRender.call(this);\n }\n this.state = state;\n this._skipRender && this._skipRender++;\n }\n\n protected renderLayerList(layerList: ILayer[], params?: Partial<IDrawContext>) {\n const list: ILayer[] = [];\n // 只需要render main layer即可\n for (let i = 0; i < layerList.length; i++) {\n let l = layerList[i];\n if (l.layerMode === 'virtual') {\n l = l.getNativeHandler().mainHandler.layer;\n }\n if (!list.includes(l)) {\n list.push(l);\n }\n }\n list.forEach(layer => {\n // 记录当前的stamp,避免重复绘制layer(如果存在virtual layer)\n if (layer.renderCount > this.renderCount) {\n return;\n }\n layer.renderCount = this.renderCount + 1;\n\n if (layer === this.interactiveLayer) {\n // 交互层由于其特殊性,不使用dirtyBounds\n this.dirtyBounds && this.dirtyBounds.clear();\n }\n layer.render(\n {\n renderService: this.renderService,\n background: layer === this.defaultLayer ? this.background : undefined,\n updateBounds: !!(this.dirtyBounds && !this.dirtyBounds.empty()),\n viewBox: this.window.getViewBox(),\n transMatrix: this.window.getViewBoxTransform()\n },\n { renderStyle: this.renderStyle, ...params }\n );\n });\n\n // 添加交互层渲染\n if (this.interactiveLayer && !layerList.includes(this.interactiveLayer)) {\n // 交互层由于其特殊性,不使用dirtyBounds\n this.dirtyBounds && this.dirtyBounds.clear();\n this.interactiveLayer.render(\n {\n renderService: this.renderService,\n updateBounds: !!(this.dirtyBounds && !this.dirtyBounds.empty()),\n viewBox: this.window.getViewBox(),\n transMatrix: this.window.getViewBoxTransform()\n },\n { renderStyle: this.renderStyle, ...params }\n );\n }\n }\n\n resizeWindow(w: number, h: number, rerender: boolean = true) {\n this.window.resize(w, h);\n rerender && this.render();\n }\n\n /**\n * 语法糖,如果viewBox和window宽高一样的话,那么会同时缩放window和viewBox\n * @param w\n * @param h\n * @param rerender\n */\n resize(w: number, h: number, rerender: boolean = true): void {\n if (this.releaseStatus === 'released') {\n return;\n }\n // 如果不是子图的stage,那么认为用户也想要resize view\n if (!this.window.hasSubView()) {\n this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h);\n }\n this.window.resize(w, h);\n this.forEachChildren<ILayer>(c => {\n c.resize(w, h);\n });\n // 设置camera\n // this.camera && (this.camera.params = { ...this.camera.params, right: this.width, bottom: this.height });\n this.camera && this.option3d && this.set3dOptions(this.option3d);\n rerender && this.render();\n }\n resizeView(w: number, h: number, rerender: boolean = true) {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h);\n this.forEachChildren<ILayer>(c => {\n c.resizeView(w, h);\n });\n // 设置camera\n this.camera && (this.camera.params = { ...this.camera.params, right: this.width, bottom: this.height });\n rerender && this.render();\n }\n setViewBox(viewBox: IBoundsLike, rerender: boolean): void;\n setViewBox(x: number, y: number, w: number, h: number, rerender: boolean): void;\n setViewBox(x: number | IBoundsLike, y: number | boolean, w?: number, h?: number, rerender?: boolean): void {\n let isRerender: boolean = true;\n\n if (typeof x === 'object') {\n this.viewBox.setValue(x.x1, x.y1, x.x2, x.y2);\n if (y === false) {\n isRerender = false;\n }\n } else {\n this.viewBox.setValue(x, y as number, x + w, (y as number) + h);\n\n if (rerender === false) {\n isRerender = false;\n }\n }\n\n this.forEachChildren<ILayer>(c => {\n c.resizeView(this.viewBox.width(), this.viewBox.height());\n });\n isRerender && this.render();\n }\n setDpr(dpr: number, rerender: boolean = true): void {\n // this.window.setDpr(dpr);\n this.forEachChildren<ILayer>(c => {\n c.setDpr(dpr);\n });\n\n rerender && this.render();\n }\n setOrigin(x: number, y: number): void {\n throw new Error('暂不支持');\n }\n export(type: IExportType): HTMLCanvasElement | ImageData {\n throw new Error('暂不支持');\n }\n pick(x: number, y: number): PickResult | false {\n if (this.releaseStatus === 'released') {\n return;\n }\n // 暂时不提供layer的pick\n const result = this.getPickerService().pick(this.children as unknown as IGraphic[], new Point(x, y), {\n bounds: this.AABBBounds\n });\n if (result?.graphic || result?.group) {\n return result;\n }\n return false;\n }\n\n // 动画相关\n startAnimate(t: number): void {\n throw new Error('暂不支持');\n }\n setToFrame(t: number): void {\n throw new Error('暂不支持');\n }\n\n release() {\n super.release();\n\n this.hooks.beforeRender.unTap('constructor', this.beforeRender);\n this.hooks.afterRender.unTap('constructor', this.afterRender);\n\n this.eventSystem && this.eventSystem.release();\n this.layerService.releaseStage(this);\n this.pluginService.release();\n this.forEach(layer => {\n layer.release();\n });\n // 额外删除掉interactiveLayer的节点\n if (this.interactiveLayer) {\n this.interactiveLayer.forEachChildren((item: IGraphic) => {\n item.setStage && item.setStage(null, null);\n this.interactiveLayer.removeChild(item);\n });\n this.interactiveLayer.release();\n }\n this.window.release();\n this.ticker.remTimeline(this.timeline);\n this.renderService.renderTreeRoots = [];\n }\n\n setStage(stage?: IStage) {\n return;\n // this.stage = this;\n // this.forEachChildren(item => {\n // (item as Layer).setStage(this);\n // });\n }\n\n /**\n * 添加dirty区域,会修改参数b\n * @param b\n * @param matrix\n */\n dirty(b: IBounds, matrix?: IMatrix) {\n if (this.releaseStatus === 'released') {\n return;\n }\n if (matrix) {\n b.transformWithMatrix(matrix);\n }\n if (this.dirtyBounds.empty()) {\n this.dirtyBounds.setValue(b.x1, b.y1, b.x2, b.y2);\n }\n this.dirtyBounds.union(b);\n }\n\n getLayer(name: string): undefined | ILayer {\n const layer = this.children.filter(layer => layer.name === name);\n return layer[0] as ILayer;\n }\n\n renderTo(window: IWindow) {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.forEachChildren<ILayer>((layer, i) => {\n layer.drawTo(window, {\n // ...params,\n renderService: this.renderService,\n viewBox: window.getViewBox(),\n transMatrix: window.getViewBoxTransform(),\n background: layer === this.defaultLayer ? this.background : undefined,\n clear: i === 0, // 第一个layer需要clear\n updateBounds: !!(this.dirtyBounds && !this.dirtyBounds.empty())\n });\n });\n }\n\n /**\n * 渲染到新的window上去\n * @param fullImage 是否是全量的image,因为可能之前的window有一部分场景树超过window的帧缓冲了\n * @returns\n */\n renderToNewWindow(fullImage: boolean = true, viewBox?: IAABBBounds): IWindow {\n if (this.releaseStatus === 'released') {\n return;\n }\n const window = container.get<IWindow>(VWindow);\n const x1 = viewBox ? -viewBox.x1 : 0;\n const y1 = viewBox ? -viewBox.y1 : 0;\n const x2 = viewBox ? viewBox.x2 : this.viewWidth;\n const y2 = viewBox ? viewBox.y2 : this.viewHeight;\n const width = viewBox ? viewBox.width() : this.viewWidth;\n const height = viewBox ? viewBox.height() : this.viewHeight;\n if (fullImage) {\n window.create({\n viewBox: { x1, y1, x2, y2 },\n width,\n height,\n dpr: this.window.dpr,\n canvasControled: true,\n offscreen: true,\n title: ''\n });\n } else {\n window.create({\n viewBox: { x1, y1, x2, y2 },\n width,\n height,\n dpr: this.window.dpr,\n canvasControled: true,\n offscreen: true,\n title: ''\n });\n }\n\n this.renderTo(window);\n return window;\n }\n\n toCanvas(fullImage: boolean = true, viewBox?: IAABBBounds): HTMLCanvasElement | null {\n if (this.releaseStatus === 'released') {\n return;\n }\n const window = this.renderToNewWindow(fullImage, viewBox);\n const c = window.getNativeHandler();\n if (c.nativeCanvas) {\n return c.nativeCanvas;\n }\n return null;\n }\n\n setCursor(mode?: string): void {\n this._cursor = mode;\n this.eventSystem.setCursor(mode, 'ignore');\n }\n\n getCursor() {\n return this._cursor;\n }\n\n eventPointTransform(e: PointerEvent | WheelEvent | TouchEvent): { x: number; y: number } {\n const point = this.global.mapToCanvasPoint(e, this.window.getContext().canvas.nativeCanvas);\n\n return this.stage.window.pointTransform(point.x, point.y);\n }\n\n pauseTriggerEvent() {\n this._eventSystem && this._eventSystem.pauseTriggerEvent();\n }\n resumeTriggerEvent() {\n this._eventSystem && this._eventSystem.resumeTriggerEvent();\n }\n\n getPickerService() {\n if (!this.pickerService) {\n this.pickerService = container.get<IPickerService>(PickerService);\n }\n return this.pickerService;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/stage.ts"],"names":[],"mappings":";;;AACA,6CAA2D;AA2B3D,qCAAmC;AAEnC,oCAAuC;AACvC,4CAAyC;AACzC,sCAA0C;AAC1C,4CAAyC;AACzC,4CAAyC;AACzC,mDAAoD;AACpD,oDAAqD;AACrD,qFAAgF;AAChF,uFAAkF;AAClF,6GAAuG;AACvG,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BAAiB;QACf,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAE,CAAC;IAC7D,CAAC;IACD,kBAAkB;QAChB,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,CAAC;IAC9D,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACvB,IAAI,CAAC,aAAa,GAAG,qBAAS,CAAC,GAAG,CAAiB,yBAAa,CAAC,CAAC;SACnE;QACD,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;CACF;AA/hCD,sBA+hCC","file":"stage.js","sourcesContent":["import type { IAABBBounds, IBounds, IBoundsLike, IMatrix } from '@visactor/vutils';\nimport { Bounds, Point, isString } from '@visactor/vutils';\nimport type {\n IGraphic,\n IExportType,\n IStage,\n IStageParams,\n ILayer,\n IColor,\n IGlobal,\n IOption3D,\n ICamera,\n vec3,\n IDirectionLight,\n ITicker,\n IRenderService,\n IPickerService,\n IPluginService,\n ISyncHook,\n IDrawContext,\n IWindow,\n ILayerService,\n ITimeline,\n IOptimizeType,\n LayerMode,\n PickResult,\n IPlugin\n} from '../interface';\nimport { VWindow } from './window';\nimport type { Layer } from './layer';\nimport { EventSystem } from '../event';\nimport { container } from '../container';\nimport { RenderService } from '../render';\nimport { Group } from '../graphic/group';\nimport { Theme } from '../graphic/theme';\nimport { PickerService } from '../picker/constants';\nimport { PluginService } from '../plugins/constants';\nimport { AutoRenderPlugin } from '../plugins/builtin-plugin/auto-render-plugin';\nimport { AutoRefreshPlugin } from '../plugins/builtin-plugin/auto-refresh-plugin';\nimport { IncrementalAutoRenderPlugin } from '../plugins/builtin-plugin/incremental-auto-render-plugin';\nimport { DirtyBoundsPlugin } from '../plugins/builtin-plugin/dirty-bounds-plugin';\nimport { defaultTicker } from '../animate/default-ticker';\nimport { SyncHook } from '../tapable';\nimport { LayerService } from './constants';\nimport { DefaultTimeline } from '../animate';\nimport { application } from '../application';\nimport { isBrowserEnv } from '../env-check';\nimport { Factory } from '../factory';\n\nconst DefaultConfig = {\n WIDTH: 500,\n HEIGHT: 500,\n X: 0,\n Y: 0,\n BACKGROUND: 'white'\n};\n\ntype IStageState = 'rendering' | 'normal';\n\n/**\n * Stage是一个舞台或一个视口,并不直接对应一个或多个Canvas,逻辑上和Canvas无关\n *\n * 1. Stage对应一个Canvas的整体,Stage的宽高即为Canvas的宽高\n * 2. Stage小于Canvas,Stage作为Canvas某个区域的视口,只管理这个区域\n * 3. 多图层时Stage的多个图层对应多个Canvas\n *\n * 原生环境下Stage可以拥有一个Window或者使用Window的一块区域\n *\n * 【注】如果希望获取完整的Canvas或窗口或者调整窗口信息,请使用Window模块\n */\nexport class Stage extends Group implements IStage {\n declare parent: IStage | null;\n\n declare state: IStageState;\n\n private _background: string | IColor;\n protected nextFrameRenderLayerSet: Set<Layer>;\n protected willNextFrameRender: boolean;\n protected _cursor: string;\n renderCount: number;\n dirtyBounds: IBounds | null;\n option3d?: IOption3D;\n declare light?: IDirectionLight;\n declare camera?: ICamera;\n declare renderStyle?: string;\n\n declare hooks: {\n beforeRender: ISyncHook<[IStage]>;\n afterRender: ISyncHook<[IStage]>;\n };\n\n set viewBox(b: IBoundsLike) {\n this.window.setViewBox(b);\n }\n get viewBox(): IAABBBounds {\n return this.window.getViewBox();\n }\n\n /**\n * @deprecated 不建议使用\n */\n get x(): number {\n return this.window.getViewBox().x1;\n }\n /**\n * @deprecated 不建议使用\n */\n set x(x: number) {\n const b = this.window.getViewBox();\n b.translate(x - b.x1, 0);\n this.window.setViewBox(b);\n }\n /**\n * @deprecated 不建议使用\n */\n get y(): number {\n return this.window.getViewBox().y1;\n }\n /**\n * @deprecated 不建议使用\n */\n set y(y: number) {\n const b = this.window.getViewBox();\n b.translate(0, y - b.y1);\n this.window.setViewBox(b);\n }\n get width(): number {\n return this.window.width;\n }\n set width(w: number) {\n this.resize(w, this.height);\n }\n get viewWidth(): number {\n return this.window.getViewBox().width();\n }\n set viewWidth(w: number) {\n this.resizeView(w, this.viewHeight);\n }\n get viewHeight(): number {\n return this.window.getViewBox().height();\n }\n set viewHeight(h: number) {\n this.resizeView(this.viewWidth, h);\n }\n get height(): number {\n return this.window.height;\n }\n set height(h: number) {\n this.resize(this.width, h);\n }\n get dpr(): number {\n return this.window.dpr;\n }\n set dpr(r: number) {\n this.setDpr(r);\n }\n get background(): string | IColor {\n return this._background ?? DefaultConfig.BACKGROUND;\n }\n set background(b: string | IColor) {\n this._background = b;\n }\n get defaultLayer(): ILayer {\n return this.at(0) as unknown as ILayer;\n }\n\n ticker: ITicker;\n\n autoRender: boolean;\n autoRefresh: boolean;\n _enableLayout: boolean;\n htmlAttribute: boolean | string | any;\n reactAttribute: boolean | string | any;\n increaseAutoRender: boolean;\n view3dTranform: boolean;\n readonly window: IWindow;\n private readonly global: IGlobal;\n readonly renderService: IRenderService;\n protected pickerService?: IPickerService;\n readonly pluginService: IPluginService;\n readonly layerService: ILayerService;\n private _eventSystem?: EventSystem;\n private get eventSystem(): EventSystem {\n return this._eventSystem;\n }\n\n protected _beforeRender?: (stage: IStage) => void;\n protected _afterRender?: (stage: IStage) => void;\n // 0: 正常渲染, > 0: 跳过隐藏canvas的渲染, < 0: 禁止渲染\n protected _skipRender?: number;\n protected _afterNextRenderCbs?: ((stage: IStage) => void)[];\n protected lastRenderparams?: Partial<IDrawContext>;\n\n protected interactiveLayer?: ILayer;\n protected supportInteractiveLayer: boolean;\n protected timeline: ITimeline;\n\n declare params: Partial<IStageParams>;\n\n // 是否在render之前执行了tick,如果没有执行,尝试执行tick用来应用动画属性,避免动画过程中随意赋值然后又调用同步render导致属性的突变\n // 第一次render不需要强行走动画\n protected tickedBeforeRender: boolean = true;\n\n /**\n * 所有属性都具有默认值。\n * Canvas为字符串或者Canvas元素,那么默认图层就会绑定到这个Canvas上\n * 如果不传入Canvas,那么会新建一个Canvas,用户可以通过Window模块管理这个Canvas\n * 1. 如果没有传入宽高,那么默认为canvas宽高,如果传入了宽高则stage使用传入宽高作为视口宽高\n * @param params\n */\n constructor(params: Partial<IStageParams> = {}) {\n super({});\n this.params = params;\n this.theme = new Theme();\n this.hooks = {\n beforeRender: new SyncHook(['stage']),\n afterRender: new SyncHook(['stage'])\n };\n this.global = application.global;\n if (!this.global.env && isBrowserEnv()) {\n // 如果是浏览器环境,默认设置env\n this.global.setEnv('browser');\n }\n this.window = container.get<IWindow>(VWindow);\n this.renderService = container.get<IRenderService>(RenderService);\n this.pluginService = container.get<IPluginService>(PluginService);\n this.layerService = container.get<ILayerService>(LayerService);\n this.pluginService.active(this, params);\n\n this.window.create({\n width: params.width,\n height: params.height,\n viewBox: params.viewBox,\n container: params.container,\n dpr: params.dpr || this.global.devicePixelRatio,\n canvasControled: params.canvasControled !== false,\n title: params.title || '',\n canvas: params.canvas\n });\n\n this.state = 'normal';\n this.renderCount = 0;\n this.tryInitEventSystem();\n // // 没有传入xy就默认为0\n // this._x = params.x ?? DefaultConfig.X;\n // this._y = params.y ?? DefaultConfig.Y;\n // // 没有传入view的宽高则默认为window的宽高\n // this._viewWidth = params.viewWidth ?? this.window.width;\n // this._viewHeight = params.viewHeight ?? this.window.height;\n // this._AABBBounds.set(this._x, this._y, this._viewWidth + this._x, this._viewHeight + this._y);\n // 背景色默认为纯白色\n this._background = params.background ?? DefaultConfig.BACKGROUND;\n\n // 创建一个默认layer图层\n // this.appendChild(new Layer(this, this.global, this.window, { main: true }));\n this.appendChild(this.layerService.createLayer(this, { main: true }));\n\n this.nextFrameRenderLayerSet = new Set();\n this.willNextFrameRender = false;\n this.stage = this;\n this.renderStyle = params.renderStyle;\n\n // this.autoRender = params.autoRender;\n if (params.autoRender) {\n this.enableAutoRender();\n }\n if (params.autoRefresh) {\n this.enableAutoRefresh();\n }\n // 默认不开启dirtyBounds\n if (params.disableDirtyBounds === false) {\n this.enableDirtyBounds();\n }\n\n if (params.enableHtmlAttribute) {\n this.enableHtmlAttribute(params.enableHtmlAttribute);\n }\n if (params.ReactDOM) {\n this.enableReactAttribute(params.ReactDOM);\n }\n\n params.enableLayout && this.enableLayout();\n this.hooks.beforeRender.tap('constructor', this.beforeRender);\n this.hooks.afterRender.tap('constructor', this.afterRender);\n this._beforeRender = params.beforeRender;\n this._afterRender = params.afterRender;\n this.ticker = params.ticker || defaultTicker;\n this.supportInteractiveLayer = params.interactiveLayer !== false;\n this.timeline = new DefaultTimeline();\n this.ticker.addTimeline(this.timeline);\n this.timeline.pause();\n if (!params.optimize) {\n params.optimize = {};\n }\n this.optmize(params.optimize);\n // 如果背景是图片,触发加载图片操作\n if (params.background && isString(this._background) && this._background.includes('/')) {\n this.setAttributes({ background: this._background });\n }\n this.ticker.on('afterTick', this.afterTickCb);\n }\n\n pauseRender(sr: number = -1) {\n this._skipRender = sr;\n }\n\n resumeRender() {\n this._skipRender = 0;\n }\n\n protected tryInitEventSystem() {\n if (this.global.supportEvent && !this._eventSystem) {\n this._eventSystem = new EventSystem({\n targetElement: this.window,\n resolution: this.window.dpr || this.global.devicePixelRatio,\n rootNode: this as any,\n global: this.global,\n supportsPointerEvents: this.params.supportsPointerEvents,\n supportsTouchEvents: this.params.supportsTouchEvents,\n ...this.params.event\n });\n }\n }\n\n preventRender(prevent: boolean) {\n if (prevent) {\n this._skipRender = -Infinity;\n } else {\n // 判断是否需要outRange优化\n if (this.params.optimize.skipRenderWithOutRange !== false) {\n this._skipRender = this.window.isVisible() ? 0 : 1;\n } else {\n this._skipRender = 0;\n }\n }\n }\n\n // 优化策略\n optmize(params: IOptimizeType) {\n this.optmizeRender(params.skipRenderWithOutRange);\n this.params.optimize = params;\n }\n\n // 优化渲染\n protected optmizeRender(skipRenderWithOutRange: boolean = false) {\n if (!skipRenderWithOutRange) {\n return;\n }\n // 不在视口内的时候,跳过渲染\n this._skipRender = this._skipRender < 0 ? this._skipRender : this.window.isVisible() ? 0 : 1;\n this.window.onVisibleChange(this._onVisibleChange);\n }\n\n protected _onVisibleChange = (visible: boolean) => {\n if (this._skipRender < 0) {\n return;\n }\n if (visible) {\n if (this.dirtyBounds) {\n const b = this.window.getViewBox();\n this.dirtyBounds.setValue(b.x1, b.y1, b.width(), b.height());\n }\n if (this._skipRender > 1) {\n this.renderNextFrame();\n }\n this._skipRender = 0;\n } else {\n this._skipRender = 1;\n }\n };\n\n getTimeline() {\n return this.timeline;\n }\n\n get3dOptions(options: IOption3D) {\n const {\n center = { x: this.width / 2, y: this.height / 2, z: 0, dx: 0, dy: 0, dz: 0 },\n light = {},\n alpha = 0,\n beta = 0,\n camera,\n fieldRatio = 1,\n fieldDepth\n } = options;\n\n return {\n ...options,\n center,\n light,\n alpha,\n beta,\n camera,\n fieldRatio,\n fieldDepth\n };\n }\n\n set3dOptions(options: IOption3D) {\n this.option3d = options;\n const options3d = this.get3dOptions(options);\n const { light, center, camera, alpha, beta, fieldRatio, fieldDepth } = options3d;\n const { dir = [1, 1, -1], color = 'white', ambient } = light;\n\n const centerX = (center.x ?? this.width / 2) + (center.dx ?? 0);\n const centerY = (center.y ?? this.height / 2) + (center.dy ?? 0);\n const centerZ = (center.z ?? 0) + (center.dz ?? 0);\n const centerVec3: vec3 = [centerX, centerY, centerZ];\n const z = 1;\n let cameraX = 0;\n let cameraY = 0;\n let cameraZ = 0;\n if (!camera) {\n cameraX = Math.sin(alpha) + centerX;\n cameraY = Math.sin(beta) + centerY;\n cameraZ = Math.cos(alpha) * Math.cos(beta) * z;\n }\n\n const DirectionalLight = Factory.getPlugin('DirectionalLight');\n\n if (DirectionalLight) {\n this.light = new DirectionalLight(dir, color, ambient);\n }\n const cameraParams = {\n left: 0,\n right: this.width,\n top: 0,\n bottom: this.height,\n fieldRatio: fieldRatio,\n fieldDepth,\n viewParams: {\n pos: [cameraX, cameraY, cameraZ] as vec3,\n center: centerVec3,\n up: [0, 1, 0] as vec3\n }\n };\n if (this.camera) {\n this.camera.params = cameraParams;\n } else {\n const OrthoCamera = Factory.getPlugin('OrthoCamera');\n if (OrthoCamera) {\n this.camera = new OrthoCamera(cameraParams);\n }\n }\n\n if (options.enableView3dTransform) {\n this.enableView3dTransform();\n }\n }\n\n protected beforeRender = (stage: IStage) => {\n this._beforeRender && this._beforeRender(stage);\n };\n\n protected afterRender = (stage: IStage) => {\n this.renderCount++;\n this._afterRender && this._afterRender(stage);\n this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage));\n this._afterNextRenderCbs = null;\n this.tickedBeforeRender = false;\n };\n\n protected afterTickCb = () => {\n this.tickedBeforeRender = true;\n // 性能模式不用立刻渲染\n if (this.params.optimize?.tickRenderMode === 'performance') {\n // do nothing\n } else {\n // 不是rendering的时候,render\n this.state !== 'rendering' && this.render();\n }\n };\n\n setBeforeRender(cb: (stage: IStage) => void) {\n this._beforeRender = cb;\n }\n\n setAfterRender(cb: (stage: IStage) => void) {\n this._afterRender = cb;\n }\n\n afterNextRender(cb: (stage: IStage) => void) {\n if (!this._afterNextRenderCbs) {\n this._afterNextRenderCbs = [];\n }\n this._afterNextRenderCbs.push(cb);\n }\n\n enableView3dTransform() {\n if (this.view3dTranform) {\n return;\n }\n this.view3dTranform = true;\n const ViewTransform3dPlugin = Factory.getPlugin('ViewTransform3dPlugin');\n\n if (ViewTransform3dPlugin) {\n this.pluginService.register(new ViewTransform3dPlugin());\n }\n }\n\n disableView3dTranform() {\n if (!this.view3dTranform) {\n return;\n }\n this.view3dTranform = false;\n this.pluginService.findPluginsByName('ViewTransform3dPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n\n enableAutoRender() {\n if (this.autoRender) {\n return;\n }\n this.autoRender = true;\n this.pluginService.register(new AutoRenderPlugin());\n }\n disableAutoRender() {\n if (!this.autoRender) {\n return;\n }\n this.autoRender = false;\n this.pluginService.findPluginsByName('AutoRenderPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableAutoRefresh() {\n if (this.autoRefresh) {\n return;\n }\n this.autoRefresh = true;\n this.pluginService.register(new AutoRefreshPlugin());\n }\n disableAutoRefresh() {\n if (!this.autoRefresh) {\n return;\n }\n this.autoRefresh = false;\n this.pluginService.findPluginsByName('AutoRefreshPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableIncrementalAutoRender() {\n if (this.increaseAutoRender) {\n return;\n }\n this.increaseAutoRender = true;\n this.pluginService.register(new IncrementalAutoRenderPlugin());\n }\n disableIncrementalAutoRender() {\n if (!this.increaseAutoRender) {\n return;\n }\n this.increaseAutoRender = false;\n this.pluginService.findPluginsByName('IncrementalAutoRenderPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableDirtyBounds() {\n if (this.dirtyBounds) {\n return;\n }\n this.dirtyBounds = new Bounds();\n let plugin = this.pluginService.findPluginsByName('DirtyBoundsPlugin')[0];\n if (!plugin) {\n plugin = new DirtyBoundsPlugin();\n this.pluginService.register(plugin);\n } else {\n plugin.activate(this.pluginService);\n }\n }\n disableDirtyBounds() {\n if (!this.dirtyBounds) {\n return;\n }\n this.dirtyBounds = null;\n this.pluginService.findPluginsByName('DirtyBoundsPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableLayout() {\n if (this._enableLayout) {\n return;\n }\n this._enableLayout = true;\n\n const FlexLayoutPlugin = Factory.getPlugin('FlexLayoutPlugin');\n\n if (FlexLayoutPlugin) {\n this.pluginService.register(new FlexLayoutPlugin());\n }\n }\n disableLayout() {\n if (!this._enableLayout) {\n return;\n }\n this._enableLayout = false;\n this.pluginService.findPluginsByName('FlexLayoutPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableHtmlAttribute(container?: any) {\n if (this.htmlAttribute) {\n return;\n }\n const HtmlAttributePlugin = Factory.getPlugin('HtmlAttributePlugin');\n\n if (HtmlAttributePlugin) {\n this.htmlAttribute = container;\n this.pluginService.register(new HtmlAttributePlugin());\n }\n }\n disableHtmlAttribute() {\n if (!this.htmlAttribute) {\n return;\n }\n this.htmlAttribute = false;\n this.pluginService.findPluginsByName('HtmlAttributePlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableReactAttribute(container?: any) {\n if (this.reactAttribute) {\n return;\n }\n const ReactAttributePlugin = Factory.getPlugin('ReactAttributePlugin');\n\n if (ReactAttributePlugin) {\n this.reactAttribute = container;\n this.pluginService.register(new ReactAttributePlugin());\n }\n }\n disableReactAttribute() {\n if (!this.reactAttribute) {\n return;\n }\n this.reactAttribute = false;\n this.pluginService.findPluginsByName('ReactAttributePlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n\n getPluginsByName(name: string): IPlugin[] {\n return this.pluginService.findPluginsByName(name);\n }\n\n // /**\n // * stage的appendChild,add\n // * @param node\n // * @returns\n // */\n // appendChild<T extends Node>(node: T): T | null {\n // const layer = this.at(0);\n // if (!layer) {\n // return null;\n // }\n // return layer.appendChild<T>(node);\n // }\n\n protected tryUpdateAABBBounds(): IAABBBounds {\n const viewBox = this.window.getViewBox();\n this._AABBBounds.setValue(viewBox.x1, viewBox.y1, viewBox.x2, viewBox.y2);\n return this._AABBBounds;\n }\n\n combineLayer(ILayer1: ILayer, ILayer2: ILayer): ILayer {\n throw new Error('暂不支持');\n }\n // 如果传入CanvasId,如果存在相同Id,说明这两个图层使用相同的Canvas绘制\n // 但需要注意的是依然是两个图层(用于解决Table嵌入ChartSpace不影响Table的绘制)\n createLayer(canvasId?: string, layerMode?: LayerMode): ILayer {\n if (this.releaseStatus === 'released') {\n return;\n }\n // 创建一个默认layer图层\n const layer = this.layerService.createLayer(this, {\n main: false,\n layerMode,\n canvasId\n });\n this.appendChild(layer);\n return layer;\n // const layer = new Layer(this, this.global, this.window, {\n // main: false,\n // canvasId\n // });\n // this.appendChild(layer);\n // return layer;\n }\n sortLayer(cb: (ILayer1: ILayer, layer2: ILayer) => number): void {\n const children = this.children;\n children.sort(cb);\n this.removeAllChild();\n children.forEach(c => {\n this.appendChild(c);\n });\n }\n removeLayer(ILayerId: number): ILayer | false {\n return this.removeChild(this.findChildByUid(ILayerId) as IGraphic) as ILayer;\n }\n tryInitInteractiveLayer() {\n if (this.releaseStatus === 'released') {\n return;\n }\n // TODO:顺序可能会存在问题\n // 支持交互层,且没有创建过,那就创建\n if (this.supportInteractiveLayer && !this.interactiveLayer) {\n this.interactiveLayer = this.createLayer();\n this.interactiveLayer.name = '_builtin_interactive';\n this.interactiveLayer.attribute.pickable = false;\n this.nextFrameRenderLayerSet.add(this.interactiveLayer as any); // to be fixed\n }\n // this.interactiveLayer.afterDraw(l => {\n // l.removeAllChild();\n // });\n }\n\n clearViewBox(color?: string) {\n this.window.clearViewBox(color);\n }\n\n render(layers?: ILayer[], params?: Partial<IDrawContext>): void {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.ticker.start();\n this.timeline.resume();\n const state = this.state;\n this.state = 'rendering';\n // 判断是否需要手动执行tick\n if (!this.tickedBeforeRender) {\n this.ticker.trySyncTickStatus();\n }\n this.layerService.prepareStageLayer(this);\n if (!this._skipRender) {\n this.lastRenderparams = params;\n this.hooks.beforeRender.call(this);\n if (!this._skipRender) {\n this.renderLayerList(this.children as ILayer[]);\n this.combineLayersToWindow();\n this.nextFrameRenderLayerSet.clear();\n }\n this.hooks.afterRender.call(this);\n }\n this.state = state;\n this._skipRender && this._skipRender++;\n }\n\n protected combineLayersToWindow() {\n // TODO 后续支持通用的渲染模型\n if (this.global.env === 'harmony') {\n const ctx = this.window.getContext().nativeContext;\n this.forEachChildren<ILayer>((layer, i) => {\n if (i > 0) {\n const image = layer\n .getNativeHandler()\n .getContext()\n .canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();\n ctx.transferFromImageBitmap(image);\n }\n });\n }\n return;\n // this.forEach<ILayer>((layer, i) => {\n // layer.combineTo(this.window, {\n // clear: i === 0,\n // x: this.x,\n // y: this.y,\n // width: this.viewWidth,\n // height: this.viewHeight,\n // renderService: this.renderService,\n // background: layer === this.defaultLayer ? this.background : undefined,\n // updateBounds: !!this.dirtyBounds\n // });\n // });\n }\n\n renderNextFrame(layers?: ILayer[], force?: boolean): void {\n // render状态中调用的不会触发nextFrame,避免loop\n // if (this.state === 'rendering' && !force) {\n // console.log('abc');\n // return;\n // }\n // 性能优化,避免重复add\n if (this.nextFrameRenderLayerSet.size !== this.childrenCount) {\n (layers || this).forEach<ILayer>((layer: any) => {\n this.nextFrameRenderLayerSet.add(layer);\n });\n }\n if (!this.willNextFrameRender) {\n this.willNextFrameRender = true;\n this.global.getRequestAnimationFrame()(() => {\n this._doRenderInThisFrame(), (this.willNextFrameRender = false);\n });\n }\n }\n\n _doRenderInThisFrame() {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.timeline.resume();\n this.ticker.start();\n const state = this.state;\n this.state = 'rendering';\n this.layerService.prepareStageLayer(this);\n if (this.nextFrameRenderLayerSet.size && !this._skipRender) {\n this.hooks.beforeRender.call(this);\n if (!this._skipRender) {\n this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()), this.lastRenderparams || {});\n this.combineLayersToWindow();\n this.nextFrameRenderLayerSet.clear();\n }\n this.hooks.afterRender.call(this);\n }\n this.state = state;\n this._skipRender && this._skipRender++;\n }\n\n protected renderLayerList(layerList: ILayer[], params?: Partial<IDrawContext>) {\n const list: ILayer[] = [];\n // 只需要render main layer即可\n for (let i = 0; i < layerList.length; i++) {\n let l = layerList[i];\n if (l.layerMode === 'virtual') {\n l = l.getNativeHandler().mainHandler.layer;\n }\n if (!list.includes(l)) {\n list.push(l);\n }\n }\n list.forEach(layer => {\n // 记录当前的stamp,避免重复绘制layer(如果存在virtual layer)\n if (layer.renderCount > this.renderCount) {\n return;\n }\n layer.renderCount = this.renderCount + 1;\n\n if (layer === this.interactiveLayer) {\n // 交互层由于其特殊性,不使用dirtyBounds\n this.dirtyBounds && this.dirtyBounds.clear();\n }\n layer.render(\n {\n renderService: this.renderService,\n background: layer === this.defaultLayer ? this.background : undefined,\n updateBounds: !!(this.dirtyBounds && !this.dirtyBounds.empty()),\n viewBox: this.window.getViewBox(),\n transMatrix: this.window.getViewBoxTransform()\n },\n { renderStyle: this.renderStyle, ...params }\n );\n });\n\n // 添加交互层渲染\n if (this.interactiveLayer && !layerList.includes(this.interactiveLayer)) {\n // 交互层由于其特殊性,不使用dirtyBounds\n this.dirtyBounds && this.dirtyBounds.clear();\n this.interactiveLayer.render(\n {\n renderService: this.renderService,\n updateBounds: !!(this.dirtyBounds && !this.dirtyBounds.empty()),\n viewBox: this.window.getViewBox(),\n transMatrix: this.window.getViewBoxTransform()\n },\n { renderStyle: this.renderStyle, ...params }\n );\n }\n }\n\n resizeWindow(w: number, h: number, rerender: boolean = true) {\n this.window.resize(w, h);\n rerender && this.render();\n }\n\n /**\n * 语法糖,如果viewBox和window宽高一样的话,那么会同时缩放window和viewBox\n * @param w\n * @param h\n * @param rerender\n */\n resize(w: number, h: number, rerender: boolean = true): void {\n if (this.releaseStatus === 'released') {\n return;\n }\n // 如果不是子图的stage,那么认为用户也想要resize view\n if (!this.window.hasSubView()) {\n this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h);\n }\n this.window.resize(w, h);\n this.forEachChildren<ILayer>(c => {\n c.resize(w, h);\n });\n // 设置camera\n // this.camera && (this.camera.params = { ...this.camera.params, right: this.width, bottom: this.height });\n this.camera && this.option3d && this.set3dOptions(this.option3d);\n rerender && this.render();\n }\n resizeView(w: number, h: number, rerender: boolean = true) {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h);\n this.forEachChildren<ILayer>(c => {\n c.resizeView(w, h);\n });\n // 设置camera\n this.camera && (this.camera.params = { ...this.camera.params, right: this.width, bottom: this.height });\n rerender && this.render();\n }\n setViewBox(viewBox: IBoundsLike, rerender: boolean): void;\n setViewBox(x: number, y: number, w: number, h: number, rerender: boolean): void;\n setViewBox(x: number | IBoundsLike, y: number | boolean, w?: number, h?: number, rerender?: boolean): void {\n let isRerender: boolean = true;\n\n if (typeof x === 'object') {\n this.viewBox.setValue(x.x1, x.y1, x.x2, x.y2);\n if (y === false) {\n isRerender = false;\n }\n } else {\n this.viewBox.setValue(x, y as number, x + w, (y as number) + h);\n\n if (rerender === false) {\n isRerender = false;\n }\n }\n\n this.forEachChildren<ILayer>(c => {\n c.resizeView(this.viewBox.width(), this.viewBox.height());\n });\n isRerender && this.render();\n }\n setDpr(dpr: number, rerender: boolean = true): void {\n // this.window.setDpr(dpr);\n this.forEachChildren<ILayer>(c => {\n c.setDpr(dpr);\n });\n\n rerender && this.render();\n }\n setOrigin(x: number, y: number): void {\n throw new Error('暂不支持');\n }\n export(type: IExportType): HTMLCanvasElement | ImageData {\n throw new Error('暂不支持');\n }\n pick(x: number, y: number): PickResult | false {\n if (this.releaseStatus === 'released') {\n return;\n }\n // 暂时不提供layer的pick\n const result = this.getPickerService().pick(this.children as unknown as IGraphic[], new Point(x, y), {\n bounds: this.AABBBounds\n });\n if (result?.graphic || result?.group) {\n return result;\n }\n return false;\n }\n\n // 动画相关\n startAnimate(t: number): void {\n throw new Error('暂不支持');\n }\n setToFrame(t: number): void {\n throw new Error('暂不支持');\n }\n\n release() {\n super.release();\n\n this.hooks.beforeRender.unTap('constructor', this.beforeRender);\n this.hooks.afterRender.unTap('constructor', this.afterRender);\n\n this.eventSystem && this.eventSystem.release();\n this.layerService.releaseStage(this);\n this.pluginService.release();\n this.forEach(layer => {\n layer.release();\n });\n // 额外删除掉interactiveLayer的节点\n if (this.interactiveLayer) {\n this.interactiveLayer.forEachChildren((item: IGraphic) => {\n item.setStage && item.setStage(null, null);\n this.interactiveLayer.removeChild(item);\n });\n this.interactiveLayer.release();\n }\n this.window.release();\n this.ticker.remTimeline(this.timeline);\n this.ticker.removeListener('afterTick', this.afterTickCb);\n this.renderService.renderTreeRoots = [];\n }\n\n setStage(stage?: IStage) {\n return;\n // this.stage = this;\n // this.forEachChildren(item => {\n // (item as Layer).setStage(this);\n // });\n }\n\n /**\n * 添加dirty区域,会修改参数b\n * @param b\n * @param matrix\n */\n dirty(b: IBounds, matrix?: IMatrix) {\n if (this.releaseStatus === 'released') {\n return;\n }\n if (matrix) {\n b.transformWithMatrix(matrix);\n }\n if (this.dirtyBounds.empty()) {\n this.dirtyBounds.setValue(b.x1, b.y1, b.x2, b.y2);\n }\n this.dirtyBounds.union(b);\n }\n\n getLayer(name: string): undefined | ILayer {\n const layer = this.children.filter(layer => layer.name === name);\n return layer[0] as ILayer;\n }\n\n renderTo(window: IWindow) {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.forEachChildren<ILayer>((layer, i) => {\n layer.drawTo(window, {\n // ...params,\n renderService: this.renderService,\n viewBox: window.getViewBox(),\n transMatrix: window.getViewBoxTransform(),\n background: layer === this.defaultLayer ? this.background : undefined,\n clear: i === 0, // 第一个layer需要clear\n updateBounds: !!(this.dirtyBounds && !this.dirtyBounds.empty())\n });\n });\n }\n\n /**\n * 渲染到新的window上去\n * @param fullImage 是否是全量的image,因为可能之前的window有一部分场景树超过window的帧缓冲了\n * @returns\n */\n renderToNewWindow(fullImage: boolean = true, viewBox?: IAABBBounds): IWindow {\n if (this.releaseStatus === 'released') {\n return;\n }\n const window = container.get<IWindow>(VWindow);\n const x1 = viewBox ? -viewBox.x1 : 0;\n const y1 = viewBox ? -viewBox.y1 : 0;\n const x2 = viewBox ? viewBox.x2 : this.viewWidth;\n const y2 = viewBox ? viewBox.y2 : this.viewHeight;\n const width = viewBox ? viewBox.width() : this.viewWidth;\n const height = viewBox ? viewBox.height() : this.viewHeight;\n if (fullImage) {\n window.create({\n viewBox: { x1, y1, x2, y2 },\n width,\n height,\n dpr: this.window.dpr,\n canvasControled: true,\n offscreen: true,\n title: ''\n });\n } else {\n window.create({\n viewBox: { x1, y1, x2, y2 },\n width,\n height,\n dpr: this.window.dpr,\n canvasControled: true,\n offscreen: true,\n title: ''\n });\n }\n\n this.renderTo(window);\n return window;\n }\n\n toCanvas(fullImage: boolean = true, viewBox?: IAABBBounds): HTMLCanvasElement | null {\n if (this.releaseStatus === 'released') {\n return;\n }\n const window = this.renderToNewWindow(fullImage, viewBox);\n const c = window.getNativeHandler();\n if (c.nativeCanvas) {\n return c.nativeCanvas;\n }\n return null;\n }\n\n setCursor(mode?: string): void {\n this._cursor = mode;\n this.eventSystem.setCursor(mode, 'ignore');\n }\n\n getCursor() {\n return this._cursor;\n }\n\n eventPointTransform(e: PointerEvent | WheelEvent | TouchEvent): { x: number; y: number } {\n const point = this.global.mapToCanvasPoint(e, this.window.getContext().canvas.nativeCanvas);\n\n return this.stage.window.pointTransform(point.x, point.y);\n }\n\n pauseTriggerEvent() {\n this._eventSystem && this._eventSystem.pauseTriggerEvent();\n }\n resumeTriggerEvent() {\n this._eventSystem && this._eventSystem.resumeTriggerEvent();\n }\n\n getPickerService() {\n if (!this.pickerService) {\n this.pickerService = container.get<IPickerService>(PickerService);\n }\n return this.pickerService;\n }\n}\n"]}
|
package/cjs/graphic/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type IArcGraphicAttribute, type IAreaGraphicAttribute, type IGraphicAttribute, type ICircleGraphicAttribute, type IFillStyle, type IGlyphGraphicAttribute, type IGroupGraphicAttribute, type IImageGraphicAttribute, type ILineGraphicAttribute, type IPathGraphicAttribute, type IPolygonGraphicAttribute, type IRect3dGraphicAttribute, type IRectGraphicAttribute, type IStrokeStyle, type IGraphicStyle, type ISymbolGraphicAttribute, type ITextAttribute, type ITextGraphicAttribute, type IRichTextGraphicAttribute, type ITransform, type IRichTextIconGraphicAttribute, type IConnectedStyle, type ILayout, type IDebugType, type IPickStyle } from '../interface';
|
|
2
2
|
export declare const DefaultLayout: ILayout;
|
|
3
3
|
export declare const DefaultTransform: ITransform;
|
|
4
4
|
export declare const DefaultFillStyle: IFillStyle;
|
package/cjs/graphic/config.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.DefaultRichTextIconAttribute = exports.DefaultImageAttribute = exports.DefaultRichTextAttribute = exports.DefaultTextAttribute = exports.DefaultSymbolAttribute = exports.DefaultRect3dAttribute = exports.DefaultRectAttribute = exports.DefaultPolygonAttribute = exports.DefaultPathAttribute = exports.DefaultLineAttribute = exports.DefaultGlyphAttribute = exports.DefaultGroupAttribute = exports.DefaultCircleAttribute = exports.DefaultAreaAttribute = exports.DefaultArcAttribute = exports.rewriteProto = exports.addAttributeToPrototype = exports.DefaultAttribute = exports.DefaultDebugAttribute = exports.DefaultConnectAttribute = exports.DefaultStyle = exports.DefaultPickStyle = exports.DefaultTextStyle = exports.DefaultStrokeStyle = exports.DefaultFillStyle = exports.DefaultTransform = exports.DefaultLayout = void 0;
|
|
6
6
|
|
|
7
|
-
const vutils_1 = require("@visactor/vutils"), custom_path2d_1 = require("../common/custom-path2d");
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), custom_path2d_1 = require("../common/custom-path2d"), interface_1 = require("../interface");
|
|
8
8
|
|
|
9
9
|
exports.DefaultLayout = {
|
|
10
10
|
alignSelf: "auto"
|
|
@@ -68,6 +68,7 @@ exports.DefaultStrokeStyle = Object.assign({
|
|
|
68
68
|
}, commonStroke), exports.DefaultTextStyle = {
|
|
69
69
|
text: "",
|
|
70
70
|
maxLineWidth: 1 / 0,
|
|
71
|
+
maxWidth: 1 / 0,
|
|
71
72
|
textAlign: "left",
|
|
72
73
|
textBaseline: "alphabetic",
|
|
73
74
|
fontSize: 16,
|
|
@@ -91,7 +92,8 @@ exports.DefaultStrokeStyle = Object.assign({
|
|
|
91
92
|
suffixPosition: "end",
|
|
92
93
|
underlineDash: [],
|
|
93
94
|
underlineOffset: 0,
|
|
94
|
-
disableAutoClipedPoptip: void 0
|
|
95
|
+
disableAutoClipedPoptip: void 0,
|
|
96
|
+
measureMode: interface_1.MeasureModeEnum.fontBounding
|
|
95
97
|
}, exports.DefaultPickStyle = {
|
|
96
98
|
pickStrokeBuffer: 0
|
|
97
99
|
}, exports.DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
|