@visactor/vrender 1.0.13 → 1.0.14
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/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/index.es.js +27 -16
- package/dist/index.js +27 -16
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +5 -5
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
21
21
|
|
|
22
22
|
const vrender_core_1 = require("@visactor/vrender-core"), vrender_kits_1 = require("@visactor/vrender-kits"), vrender_kits_2 = require("@visactor/vrender-kits"), vrender_animate_1 = require("@visactor/vrender-animate");
|
|
23
23
|
|
|
24
|
-
exports.version = "1.0.
|
|
24
|
+
exports.version = "1.0.14", (0, vrender_core_1.preLoadAllModule)(), (0, vrender_core_1.isBrowserEnv)() ? (0,
|
|
25
25
|
vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0, vrender_core_1.isNodeEnv)() && (0,
|
|
26
26
|
vrender_kits_1.loadNodeEnv)(vrender_core_1.container), (0, vrender_kits_2.registerArc)(),
|
|
27
27
|
(0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(), (0, vrender_kits_2.registerCircle)(),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAmF;AACnF,yDAmBgC;AAChC,+DAAmF;AAEtE,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,2BAAY,GAAE,CAAC;AAEf,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,4CAA6B,GAAE,CAAC;AAChC,IAAA,0CAA2B,GAAE,CAAC;AAC9B,IAAA,2CAA4B,GAAE,CAAC;AAC/B,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,kCAAmB,GAAE,CAAC;AAEtB,IAAA,uCAAqB,GAAE,CAAC;AACxB,IAAA,iCAAe,GAAE,CAAC;AAElB,yDAAuC;AACvC,yDAAuC;AACvC,4DAA0C","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport {\n container,\n isBrowserEnv,\n isNodeEnv,\n preLoadAllModule,\n registerFlexLayoutPlugin,\n registerViewTransform3dPlugin,\n registerHtmlAttributePlugin,\n registerReactAttributePlugin,\n registerDirectionalLight,\n registerOrthoCamera\n} from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv, registerStar } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\nimport { registerCustomAnimate, registerAnimate } from '@visactor/vrender-animate';\n// 导出版本号\nexport const version = \"1.0.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAmF;AACnF,yDAmBgC;AAChC,+DAAmF;AAEtE,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,2BAAY,GAAE,CAAC;AAEf,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,4CAA6B,GAAE,CAAC;AAChC,IAAA,0CAA2B,GAAE,CAAC;AAC9B,IAAA,2CAA4B,GAAE,CAAC;AAC/B,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,kCAAmB,GAAE,CAAC;AAEtB,IAAA,uCAAqB,GAAE,CAAC;AACxB,IAAA,iCAAe,GAAE,CAAC;AAElB,yDAAuC;AACvC,yDAAuC;AACvC,4DAA0C","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport {\n container,\n isBrowserEnv,\n isNodeEnv,\n preLoadAllModule,\n registerFlexLayoutPlugin,\n registerViewTransform3dPlugin,\n registerHtmlAttributePlugin,\n registerReactAttributePlugin,\n registerDirectionalLight,\n registerOrthoCamera\n} from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv, registerStar } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\nimport { registerCustomAnimate, registerAnimate } from '@visactor/vrender-animate';\n// 导出版本号\nexport const version = \"1.0.14\";\n\npreLoadAllModule();\n\nif (isBrowserEnv()) {\n loadBrowserEnv(container);\n} else if (isNodeEnv()) {\n loadNodeEnv(container);\n}\nregisterArc();\nregisterArc3d();\nregisterArea();\nregisterCircle();\nregisterGlyph();\nregisterGroup();\nregisterImage();\nregisterLine();\nregisterPath();\nregisterPolygon();\nregisterPyramid3d();\nregisterRect();\nregisterRect3d();\nregisterRichtext();\nregisterShadowRoot();\nregisterSymbol();\nregisterText();\nregisterWrapText();\nregisterStar();\n\nregisterFlexLayoutPlugin();\nregisterViewTransform3dPlugin();\nregisterHtmlAttributePlugin();\nregisterReactAttributePlugin();\nregisterDirectionalLight();\nregisterOrthoCamera();\n\nregisterCustomAnimate();\nregisterAnimate();\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\nexport * from '@visactor/vrender-animate';\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -4893,6 +4893,9 @@ var __decorate$1M = undefined && undefined.__decorate || function (decorators, t
|
|
|
4893
4893
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4894
4894
|
};
|
|
4895
4895
|
let ATextMeasure = class {
|
|
4896
|
+
constructor() {
|
|
4897
|
+
this.id = "ATextMeasure";
|
|
4898
|
+
}
|
|
4896
4899
|
configure(service, env) {
|
|
4897
4900
|
this.canvas = service.canvas, this.context = service.context, service.bindTextMeasure(this);
|
|
4898
4901
|
}
|
|
@@ -5285,7 +5288,11 @@ var __decorate$1L = undefined && undefined.__decorate || function (decorators, t
|
|
|
5285
5288
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5286
5289
|
};
|
|
5287
5290
|
const TextMeasureContribution = Symbol.for("TextMeasureContribution");
|
|
5288
|
-
let DefaultTextMeasureContribution = class extends ATextMeasure {
|
|
5291
|
+
let DefaultTextMeasureContribution = class extends ATextMeasure {
|
|
5292
|
+
constructor() {
|
|
5293
|
+
super(...arguments), this.id = "DefaultTextMeasureContribution";
|
|
5294
|
+
}
|
|
5295
|
+
};
|
|
5289
5296
|
DefaultTextMeasureContribution = __decorate$1L([injectable()], DefaultTextMeasureContribution);
|
|
5290
5297
|
|
|
5291
5298
|
const container = new Container();
|
|
@@ -5872,13 +5879,17 @@ let DefaultGraphicUtil = class {
|
|
|
5872
5879
|
return this.tryInitCanvas(), this._context;
|
|
5873
5880
|
}
|
|
5874
5881
|
constructor(contributions) {
|
|
5875
|
-
this.contributions = contributions, this.configured = !1, this.global = application.global, this.global.hooks.onSetEnv.tap("graphic-util", (lastEnv, env, global) => {
|
|
5882
|
+
this.contributions = contributions, this.configured = !1, this.global = application.global, this._textMeasureMap = new Map(), this.global.hooks.onSetEnv.tap("graphic-util", (lastEnv, env, global) => {
|
|
5876
5883
|
this.configured = !1, this.configure(global, env);
|
|
5877
5884
|
});
|
|
5878
5885
|
}
|
|
5879
5886
|
get textMeasure() {
|
|
5880
5887
|
return this._textMeasure || this.configure(this.global, this.global.env), this._textMeasure;
|
|
5881
5888
|
}
|
|
5889
|
+
getTextMeasureInstance(textMeasureId) {
|
|
5890
|
+
if (!textMeasureId) return this.textMeasure;
|
|
5891
|
+
return this._textMeasureMap.get(textMeasureId) || this.textMeasure;
|
|
5892
|
+
}
|
|
5882
5893
|
configure(global, env) {
|
|
5883
5894
|
this.configured || (this.contributions.getContributions().forEach(contribution => {
|
|
5884
5895
|
contribution.configure(this, env);
|
|
@@ -5891,7 +5902,7 @@ let DefaultGraphicUtil = class {
|
|
|
5891
5902
|
}
|
|
5892
5903
|
}
|
|
5893
5904
|
bindTextMeasure(tm) {
|
|
5894
|
-
this._textMeasure = tm;
|
|
5905
|
+
this._textMeasure && "DefaultTextMeasureContribution" !== tm.id || (this._textMeasure = tm), this._textMeasureMap.has(tm.id) || this._textMeasureMap.set(tm.id, tm);
|
|
5895
5906
|
}
|
|
5896
5907
|
measureText(text, tc, method = "native") {
|
|
5897
5908
|
var _a;
|
|
@@ -10684,7 +10695,7 @@ class Text extends Graphic {
|
|
|
10684
10695
|
this.cache.layoutData.lines.forEach(item => {
|
|
10685
10696
|
mergedText += item.str;
|
|
10686
10697
|
});
|
|
10687
|
-
return (Array.isArray(text) ? text.join("") : text) !== mergedText;
|
|
10698
|
+
return (Array.isArray(text) ? text.join("") : text).toString() !== mergedText;
|
|
10688
10699
|
}
|
|
10689
10700
|
return "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(item => item.text).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString();
|
|
10690
10701
|
}
|
|
@@ -10783,7 +10794,7 @@ class Text extends Graphic {
|
|
|
10783
10794
|
return fontSize ? .1 * fontSize : 0;
|
|
10784
10795
|
}
|
|
10785
10796
|
updateHorizontalMultilineAABBBounds(text) {
|
|
10786
|
-
var _a;
|
|
10797
|
+
var _a, _b;
|
|
10787
10798
|
const textTheme = this.getGraphicTheme(),
|
|
10788
10799
|
attribute = this.attribute,
|
|
10789
10800
|
{
|
|
@@ -10810,7 +10821,7 @@ class Text extends Graphic {
|
|
|
10810
10821
|
const bbox = this.cache.layoutData.bbox;
|
|
10811
10822
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10812
10823
|
}
|
|
10813
|
-
const textMeasure = application.graphicUtil.
|
|
10824
|
+
const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_b = this.stage) || void 0 === _b ? void 0 : _b.textMeasureId)),
|
|
10814
10825
|
layoutData = new CanvasTextLayout(fontFamily, {
|
|
10815
10826
|
fontSize: fontSize,
|
|
10816
10827
|
fontWeight: fontWeight,
|
|
@@ -10828,7 +10839,7 @@ class Text extends Graphic {
|
|
|
10828
10839
|
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10829
10840
|
}
|
|
10830
10841
|
updateWrapAABBBounds(text) {
|
|
10831
|
-
var _a, _b, _c;
|
|
10842
|
+
var _a, _b, _c, _d;
|
|
10832
10843
|
const textTheme = this.getGraphicTheme(),
|
|
10833
10844
|
{
|
|
10834
10845
|
fontFamily = textTheme.fontFamily,
|
|
@@ -10854,7 +10865,7 @@ class Text extends Graphic {
|
|
|
10854
10865
|
const bbox = this.cache.layoutData.bbox;
|
|
10855
10866
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10856
10867
|
}
|
|
10857
|
-
const textMeasure = application.graphicUtil.
|
|
10868
|
+
const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_b = this.stage) || void 0 === _b ? void 0 : _b.textMeasureId)),
|
|
10858
10869
|
textOptions = {
|
|
10859
10870
|
fontSize: fontSize,
|
|
10860
10871
|
fontWeight: fontWeight,
|
|
@@ -10886,7 +10897,7 @@ class Text extends Graphic {
|
|
|
10886
10897
|
if ("" !== str && "" === clip.str || clip.wordBreaked) {
|
|
10887
10898
|
if (ellipsis) {
|
|
10888
10899
|
const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
10889
|
-
clip.str = null !== (
|
|
10900
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
10890
10901
|
} else clip.str = "", clip.width = 0;
|
|
10891
10902
|
needCut = !1;
|
|
10892
10903
|
}
|
|
@@ -10949,9 +10960,9 @@ class Text extends Graphic {
|
|
|
10949
10960
|
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10950
10961
|
}
|
|
10951
10962
|
updateVerticalMultilineAABBBounds(text) {
|
|
10952
|
-
var _a, _b;
|
|
10963
|
+
var _a, _b, _c;
|
|
10953
10964
|
const textTheme = this.getGraphicTheme(),
|
|
10954
|
-
textMeasure = application.graphicUtil.
|
|
10965
|
+
textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_a = this.stage) || void 0 === _a ? void 0 : _a.textMeasureId));
|
|
10955
10966
|
let width;
|
|
10956
10967
|
const attribute = this.attribute,
|
|
10957
10968
|
{
|
|
@@ -10972,7 +10983,7 @@ class Text extends Graphic {
|
|
|
10972
10983
|
} = attribute;
|
|
10973
10984
|
if (!verticalMode) {
|
|
10974
10985
|
const t = textAlign;
|
|
10975
|
-
textAlign = null !== (
|
|
10986
|
+
textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
|
|
10976
10987
|
}
|
|
10977
10988
|
if (width = 0, !this.shouldUpdateShape() && this.cache) {
|
|
10978
10989
|
this.cache.verticalList.forEach(item => {
|
|
@@ -11086,7 +11097,7 @@ class WrapText extends Text {
|
|
|
11086
11097
|
return isArray$1(text) ? !text.every(t => null == t || "" === t) : null != text && "" !== text;
|
|
11087
11098
|
}
|
|
11088
11099
|
updateMultilineAABBBounds(text) {
|
|
11089
|
-
var _a, _b, _c, _d;
|
|
11100
|
+
var _a, _b, _c, _d, _e;
|
|
11090
11101
|
const textTheme = this.getGraphicTheme(),
|
|
11091
11102
|
{
|
|
11092
11103
|
fontFamily = textTheme.fontFamily,
|
|
@@ -11110,7 +11121,7 @@ class WrapText extends Text {
|
|
|
11110
11121
|
const bbox = this.cache.layoutData.bbox;
|
|
11111
11122
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
11112
11123
|
}
|
|
11113
|
-
const textMeasure = application.graphicUtil.
|
|
11124
|
+
const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_c = this.stage) || void 0 === _c ? void 0 : _c.textMeasureId)),
|
|
11114
11125
|
layoutObj = new CanvasTextLayout(fontFamily, {
|
|
11115
11126
|
fontSize: fontSize,
|
|
11116
11127
|
fontWeight: fontWeight,
|
|
@@ -11139,7 +11150,7 @@ class WrapText extends Text {
|
|
|
11139
11150
|
if ("" !== str && "" === clip.str) {
|
|
11140
11151
|
if (ellipsis) {
|
|
11141
11152
|
const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
11142
|
-
clip.str = null !== (
|
|
11153
|
+
clip.str = null !== (_d = clipEllipsis.str) && void 0 !== _d ? _d : "", clip.width = null !== (_e = clipEllipsis.width) && void 0 !== _e ? _e : 0;
|
|
11143
11154
|
} else clip.str = "", clip.width = 0;
|
|
11144
11155
|
needCut = !1;
|
|
11145
11156
|
}
|
|
@@ -36447,7 +36458,7 @@ const registerCustomAnimate = () => {
|
|
|
36447
36458
|
AnimateExecutor.registerBuiltInAnimate("increaseCount", IncreaseCount), AnimateExecutor.registerBuiltInAnimate("fromTo", FromTo), AnimateExecutor.registerBuiltInAnimate("scaleIn", ScaleIn), AnimateExecutor.registerBuiltInAnimate("scaleOut", ScaleOut), AnimateExecutor.registerBuiltInAnimate("growHeightIn", GrowHeightIn), AnimateExecutor.registerBuiltInAnimate("growHeightOut", GrowHeightOut), AnimateExecutor.registerBuiltInAnimate("growWidthIn", GrowWidthIn), AnimateExecutor.registerBuiltInAnimate("growWidthOut", GrowWidthOut), AnimateExecutor.registerBuiltInAnimate("growCenterIn", GrowCenterIn), AnimateExecutor.registerBuiltInAnimate("growCenterOut", GrowCenterOut), AnimateExecutor.registerBuiltInAnimate("clipIn", ClipIn), AnimateExecutor.registerBuiltInAnimate("clipOut", ClipOut), AnimateExecutor.registerBuiltInAnimate("fadeIn", FadeIn), AnimateExecutor.registerBuiltInAnimate("fadeOut", FadeOut), AnimateExecutor.registerBuiltInAnimate("growPointsIn", GrowPointsIn), AnimateExecutor.registerBuiltInAnimate("growPointsOut", GrowPointsOut), AnimateExecutor.registerBuiltInAnimate("growPointsXIn", GrowPointsXIn), AnimateExecutor.registerBuiltInAnimate("growPointsXOut", GrowPointsXOut), AnimateExecutor.registerBuiltInAnimate("growPointsYIn", GrowPointsYIn), AnimateExecutor.registerBuiltInAnimate("growPointsYOut", GrowPointsYOut), AnimateExecutor.registerBuiltInAnimate("growAngleIn", GrowAngleIn), AnimateExecutor.registerBuiltInAnimate("growAngleOut", GrowAngleOut), AnimateExecutor.registerBuiltInAnimate("growRadiusIn", GrowRadiusIn), AnimateExecutor.registerBuiltInAnimate("growRadiusOut", GrowRadiusOut), AnimateExecutor.registerBuiltInAnimate("moveIn", MoveIn), AnimateExecutor.registerBuiltInAnimate("moveOut", MoveOut), AnimateExecutor.registerBuiltInAnimate("rotateIn", RotateIn), AnimateExecutor.registerBuiltInAnimate("rotateOut", RotateOut), AnimateExecutor.registerBuiltInAnimate("update", Update), AnimateExecutor.registerBuiltInAnimate("state", State), AnimateExecutor.registerBuiltInAnimate("labelItemAppear", LabelItemAppear), AnimateExecutor.registerBuiltInAnimate("labelItemDisappear", LabelItemDisappear), AnimateExecutor.registerBuiltInAnimate("poptipAppear", PoptipAppear), AnimateExecutor.registerBuiltInAnimate("poptipDisappear", PoptipDisappear), AnimateExecutor.registerBuiltInAnimate("inputText", InputText), AnimateExecutor.registerBuiltInAnimate("inputRichText", InputRichText), AnimateExecutor.registerBuiltInAnimate("outputRichText", OutputRichText), AnimateExecutor.registerBuiltInAnimate("slideRichText", SlideRichText), AnimateExecutor.registerBuiltInAnimate("slideOutRichText", SlideOutRichText), AnimateExecutor.registerBuiltInAnimate("slideIn", SlideIn), AnimateExecutor.registerBuiltInAnimate("growIn", GrowIn), AnimateExecutor.registerBuiltInAnimate("spinIn", SpinIn), AnimateExecutor.registerBuiltInAnimate("moveScaleIn", MoveScaleIn), AnimateExecutor.registerBuiltInAnimate("moveRotateIn", MoveRotateIn), AnimateExecutor.registerBuiltInAnimate("strokeIn", StrokeIn), AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut), AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut), AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut), AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut), AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut), AnimateExecutor.registerBuiltInAnimate("strokeOut", StrokeOut), AnimateExecutor.registerBuiltInAnimate("pulse", PulseAnimate), AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath), AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight), AnimateExecutor.registerBuiltInAnimate("dissolve", Dissolve), AnimateExecutor.registerBuiltInAnimate("grayscale", Grayscale), AnimateExecutor.registerBuiltInAnimate("distortion", Distortion), AnimateExecutor.registerBuiltInAnimate("particle", Particle), AnimateExecutor.registerBuiltInAnimate("glitch", Glitch), AnimateExecutor.registerBuiltInAnimate("gaussianBlur", GaussianBlur), AnimateExecutor.registerBuiltInAnimate("pixelation", Pixelation);
|
|
36448
36459
|
};
|
|
36449
36460
|
|
|
36450
|
-
const version = "1.0.
|
|
36461
|
+
const version = "1.0.14";
|
|
36451
36462
|
preLoadAllModule();
|
|
36452
36463
|
if (isBrowserEnv()) {
|
|
36453
36464
|
loadBrowserEnv(container);
|
package/dist/index.js
CHANGED
|
@@ -4899,6 +4899,9 @@
|
|
|
4899
4899
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4900
4900
|
};
|
|
4901
4901
|
let ATextMeasure = class {
|
|
4902
|
+
constructor() {
|
|
4903
|
+
this.id = "ATextMeasure";
|
|
4904
|
+
}
|
|
4902
4905
|
configure(service, env) {
|
|
4903
4906
|
this.canvas = service.canvas, this.context = service.context, service.bindTextMeasure(this);
|
|
4904
4907
|
}
|
|
@@ -5291,7 +5294,11 @@
|
|
|
5291
5294
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5292
5295
|
};
|
|
5293
5296
|
const TextMeasureContribution = Symbol.for("TextMeasureContribution");
|
|
5294
|
-
exports.DefaultTextMeasureContribution = class DefaultTextMeasureContribution extends ATextMeasure {
|
|
5297
|
+
exports.DefaultTextMeasureContribution = class DefaultTextMeasureContribution extends ATextMeasure {
|
|
5298
|
+
constructor() {
|
|
5299
|
+
super(...arguments), this.id = "DefaultTextMeasureContribution";
|
|
5300
|
+
}
|
|
5301
|
+
};
|
|
5295
5302
|
exports.DefaultTextMeasureContribution = __decorate$1L([injectable()], exports.DefaultTextMeasureContribution);
|
|
5296
5303
|
|
|
5297
5304
|
const container = new Container();
|
|
@@ -5878,13 +5885,17 @@
|
|
|
5878
5885
|
return this.tryInitCanvas(), this._context;
|
|
5879
5886
|
}
|
|
5880
5887
|
constructor(contributions) {
|
|
5881
|
-
this.contributions = contributions, this.configured = !1, this.global = application.global, this.global.hooks.onSetEnv.tap("graphic-util", (lastEnv, env, global) => {
|
|
5888
|
+
this.contributions = contributions, this.configured = !1, this.global = application.global, this._textMeasureMap = new Map(), this.global.hooks.onSetEnv.tap("graphic-util", (lastEnv, env, global) => {
|
|
5882
5889
|
this.configured = !1, this.configure(global, env);
|
|
5883
5890
|
});
|
|
5884
5891
|
}
|
|
5885
5892
|
get textMeasure() {
|
|
5886
5893
|
return this._textMeasure || this.configure(this.global, this.global.env), this._textMeasure;
|
|
5887
5894
|
}
|
|
5895
|
+
getTextMeasureInstance(textMeasureId) {
|
|
5896
|
+
if (!textMeasureId) return this.textMeasure;
|
|
5897
|
+
return this._textMeasureMap.get(textMeasureId) || this.textMeasure;
|
|
5898
|
+
}
|
|
5888
5899
|
configure(global, env) {
|
|
5889
5900
|
this.configured || (this.contributions.getContributions().forEach(contribution => {
|
|
5890
5901
|
contribution.configure(this, env);
|
|
@@ -5897,7 +5908,7 @@
|
|
|
5897
5908
|
}
|
|
5898
5909
|
}
|
|
5899
5910
|
bindTextMeasure(tm) {
|
|
5900
|
-
this._textMeasure = tm;
|
|
5911
|
+
this._textMeasure && "DefaultTextMeasureContribution" !== tm.id || (this._textMeasure = tm), this._textMeasureMap.has(tm.id) || this._textMeasureMap.set(tm.id, tm);
|
|
5901
5912
|
}
|
|
5902
5913
|
measureText(text, tc, method = "native") {
|
|
5903
5914
|
var _a;
|
|
@@ -10690,7 +10701,7 @@
|
|
|
10690
10701
|
this.cache.layoutData.lines.forEach(item => {
|
|
10691
10702
|
mergedText += item.str;
|
|
10692
10703
|
});
|
|
10693
|
-
return (Array.isArray(text) ? text.join("") : text) !== mergedText;
|
|
10704
|
+
return (Array.isArray(text) ? text.join("") : text).toString() !== mergedText;
|
|
10694
10705
|
}
|
|
10695
10706
|
return "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(item => item.text).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString();
|
|
10696
10707
|
}
|
|
@@ -10789,7 +10800,7 @@
|
|
|
10789
10800
|
return fontSize ? .1 * fontSize : 0;
|
|
10790
10801
|
}
|
|
10791
10802
|
updateHorizontalMultilineAABBBounds(text) {
|
|
10792
|
-
var _a;
|
|
10803
|
+
var _a, _b;
|
|
10793
10804
|
const textTheme = this.getGraphicTheme(),
|
|
10794
10805
|
attribute = this.attribute,
|
|
10795
10806
|
{
|
|
@@ -10816,7 +10827,7 @@
|
|
|
10816
10827
|
const bbox = this.cache.layoutData.bbox;
|
|
10817
10828
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10818
10829
|
}
|
|
10819
|
-
const textMeasure = application.graphicUtil.
|
|
10830
|
+
const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_b = this.stage) || void 0 === _b ? void 0 : _b.textMeasureId)),
|
|
10820
10831
|
layoutData = new CanvasTextLayout(fontFamily, {
|
|
10821
10832
|
fontSize: fontSize,
|
|
10822
10833
|
fontWeight: fontWeight,
|
|
@@ -10834,7 +10845,7 @@
|
|
|
10834
10845
|
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10835
10846
|
}
|
|
10836
10847
|
updateWrapAABBBounds(text) {
|
|
10837
|
-
var _a, _b, _c;
|
|
10848
|
+
var _a, _b, _c, _d;
|
|
10838
10849
|
const textTheme = this.getGraphicTheme(),
|
|
10839
10850
|
{
|
|
10840
10851
|
fontFamily = textTheme.fontFamily,
|
|
@@ -10860,7 +10871,7 @@
|
|
|
10860
10871
|
const bbox = this.cache.layoutData.bbox;
|
|
10861
10872
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10862
10873
|
}
|
|
10863
|
-
const textMeasure = application.graphicUtil.
|
|
10874
|
+
const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_b = this.stage) || void 0 === _b ? void 0 : _b.textMeasureId)),
|
|
10864
10875
|
textOptions = {
|
|
10865
10876
|
fontSize: fontSize,
|
|
10866
10877
|
fontWeight: fontWeight,
|
|
@@ -10892,7 +10903,7 @@
|
|
|
10892
10903
|
if ("" !== str && "" === clip.str || clip.wordBreaked) {
|
|
10893
10904
|
if (ellipsis) {
|
|
10894
10905
|
const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
10895
|
-
clip.str = null !== (
|
|
10906
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
10896
10907
|
} else clip.str = "", clip.width = 0;
|
|
10897
10908
|
needCut = !1;
|
|
10898
10909
|
}
|
|
@@ -10955,9 +10966,9 @@
|
|
|
10955
10966
|
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10956
10967
|
}
|
|
10957
10968
|
updateVerticalMultilineAABBBounds(text) {
|
|
10958
|
-
var _a, _b;
|
|
10969
|
+
var _a, _b, _c;
|
|
10959
10970
|
const textTheme = this.getGraphicTheme(),
|
|
10960
|
-
textMeasure = application.graphicUtil.
|
|
10971
|
+
textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_a = this.stage) || void 0 === _a ? void 0 : _a.textMeasureId));
|
|
10961
10972
|
let width;
|
|
10962
10973
|
const attribute = this.attribute,
|
|
10963
10974
|
{
|
|
@@ -10978,7 +10989,7 @@
|
|
|
10978
10989
|
} = attribute;
|
|
10979
10990
|
if (!verticalMode) {
|
|
10980
10991
|
const t = textAlign;
|
|
10981
|
-
textAlign = null !== (
|
|
10992
|
+
textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
|
|
10982
10993
|
}
|
|
10983
10994
|
if (width = 0, !this.shouldUpdateShape() && this.cache) {
|
|
10984
10995
|
this.cache.verticalList.forEach(item => {
|
|
@@ -11092,7 +11103,7 @@
|
|
|
11092
11103
|
return isArray$1(text) ? !text.every(t => null == t || "" === t) : null != text && "" !== text;
|
|
11093
11104
|
}
|
|
11094
11105
|
updateMultilineAABBBounds(text) {
|
|
11095
|
-
var _a, _b, _c, _d;
|
|
11106
|
+
var _a, _b, _c, _d, _e;
|
|
11096
11107
|
const textTheme = this.getGraphicTheme(),
|
|
11097
11108
|
{
|
|
11098
11109
|
fontFamily = textTheme.fontFamily,
|
|
@@ -11116,7 +11127,7 @@
|
|
|
11116
11127
|
const bbox = this.cache.layoutData.bbox;
|
|
11117
11128
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
11118
11129
|
}
|
|
11119
|
-
const textMeasure = application.graphicUtil.
|
|
11130
|
+
const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_c = this.stage) || void 0 === _c ? void 0 : _c.textMeasureId)),
|
|
11120
11131
|
layoutObj = new CanvasTextLayout(fontFamily, {
|
|
11121
11132
|
fontSize: fontSize,
|
|
11122
11133
|
fontWeight: fontWeight,
|
|
@@ -11145,7 +11156,7 @@
|
|
|
11145
11156
|
if ("" !== str && "" === clip.str) {
|
|
11146
11157
|
if (ellipsis) {
|
|
11147
11158
|
const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
11148
|
-
clip.str = null !== (
|
|
11159
|
+
clip.str = null !== (_d = clipEllipsis.str) && void 0 !== _d ? _d : "", clip.width = null !== (_e = clipEllipsis.width) && void 0 !== _e ? _e : 0;
|
|
11149
11160
|
} else clip.str = "", clip.width = 0;
|
|
11150
11161
|
needCut = !1;
|
|
11151
11162
|
}
|
|
@@ -36453,7 +36464,7 @@
|
|
|
36453
36464
|
AnimateExecutor.registerBuiltInAnimate("increaseCount", IncreaseCount), AnimateExecutor.registerBuiltInAnimate("fromTo", FromTo), AnimateExecutor.registerBuiltInAnimate("scaleIn", ScaleIn), AnimateExecutor.registerBuiltInAnimate("scaleOut", ScaleOut), AnimateExecutor.registerBuiltInAnimate("growHeightIn", GrowHeightIn), AnimateExecutor.registerBuiltInAnimate("growHeightOut", GrowHeightOut), AnimateExecutor.registerBuiltInAnimate("growWidthIn", GrowWidthIn), AnimateExecutor.registerBuiltInAnimate("growWidthOut", GrowWidthOut), AnimateExecutor.registerBuiltInAnimate("growCenterIn", GrowCenterIn), AnimateExecutor.registerBuiltInAnimate("growCenterOut", GrowCenterOut), AnimateExecutor.registerBuiltInAnimate("clipIn", ClipIn), AnimateExecutor.registerBuiltInAnimate("clipOut", ClipOut), AnimateExecutor.registerBuiltInAnimate("fadeIn", FadeIn), AnimateExecutor.registerBuiltInAnimate("fadeOut", FadeOut), AnimateExecutor.registerBuiltInAnimate("growPointsIn", GrowPointsIn), AnimateExecutor.registerBuiltInAnimate("growPointsOut", GrowPointsOut), AnimateExecutor.registerBuiltInAnimate("growPointsXIn", GrowPointsXIn), AnimateExecutor.registerBuiltInAnimate("growPointsXOut", GrowPointsXOut), AnimateExecutor.registerBuiltInAnimate("growPointsYIn", GrowPointsYIn), AnimateExecutor.registerBuiltInAnimate("growPointsYOut", GrowPointsYOut), AnimateExecutor.registerBuiltInAnimate("growAngleIn", GrowAngleIn), AnimateExecutor.registerBuiltInAnimate("growAngleOut", GrowAngleOut), AnimateExecutor.registerBuiltInAnimate("growRadiusIn", GrowRadiusIn), AnimateExecutor.registerBuiltInAnimate("growRadiusOut", GrowRadiusOut), AnimateExecutor.registerBuiltInAnimate("moveIn", MoveIn), AnimateExecutor.registerBuiltInAnimate("moveOut", MoveOut), AnimateExecutor.registerBuiltInAnimate("rotateIn", RotateIn), AnimateExecutor.registerBuiltInAnimate("rotateOut", RotateOut), AnimateExecutor.registerBuiltInAnimate("update", Update), AnimateExecutor.registerBuiltInAnimate("state", State), AnimateExecutor.registerBuiltInAnimate("labelItemAppear", LabelItemAppear), AnimateExecutor.registerBuiltInAnimate("labelItemDisappear", LabelItemDisappear), AnimateExecutor.registerBuiltInAnimate("poptipAppear", PoptipAppear), AnimateExecutor.registerBuiltInAnimate("poptipDisappear", PoptipDisappear), AnimateExecutor.registerBuiltInAnimate("inputText", InputText), AnimateExecutor.registerBuiltInAnimate("inputRichText", InputRichText), AnimateExecutor.registerBuiltInAnimate("outputRichText", OutputRichText), AnimateExecutor.registerBuiltInAnimate("slideRichText", SlideRichText), AnimateExecutor.registerBuiltInAnimate("slideOutRichText", SlideOutRichText), AnimateExecutor.registerBuiltInAnimate("slideIn", SlideIn), AnimateExecutor.registerBuiltInAnimate("growIn", GrowIn), AnimateExecutor.registerBuiltInAnimate("spinIn", SpinIn), AnimateExecutor.registerBuiltInAnimate("moveScaleIn", MoveScaleIn), AnimateExecutor.registerBuiltInAnimate("moveRotateIn", MoveRotateIn), AnimateExecutor.registerBuiltInAnimate("strokeIn", StrokeIn), AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut), AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut), AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut), AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut), AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut), AnimateExecutor.registerBuiltInAnimate("strokeOut", StrokeOut), AnimateExecutor.registerBuiltInAnimate("pulse", PulseAnimate), AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath), AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight), AnimateExecutor.registerBuiltInAnimate("dissolve", Dissolve), AnimateExecutor.registerBuiltInAnimate("grayscale", Grayscale), AnimateExecutor.registerBuiltInAnimate("distortion", Distortion), AnimateExecutor.registerBuiltInAnimate("particle", Particle), AnimateExecutor.registerBuiltInAnimate("glitch", Glitch), AnimateExecutor.registerBuiltInAnimate("gaussianBlur", GaussianBlur), AnimateExecutor.registerBuiltInAnimate("pixelation", Pixelation);
|
|
36454
36465
|
};
|
|
36455
36466
|
|
|
36456
|
-
const version = "1.0.
|
|
36467
|
+
const version = "1.0.14";
|
|
36457
36468
|
preLoadAllModule();
|
|
36458
36469
|
if (isBrowserEnv()) {
|
|
36459
36470
|
loadBrowserEnv(container);
|