@visactor/vrender-core 0.22.0-vstory.9 → 0.22.1
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/allocator/bounds-allocate.js +1 -1
- package/cjs/allocator/canvas-allocate.js +1 -1
- package/cjs/allocator/constants.js +1 -1
- package/cjs/allocator/graphic-allocate.js +1 -1
- package/cjs/allocator/matrix-allocate.js +1 -1
- package/cjs/animate/animate.js +1 -1
- package/cjs/animate/animate.js.map +1 -1
- package/cjs/animate/custom-animate.js +4 -2
- package/cjs/animate/custom-animate.js.map +1 -1
- package/cjs/animate/index.js +1 -2
- package/cjs/color-string/store.js +2 -1
- package/cjs/common/custom-path2d.js +8 -6
- package/cjs/common/custom-path2d.js.map +1 -1
- package/cjs/common/enums.js +1 -2
- package/cjs/common/inversify/annotation/optional.d.ts +2 -0
- package/cjs/common/inversify/annotation/optional.js +14 -0
- package/cjs/common/inversify/annotation/optional.js.map +1 -0
- package/cjs/common/inversify/container.js +9 -6
- package/cjs/common/inversify/container.js.map +1 -1
- package/cjs/common/render-area.d.ts +0 -4
- package/cjs/common/render-area.js +17 -76
- package/cjs/common/render-area.js.map +1 -1
- package/cjs/common/render-curve.d.ts +1 -1
- package/cjs/common/render-curve.js.map +1 -1
- package/cjs/common/segment/step.js +1 -1
- package/cjs/common/segment/step.js.map +1 -1
- package/cjs/common/store.js +1 -1
- package/cjs/common/text.js +1 -2
- package/cjs/common/utils.js +1 -1
- package/cjs/core/application.js +1 -1
- package/cjs/core/camera.js +1 -1
- package/cjs/core/contributions/textMeasure/AtextMeasure.js +10 -0
- package/cjs/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/cjs/core/global.d.ts +3 -0
- package/cjs/core/global.js +7 -1
- package/cjs/core/global.js.map +1 -1
- package/cjs/graphic/bounds.d.ts +2 -2
- package/cjs/graphic/bounds.js.map +1 -1
- package/cjs/graphic/config.js +4 -1
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +1 -1
- package/cjs/graphic/graphic.js +7 -7
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.d.ts +1 -0
- package/cjs/graphic/group.js +5 -0
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/line.js +2 -2
- package/cjs/graphic/line.js.map +1 -1
- package/cjs/graphic/richtext/line.js +2 -2
- package/cjs/graphic/richtext/line.js.map +1 -1
- package/cjs/graphic/richtext/paragraph.d.ts +2 -1
- package/cjs/graphic/richtext/paragraph.js +19 -17
- package/cjs/graphic/richtext/paragraph.js.map +1 -1
- package/cjs/graphic/richtext/utils.d.ts +1 -1
- package/cjs/graphic/richtext/utils.js +6 -7
- package/cjs/graphic/richtext/utils.js.map +1 -1
- package/cjs/graphic/richtext.d.ts +0 -1
- package/cjs/graphic/richtext.js +34 -19
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/graphic/symbol.d.ts +1 -0
- package/cjs/graphic/symbol.js +11 -0
- package/cjs/graphic/symbol.js.map +1 -1
- package/cjs/interface/color.js.map +1 -1
- package/cjs/interface/global.d.ts +1 -0
- package/cjs/interface/global.js.map +1 -1
- package/cjs/interface/graphic/arc.js.map +1 -1
- package/cjs/interface/graphic/area.js.map +1 -1
- package/cjs/interface/graphic/circle.js.map +1 -1
- package/cjs/interface/graphic/group.js.map +1 -1
- package/cjs/interface/graphic/image.js.map +1 -1
- package/cjs/interface/graphic/line.js.map +1 -1
- package/cjs/interface/graphic/polygon.js.map +1 -1
- package/cjs/interface/graphic/rect.js.map +1 -1
- package/cjs/interface/graphic/richText.d.ts +6 -1
- package/cjs/interface/graphic/richText.js.map +1 -1
- package/cjs/interface/graphic/symbol.d.ts +1 -0
- package/cjs/interface/graphic/symbol.js.map +1 -1
- package/cjs/interface/graphic/text.js.map +1 -1
- package/cjs/interface/graphic.d.ts +3 -2
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/plugins/builtin-plugin/edit-module.js +13 -7
- package/cjs/plugins/builtin-plugin/edit-module.js.map +1 -1
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +11 -5
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +209 -158
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
- package/cjs/render/contributions/render/area-render.d.ts +1 -1
- package/cjs/render/contributions/render/area-render.js +16 -36
- package/cjs/render/contributions/render/area-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/base-contribution-render.d.ts +1 -0
- package/cjs/render/contributions/render/contributions/base-contribution-render.js +7 -3
- package/cjs/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/base-texture-contribution-render.d.ts +2 -1
- package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js +20 -3
- package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/group-contribution-render.js +2 -1
- package/cjs/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.d.ts +1 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.js +2 -2
- package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/text-contribution-render.js +3 -2
- package/cjs/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/draw-contribution.js +1 -0
- package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
- package/cjs/render/contributions/render/image-render.js.map +1 -1
- package/cjs/render/contributions/render/line-render.js +9 -31
- package/cjs/render/contributions/render/line-render.js.map +1 -1
- package/cjs/resource-loader/loader.d.ts +2 -2
- package/cjs/resource-loader/loader.js +1 -1
- package/cjs/resource-loader/loader.js.map +1 -1
- package/dist/index.es.js +445 -476
- package/es/allocator/bounds-allocate.js +1 -1
- package/es/allocator/canvas-allocate.js +1 -1
- package/es/allocator/constants.js +1 -1
- package/es/allocator/graphic-allocate.js +1 -1
- package/es/allocator/matrix-allocate.js +1 -1
- package/es/animate/animate.js +4 -3
- package/es/animate/animate.js.map +1 -1
- package/es/animate/custom-animate.js +4 -2
- package/es/animate/custom-animate.js.map +1 -1
- package/es/animate/index.js +1 -2
- package/es/color-string/store.js +2 -1
- package/es/common/custom-path2d.js +8 -6
- package/es/common/custom-path2d.js.map +1 -1
- package/es/common/enums.js +1 -2
- package/es/common/inversify/annotation/optional.d.ts +2 -0
- package/es/common/inversify/annotation/optional.js +12 -0
- package/es/common/inversify/annotation/optional.js.map +1 -0
- package/es/common/inversify/container.js +9 -6
- package/es/common/inversify/container.js.map +1 -1
- package/es/common/render-area.d.ts +0 -4
- package/es/common/render-area.js +18 -77
- package/es/common/render-area.js.map +1 -1
- package/es/common/render-curve.d.ts +1 -1
- package/es/common/render-curve.js.map +1 -1
- package/es/common/segment/step.js +1 -1
- package/es/common/segment/step.js.map +1 -1
- package/es/common/store.js +1 -1
- package/es/common/text.js +1 -2
- package/es/common/utils.js +1 -1
- package/es/core/application.js +1 -1
- package/es/core/camera.js +1 -1
- package/es/core/contributions/textMeasure/AtextMeasure.js +10 -0
- package/es/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/es/core/global.d.ts +3 -0
- package/es/core/global.js +8 -1
- package/es/core/global.js.map +1 -1
- package/es/graphic/bounds.d.ts +2 -2
- package/es/graphic/bounds.js.map +1 -1
- package/es/graphic/config.js +4 -1
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/graphic.d.ts +1 -1
- package/es/graphic/graphic.js +9 -9
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.d.ts +1 -0
- package/es/graphic/group.js +5 -0
- package/es/graphic/group.js.map +1 -1
- package/es/graphic/line.js +2 -2
- package/es/graphic/line.js.map +1 -1
- package/es/graphic/richtext/line.js +2 -2
- package/es/graphic/richtext/line.js.map +1 -1
- package/es/graphic/richtext/paragraph.d.ts +2 -1
- package/es/graphic/richtext/paragraph.js +19 -17
- package/es/graphic/richtext/paragraph.js.map +1 -1
- package/es/graphic/richtext/utils.d.ts +1 -1
- package/es/graphic/richtext/utils.js +6 -7
- package/es/graphic/richtext/utils.js.map +1 -1
- package/es/graphic/richtext.d.ts +0 -1
- package/es/graphic/richtext.js +31 -18
- package/es/graphic/richtext.js.map +1 -1
- package/es/graphic/symbol.d.ts +1 -0
- package/es/graphic/symbol.js +11 -0
- package/es/graphic/symbol.js.map +1 -1
- package/es/interface/color.js.map +1 -1
- package/es/interface/global.d.ts +1 -0
- package/es/interface/global.js.map +1 -1
- package/es/interface/graphic/arc.js.map +1 -1
- package/es/interface/graphic/area.js.map +1 -1
- package/es/interface/graphic/circle.js.map +1 -1
- package/es/interface/graphic/group.js.map +1 -1
- package/es/interface/graphic/image.js.map +1 -1
- package/es/interface/graphic/line.js.map +1 -1
- package/es/interface/graphic/polygon.js.map +1 -1
- package/es/interface/graphic/rect.js.map +1 -1
- package/es/interface/graphic/richText.d.ts +6 -1
- package/es/interface/graphic/richText.js.map +1 -1
- package/es/interface/graphic/symbol.d.ts +1 -0
- package/es/interface/graphic/symbol.js.map +1 -1
- package/es/interface/graphic/text.js.map +1 -1
- package/es/interface/graphic.d.ts +3 -2
- package/es/interface/graphic.js.map +1 -1
- package/es/plugins/builtin-plugin/edit-module.js +13 -7
- package/es/plugins/builtin-plugin/edit-module.js.map +1 -1
- package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +11 -5
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js +209 -158
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
- package/es/render/contributions/render/area-render.d.ts +1 -1
- package/es/render/contributions/render/area-render.js +16 -36
- package/es/render/contributions/render/area-render.js.map +1 -1
- package/es/render/contributions/render/contributions/base-contribution-render.d.ts +1 -0
- package/es/render/contributions/render/contributions/base-contribution-render.js +7 -3
- package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/base-texture-contribution-render.d.ts +2 -1
- package/es/render/contributions/render/contributions/base-texture-contribution-render.js +22 -2
- package/es/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/group-contribution-render.js +2 -1
- package/es/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/image-contribution-render.d.ts +1 -1
- package/es/render/contributions/render/contributions/image-contribution-render.js +2 -2
- package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/text-contribution-render.js +3 -2
- package/es/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
- package/es/render/contributions/render/draw-contribution.js +3 -2
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/es/render/contributions/render/image-render.js.map +1 -1
- package/es/render/contributions/render/line-render.js +9 -31
- package/es/render/contributions/render/line-render.js.map +1 -1
- package/es/resource-loader/loader.d.ts +2 -2
- package/es/resource-loader/loader.js +1 -1
- package/es/resource-loader/loader.js.map +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -607,15 +607,17 @@ class Container {
|
|
|
607
607
|
serviceIdentifier: injectIdentifier,
|
|
608
608
|
constructorArgsMetadata
|
|
609
609
|
};
|
|
610
|
-
const bindings = this._bindingDictionary.get(injectIdentifier).filter(b => {
|
|
610
|
+
const bindings = (this._bindingDictionary.get(injectIdentifier) || []).filter(b => {
|
|
611
611
|
return b.constraint(target);
|
|
612
612
|
});
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
613
|
+
if (bindings.length) {
|
|
614
|
+
const request = {
|
|
615
|
+
injectIdentifier,
|
|
616
|
+
metadata: constructorArgsMetadata,
|
|
617
|
+
bindings: bindings
|
|
618
|
+
};
|
|
619
|
+
arr.push(request);
|
|
620
|
+
}
|
|
619
621
|
}
|
|
620
622
|
return arr;
|
|
621
623
|
}
|
|
@@ -855,6 +857,12 @@ let DefaultGlobal = class DefaultGlobal {
|
|
|
855
857
|
get env() {
|
|
856
858
|
return this._env;
|
|
857
859
|
}
|
|
860
|
+
get isImageAnonymous() {
|
|
861
|
+
return this._isImageAnonymous;
|
|
862
|
+
}
|
|
863
|
+
set isImageAnonymous(isImageAnonymous) {
|
|
864
|
+
this._isImageAnonymous = isImageAnonymous;
|
|
865
|
+
}
|
|
858
866
|
get devicePixelRatio() {
|
|
859
867
|
if (!this._env) {
|
|
860
868
|
this.setEnv(defaultEnv);
|
|
@@ -923,6 +931,7 @@ let DefaultGlobal = class DefaultGlobal {
|
|
|
923
931
|
}
|
|
924
932
|
constructor(contributions) {
|
|
925
933
|
this.contributions = contributions;
|
|
934
|
+
this._isImageAnonymous = true;
|
|
926
935
|
this.id = Generator.GenAutoIncrementId();
|
|
927
936
|
this.hooks = {
|
|
928
937
|
onSetEnv: new SyncHook(['lastEnv', 'env', 'global'])
|
|
@@ -2355,7 +2364,12 @@ let Step$1 = class Step {
|
|
|
2355
2364
|
}
|
|
2356
2365
|
else {
|
|
2357
2366
|
const x1 = this._x * (1 - this._t) + x * this._t;
|
|
2358
|
-
|
|
2367
|
+
if (this._t === 0.5) {
|
|
2368
|
+
this.context.lineTo(x1, this._y, this._lastDefined !== false, this.lastPoint);
|
|
2369
|
+
}
|
|
2370
|
+
else {
|
|
2371
|
+
this.context.lineTo(x1, this._y, this._lastDefined !== false && p.defined !== false, this.lastPoint);
|
|
2372
|
+
}
|
|
2359
2373
|
this.context.lineTo(x1, y, this._lastDefined !== false && p.defined !== false, p);
|
|
2360
2374
|
}
|
|
2361
2375
|
break;
|
|
@@ -2949,24 +2963,40 @@ class CustomPath2D extends CurvePath {
|
|
|
2949
2963
|
case 's':
|
|
2950
2964
|
tempX = x + current[3];
|
|
2951
2965
|
tempY = y + current[4];
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2966
|
+
if (previous[0].match(/[CcSs]/) === null) {
|
|
2967
|
+
controlX = x;
|
|
2968
|
+
controlY = y;
|
|
2969
|
+
}
|
|
2970
|
+
else {
|
|
2971
|
+
controlX = 2 * x - controlX;
|
|
2972
|
+
controlY = 2 * y - controlY;
|
|
2973
|
+
}
|
|
2974
|
+
tempControlX = x + current[1];
|
|
2975
|
+
tempControlY = y + current[2];
|
|
2976
|
+
this.bezierCurveTo(controlX + l, controlY + t, tempControlX + l, tempControlY + t, tempX + l, tempY + t);
|
|
2977
|
+
controlX = tempControlX;
|
|
2978
|
+
controlY = tempControlY;
|
|
2957
2979
|
x = tempX;
|
|
2958
2980
|
y = tempY;
|
|
2959
2981
|
break;
|
|
2960
2982
|
case 'S':
|
|
2961
2983
|
tempX = current[3];
|
|
2962
2984
|
tempY = current[4];
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2985
|
+
if (previous[0].match(/[CcSs]/) === null) {
|
|
2986
|
+
controlX = x;
|
|
2987
|
+
controlY = y;
|
|
2988
|
+
}
|
|
2989
|
+
else {
|
|
2990
|
+
controlX = 2 * x - controlX;
|
|
2991
|
+
controlY = 2 * y - controlY;
|
|
2992
|
+
}
|
|
2993
|
+
tempControlX = current[1];
|
|
2994
|
+
tempControlY = current[2];
|
|
2995
|
+
this.bezierCurveTo(controlX + l, controlY + t, tempControlX + l, tempControlY + t, tempX + l, tempY + t);
|
|
2996
|
+
controlX = tempControlX;
|
|
2997
|
+
controlY = tempControlY;
|
|
2966
2998
|
x = tempX;
|
|
2967
2999
|
y = tempY;
|
|
2968
|
-
controlX = current[1];
|
|
2969
|
-
controlY = current[2];
|
|
2970
3000
|
break;
|
|
2971
3001
|
case 'q':
|
|
2972
3002
|
tempX = x + current[3];
|
|
@@ -3274,7 +3304,7 @@ const DefaultTextStyle = {
|
|
|
3274
3304
|
const DefaultPickStyle = {
|
|
3275
3305
|
pickStrokeBuffer: 0
|
|
3276
3306
|
};
|
|
3277
|
-
const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({ forceBoundsWidth: undefined, forceBoundsHeight: undefined, opacity: 1, background: null, autoAnimateTexture: false, textureRatio:
|
|
3307
|
+
const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({ forceBoundsWidth: undefined, forceBoundsHeight: undefined, opacity: 1, background: null, autoAnimateTexture: false, textureRatio: 1, textureOptions: null, backgroundOpacity: 1, backgroundCornerRadius: 0, texture: null, textureColor: 'black', textureSize: 10, texturePadding: 2, backgroundMode: 'no-repeat', backgroundFit: true, backgroundKeepAspectRatio: false, backgroundClip: true, backgroundScale: 1, backgroundOffsetX: 0, backgroundOffsetY: 0, blur: 0, filter: '', cursor: null, html: null, react: null }, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout), DefaultPickStyle);
|
|
3278
3308
|
const DefaultConnectAttribute = {
|
|
3279
3309
|
connectedType: 'none',
|
|
3280
3310
|
connectedStyle: {},
|
|
@@ -3307,7 +3337,7 @@ const DefaultRectAttribute = Object.assign(Object.assign({}, DefaultAttribute),
|
|
|
3307
3337
|
const DefaultRect3dAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, x1: 0, y1: 0, cornerRadius: 0, length: 0, cornerType: 'round' });
|
|
3308
3338
|
const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), { symbolType: 'circle', size: 10, keepDirIn3d: true, clipRange: 1 });
|
|
3309
3339
|
const DefaultTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), { strokeBoundsBuffer: 0, keepDirIn3d: true });
|
|
3310
|
-
const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), { editable: false, editOptions: null, width: 300, height: 300, ellipsis: true, wordBreak: 'break-word', verticalDirection: 'top', textAlign: 'left', textBaseline: 'top', layoutDirection: 'horizontal', textConfig: [], disableAutoWrapLine: false, maxHeight: undefined, maxWidth: undefined, singleLine: false });
|
|
3340
|
+
const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), { upgradeAttrs: null, editable: false, editOptions: null, ascentDescentMode: 'actual', width: 300, height: 300, ellipsis: true, wordBreak: 'break-word', verticalDirection: 'top', textAlign: 'left', textBaseline: 'top', layoutDirection: 'horizontal', textConfig: [], disableAutoWrapLine: false, maxHeight: undefined, maxWidth: undefined, singleLine: false });
|
|
3311
3341
|
const DefaultImageAttribute = Object.assign(Object.assign({ repeatX: 'no-repeat', repeatY: 'no-repeat', image: '', width: 0, height: 0 }, DefaultAttribute), { fill: true, cornerRadius: 0, cornerType: 'round' });
|
|
3312
3342
|
const DefaultRichTextIconAttribute = Object.assign(Object.assign({}, DefaultImageAttribute), { backgroundShowMode: 'never', backgroundWidth: 0, backgroundHeight: 0, textAlign: 'left', textBaseline: 'middle', direction: 'horizontal', margin: 0, id: '', width: 20, height: 20, backgroundFill: 'rgba(101, 117, 168, 0.1)', backgroundFillOpacity: 1, backgroundStroke: false, backgroundStrokeOpacity: 1, backgroundRadius: 4, opacity: 1 });
|
|
3313
3343
|
|
|
@@ -3922,7 +3952,7 @@ function testLetter2(string, index) {
|
|
|
3922
3952
|
}
|
|
3923
3953
|
return i + 1;
|
|
3924
3954
|
}
|
|
3925
|
-
function measureTextCanvas(text, character) {
|
|
3955
|
+
function measureTextCanvas(text, character, mode = 'actual') {
|
|
3926
3956
|
const textMeasure = application.graphicUtil.textMeasure;
|
|
3927
3957
|
const measurement = textMeasure.measureText(text, character);
|
|
3928
3958
|
const result = {
|
|
@@ -3931,16 +3961,18 @@ function measureTextCanvas(text, character) {
|
|
|
3931
3961
|
descent: 0,
|
|
3932
3962
|
width: 0
|
|
3933
3963
|
};
|
|
3934
|
-
|
|
3935
|
-
|
|
3964
|
+
const ascent = mode === 'actual' ? measurement.actualBoundingBoxAscent : measurement.fontBoundingBoxAscent;
|
|
3965
|
+
const descent = mode === 'actual' ? measurement.actualBoundingBoxDescent : measurement.fontBoundingBoxDescent;
|
|
3966
|
+
if (typeof ascent !== 'number' || typeof descent !== 'number') {
|
|
3967
|
+
result.width = Math.floor(measurement.width);
|
|
3936
3968
|
result.height = character.fontSize || 0;
|
|
3937
3969
|
result.ascent = result.height;
|
|
3938
3970
|
result.descent = 0;
|
|
3939
3971
|
}
|
|
3940
3972
|
else {
|
|
3941
|
-
result.width = measurement.width;
|
|
3942
|
-
result.height = Math.floor(
|
|
3943
|
-
result.ascent = Math.floor(
|
|
3973
|
+
result.width = Math.floor(measurement.width);
|
|
3974
|
+
result.height = Math.floor(ascent + descent);
|
|
3975
|
+
result.ascent = Math.floor(ascent);
|
|
3944
3976
|
result.descent = result.height - result.ascent;
|
|
3945
3977
|
}
|
|
3946
3978
|
return result;
|
|
@@ -3967,6 +3999,9 @@ let ATextMeasure = class ATextMeasure {
|
|
|
3967
3999
|
metrics.actualBoundingBoxDescent == null ||
|
|
3968
4000
|
metrics.fontBoundingBoxAscent == null ||
|
|
3969
4001
|
metrics.fontBoundingBoxDescent == null) {
|
|
4002
|
+
metrics = {
|
|
4003
|
+
width: metrics.width
|
|
4004
|
+
};
|
|
3970
4005
|
const { ascent, descent } = this.measureTextBoundADscentEstimate(options);
|
|
3971
4006
|
metrics.actualBoundingBoxAscent = ascent;
|
|
3972
4007
|
metrics.actualBoundingBoxDescent = descent;
|
|
@@ -3974,6 +4009,13 @@ let ATextMeasure = class ATextMeasure {
|
|
|
3974
4009
|
metrics.fontBoundingBoxDescent = descent;
|
|
3975
4010
|
}
|
|
3976
4011
|
if (metrics.actualBoundingBoxLeft == null || metrics.actualBoundingBoxRight == null) {
|
|
4012
|
+
metrics = {
|
|
4013
|
+
width: metrics.width,
|
|
4014
|
+
actualBoundingBoxAscent: metrics.actualBoundingBoxAscent,
|
|
4015
|
+
actualBoundingBoxDescent: metrics.actualBoundingBoxDescent,
|
|
4016
|
+
fontBoundingBoxAscent: metrics.fontBoundingBoxAscent,
|
|
4017
|
+
fontBoundingBoxDescent: metrics.fontBoundingBoxDescent
|
|
4018
|
+
};
|
|
3977
4019
|
const { left, right } = this.measureTextBoundLeftRightEstimate(options);
|
|
3978
4020
|
metrics.actualBoundingBoxLeft = left;
|
|
3979
4021
|
metrics.actualBoundingBoxRight = right;
|
|
@@ -8287,7 +8329,7 @@ class CbAnimate extends ACustomAnimate {
|
|
|
8287
8329
|
class Animate {
|
|
8288
8330
|
constructor(id = Generator.GenAutoIncrementId(), timeline = defaultTimeline, slience) {
|
|
8289
8331
|
this.id = id;
|
|
8290
|
-
this.timeline = timeline;
|
|
8332
|
+
this.timeline = timeline || defaultTimeline;
|
|
8291
8333
|
this.status = AnimateStatus.INITIAL;
|
|
8292
8334
|
this.tailAnimate = new SubAnimate(this);
|
|
8293
8335
|
this.subAnimates = [this.tailAnimate];
|
|
@@ -9173,11 +9215,12 @@ class IncreaseCount extends ACustomAnimate {
|
|
|
9173
9215
|
return;
|
|
9174
9216
|
}
|
|
9175
9217
|
onUpdate(end, ratio, out) {
|
|
9218
|
+
var _a;
|
|
9176
9219
|
if (this.valid === false) {
|
|
9177
9220
|
return;
|
|
9178
9221
|
}
|
|
9179
9222
|
if (end) {
|
|
9180
|
-
out.text = this.
|
|
9223
|
+
out.text = (_a = this.to) === null || _a === void 0 ? void 0 : _a.text;
|
|
9181
9224
|
}
|
|
9182
9225
|
else {
|
|
9183
9226
|
out.text = (this.fromNumber + (this.toNumber - this.fromNumber) * ratio).toFixed(this.decimalLength);
|
|
@@ -11729,10 +11772,10 @@ class ResourceLoader {
|
|
|
11729
11772
|
static GetFile(url, type) {
|
|
11730
11773
|
let data = ResourceLoader.cache.get(url);
|
|
11731
11774
|
if (data) {
|
|
11732
|
-
if (data.loadState === '
|
|
11775
|
+
if (data.loadState === 'fail') {
|
|
11733
11776
|
return Promise.reject();
|
|
11734
11777
|
}
|
|
11735
|
-
else if (data.loadState === 'loading') {
|
|
11778
|
+
else if (data.loadState === 'init' || data.loadState === 'loading') {
|
|
11736
11779
|
return data.dataPromise.then(data => data.data);
|
|
11737
11780
|
}
|
|
11738
11781
|
return Promise.resolve(data.data);
|
|
@@ -12385,6 +12428,7 @@ class Graphic extends Node {
|
|
|
12385
12428
|
}
|
|
12386
12429
|
this.animates.set(animate.id, animate);
|
|
12387
12430
|
animate.onRemove(() => {
|
|
12431
|
+
animate.stop();
|
|
12388
12432
|
this.animates.delete(animate.id);
|
|
12389
12433
|
});
|
|
12390
12434
|
return animate;
|
|
@@ -12506,10 +12550,12 @@ class Graphic extends Node {
|
|
|
12506
12550
|
this.normalAttrs = null;
|
|
12507
12551
|
}
|
|
12508
12552
|
removeState(stateName, hasAnimation) {
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
const
|
|
12512
|
-
this.
|
|
12553
|
+
if (this.currentStates) {
|
|
12554
|
+
const filter = isArray(stateName) ? (s) => !stateName.includes(s) : (s) => s !== stateName;
|
|
12555
|
+
const newStates = this.currentStates.filter(filter);
|
|
12556
|
+
if (newStates.length !== this.currentStates.length) {
|
|
12557
|
+
this.useStates(newStates, hasAnimation);
|
|
12558
|
+
}
|
|
12513
12559
|
}
|
|
12514
12560
|
}
|
|
12515
12561
|
toggleState(stateName, hasAnimation) {
|
|
@@ -12685,7 +12731,9 @@ class Graphic extends Node {
|
|
|
12685
12731
|
if (this.animates && this.animates.size) {
|
|
12686
12732
|
const timeline = stage.getTimeline();
|
|
12687
12733
|
this.animates.forEach(a => {
|
|
12688
|
-
a.
|
|
12734
|
+
if (a.timeline === defaultTimeline) {
|
|
12735
|
+
a.setTimeline(timeline);
|
|
12736
|
+
}
|
|
12689
12737
|
});
|
|
12690
12738
|
}
|
|
12691
12739
|
this._onSetStage && this._onSetStage(this, stage, layer);
|
|
@@ -12859,6 +12907,7 @@ class Graphic extends Node {
|
|
|
12859
12907
|
detachShadow() {
|
|
12860
12908
|
if (this.shadowRoot) {
|
|
12861
12909
|
this.addUpdateBoundTag();
|
|
12910
|
+
this.shadowRoot.release(true);
|
|
12862
12911
|
this.shadowRoot = null;
|
|
12863
12912
|
}
|
|
12864
12913
|
}
|
|
@@ -12966,6 +13015,7 @@ class Graphic extends Node {
|
|
|
12966
13015
|
}
|
|
12967
13016
|
release() {
|
|
12968
13017
|
this.releaseStatus = 'released';
|
|
13018
|
+
this.stopAnimates();
|
|
12969
13019
|
application.graphicService.onRelease(this);
|
|
12970
13020
|
}
|
|
12971
13021
|
_emitCustomEvent(type, context) {
|
|
@@ -13780,6 +13830,14 @@ class Group extends Graphic {
|
|
|
13780
13830
|
getNoWorkAnimateAttr() {
|
|
13781
13831
|
return Group.NOWORK_ANIMATE_ATTR;
|
|
13782
13832
|
}
|
|
13833
|
+
release(all) {
|
|
13834
|
+
if (all) {
|
|
13835
|
+
this.forEachChildren((g) => {
|
|
13836
|
+
g.release(all);
|
|
13837
|
+
});
|
|
13838
|
+
}
|
|
13839
|
+
super.release();
|
|
13840
|
+
}
|
|
13783
13841
|
}
|
|
13784
13842
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
13785
13843
|
function createGroup(attributes) {
|
|
@@ -17018,6 +17076,20 @@ let Symbol$1 = class Symbol extends Graphic {
|
|
|
17018
17076
|
}
|
|
17019
17077
|
return this._parsedPath;
|
|
17020
17078
|
}
|
|
17079
|
+
getParsedPath2D(x = 0, y = 0, size = 1) {
|
|
17080
|
+
let path = null;
|
|
17081
|
+
try {
|
|
17082
|
+
path = new Path2D();
|
|
17083
|
+
}
|
|
17084
|
+
catch (err) {
|
|
17085
|
+
return null;
|
|
17086
|
+
}
|
|
17087
|
+
const parsedPath = this.getParsedPath();
|
|
17088
|
+
if (!parsedPath) {
|
|
17089
|
+
return null;
|
|
17090
|
+
}
|
|
17091
|
+
parsedPath.draw(path, size, x, y);
|
|
17092
|
+
}
|
|
17021
17093
|
isValid() {
|
|
17022
17094
|
return super.isValid() && this._isValid();
|
|
17023
17095
|
}
|
|
@@ -17198,7 +17270,7 @@ let Line$1 = class Line extends Graphic {
|
|
|
17198
17270
|
const { points = lineTheme.points, connectedType } = attribute;
|
|
17199
17271
|
const b = aabbBounds;
|
|
17200
17272
|
points.forEach(p => {
|
|
17201
|
-
if (p.defined !== false || connectedType === '
|
|
17273
|
+
if (p.defined !== false || connectedType === 'connect') {
|
|
17202
17274
|
b.add(p.x, p.y);
|
|
17203
17275
|
}
|
|
17204
17276
|
});
|
|
@@ -17209,7 +17281,7 @@ let Line$1 = class Line extends Graphic {
|
|
|
17209
17281
|
const b = aabbBounds;
|
|
17210
17282
|
segments.forEach(s => {
|
|
17211
17283
|
s.points.forEach(p => {
|
|
17212
|
-
if (p.defined !== false || connectedType === '
|
|
17284
|
+
if (p.defined !== false || connectedType === 'connect') {
|
|
17213
17285
|
b.add(p.x, p.y);
|
|
17214
17286
|
}
|
|
17215
17287
|
});
|
|
@@ -17844,17 +17916,22 @@ function getFixedLRTB(left, right, top, bottom) {
|
|
|
17844
17916
|
const topInt = Math.round(top);
|
|
17845
17917
|
const rightInt = Math.round(right);
|
|
17846
17918
|
const bottomInt = Math.round(bottom);
|
|
17919
|
+
const _left = left > leftInt ? leftInt : leftInt - 0.5;
|
|
17920
|
+
const _top = top > topInt ? topInt : topInt - 0.5;
|
|
17921
|
+
const _right = rightInt > right ? rightInt : rightInt + 0.5;
|
|
17922
|
+
const _bottom = bottomInt > bottom ? bottomInt : bottomInt + 0.5;
|
|
17847
17923
|
return {
|
|
17848
|
-
left:
|
|
17849
|
-
top:
|
|
17850
|
-
right:
|
|
17851
|
-
bottom:
|
|
17924
|
+
left: _left,
|
|
17925
|
+
top: _top,
|
|
17926
|
+
right: _right,
|
|
17927
|
+
bottom: _bottom
|
|
17852
17928
|
};
|
|
17853
17929
|
}
|
|
17854
17930
|
class Paragraph {
|
|
17855
|
-
constructor(text, newLine, character) {
|
|
17931
|
+
constructor(text, newLine, character, ascentDescentMode) {
|
|
17856
17932
|
this.fontSize = character.fontSize || 16;
|
|
17857
17933
|
this.textBaseline = character.textBaseline || 'alphabetic';
|
|
17934
|
+
this.ascentDescentMode = ascentDescentMode;
|
|
17858
17935
|
const lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
|
|
17859
17936
|
if (typeof lineHeight === 'number') {
|
|
17860
17937
|
this.lineHeight = lineHeight > this.fontSize ? lineHeight : this.fontSize;
|
|
@@ -17863,7 +17940,7 @@ class Paragraph {
|
|
|
17863
17940
|
this.lineHeight = Math.floor(1.2 * this.fontSize);
|
|
17864
17941
|
}
|
|
17865
17942
|
this.height = this.lineHeight;
|
|
17866
|
-
const { ascent, height, descent, width } = measureTextCanvas(text, character);
|
|
17943
|
+
const { ascent, height, descent, width } = measureTextCanvas(text, character, this.ascentDescentMode);
|
|
17867
17944
|
let halfDetaHeight = 0;
|
|
17868
17945
|
let deltaAscent = 0;
|
|
17869
17946
|
let deltaDescent = 0;
|
|
@@ -17909,7 +17986,7 @@ class Paragraph {
|
|
|
17909
17986
|
this.ellipsisStr = '...';
|
|
17910
17987
|
}
|
|
17911
17988
|
updateWidth() {
|
|
17912
|
-
const { width } = measureTextCanvas(this.text, this.character);
|
|
17989
|
+
const { width } = measureTextCanvas(this.text, this.character, this.ascentDescentMode);
|
|
17913
17990
|
this.width = width;
|
|
17914
17991
|
if (this.direction === 'vertical') {
|
|
17915
17992
|
this.widthOrigin = this.width;
|
|
@@ -17918,7 +17995,10 @@ class Paragraph {
|
|
|
17918
17995
|
}
|
|
17919
17996
|
}
|
|
17920
17997
|
drawBackground(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
|
|
17921
|
-
if (!(this.
|
|
17998
|
+
if (!(this.text !== '' &&
|
|
17999
|
+
this.text !== '\n' &&
|
|
18000
|
+
this.character.background &&
|
|
18001
|
+
(!this.character.backgroundOpacity || this.character.backgroundOpacity > 0))) {
|
|
17922
18002
|
return;
|
|
17923
18003
|
}
|
|
17924
18004
|
let baseline = top + ascent;
|
|
@@ -17945,7 +18025,7 @@ class Paragraph {
|
|
|
17945
18025
|
text = text.slice(0, index);
|
|
17946
18026
|
text += this.ellipsisStr;
|
|
17947
18027
|
if (textAlign === 'right' || textAlign === 'end') {
|
|
17948
|
-
const { width } = measureTextCanvas(this.text.slice(index), this.character);
|
|
18028
|
+
const { width } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
|
|
17949
18029
|
if (direction === 'vertical') ;
|
|
17950
18030
|
else {
|
|
17951
18031
|
left -= this.ellipsisWidth - width;
|
|
@@ -17982,7 +18062,7 @@ class Paragraph {
|
|
|
17982
18062
|
text = text.slice(0, index);
|
|
17983
18063
|
text += this.ellipsisStr;
|
|
17984
18064
|
if (textAlign === 'right' || textAlign === 'end') {
|
|
17985
|
-
const { width } = measureTextCanvas(this.text.slice(index), this.character);
|
|
18065
|
+
const { width } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
|
|
17986
18066
|
if (direction === 'vertical') ;
|
|
17987
18067
|
else {
|
|
17988
18068
|
left -= this.ellipsisWidth - width;
|
|
@@ -18019,14 +18099,14 @@ class Paragraph {
|
|
|
18019
18099
|
const right = left + (this.widthOrigin || this.width);
|
|
18020
18100
|
const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
|
|
18021
18101
|
const lrtb = getFixedLRTB(left, right, top, bottom);
|
|
18022
|
-
ctx.fillRect(lrtb.left,
|
|
18102
|
+
ctx.fillRect(lrtb.left, 1 + baseline, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
|
|
18023
18103
|
}
|
|
18024
18104
|
if (this.character.lineThrough) {
|
|
18025
18105
|
const top = 1 + baseline - this.ascent / 2;
|
|
18026
18106
|
const right = left + (this.widthOrigin || this.width);
|
|
18027
18107
|
const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
|
|
18028
18108
|
const lrtb = getFixedLRTB(left, right, top, bottom);
|
|
18029
|
-
ctx.fillRect(lrtb.left,
|
|
18109
|
+
ctx.fillRect(lrtb.left, 1 + baseline - this.ascent / 2, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
|
|
18030
18110
|
}
|
|
18031
18111
|
}
|
|
18032
18112
|
else if (this.character.textDecoration === 'underline') {
|
|
@@ -18034,14 +18114,14 @@ class Paragraph {
|
|
|
18034
18114
|
const right = left + (this.widthOrigin || this.width);
|
|
18035
18115
|
const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
|
|
18036
18116
|
const lrtb = getFixedLRTB(left, right, top, bottom);
|
|
18037
|
-
ctx.fillRect(lrtb.left,
|
|
18117
|
+
ctx.fillRect(lrtb.left, 1 + baseline, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
|
|
18038
18118
|
}
|
|
18039
18119
|
else if (this.character.textDecoration === 'line-through') {
|
|
18040
18120
|
const top = 1 + baseline - this.ascent / 2;
|
|
18041
18121
|
const right = left + (this.widthOrigin || this.width);
|
|
18042
18122
|
const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
|
|
18043
18123
|
const lrtb = getFixedLRTB(left, right, top, bottom);
|
|
18044
|
-
ctx.fillRect(lrtb.left,
|
|
18124
|
+
ctx.fillRect(lrtb.left, 1 + baseline - this.ascent / 2, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
|
|
18045
18125
|
}
|
|
18046
18126
|
}
|
|
18047
18127
|
if (direction === 'vertical') {
|
|
@@ -18061,7 +18141,7 @@ class Paragraph {
|
|
|
18061
18141
|
const index = getStrByWithCanvas(text, width - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
|
|
18062
18142
|
text = text.slice(0, index);
|
|
18063
18143
|
text += this.ellipsisStr;
|
|
18064
|
-
const { width: measureWidth } = measureTextCanvas(this.text.slice(index), this.character);
|
|
18144
|
+
const { width: measureWidth } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
|
|
18065
18145
|
return width + this.ellipsisWidth - measureWidth;
|
|
18066
18146
|
}
|
|
18067
18147
|
return width;
|
|
@@ -18070,8 +18150,8 @@ class Paragraph {
|
|
|
18070
18150
|
function seperateParagraph(paragraph, index) {
|
|
18071
18151
|
const text1 = paragraph.text.slice(0, index);
|
|
18072
18152
|
const text2 = paragraph.text.slice(index);
|
|
18073
|
-
const p1 = new Paragraph(text1, paragraph.newLine, paragraph.character);
|
|
18074
|
-
const p2 = new Paragraph(text2, true, paragraph.character);
|
|
18153
|
+
const p1 = new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode);
|
|
18154
|
+
const p2 = new Paragraph(text2, true, paragraph.character, paragraph.ascentDescentMode);
|
|
18075
18155
|
return [p1, p2];
|
|
18076
18156
|
}
|
|
18077
18157
|
|
|
@@ -18361,7 +18441,7 @@ class Line {
|
|
|
18361
18441
|
}
|
|
18362
18442
|
const ellipsis = drawEllipsis === true ? '...' : drawEllipsis || '';
|
|
18363
18443
|
paragraph.ellipsisStr = ellipsis;
|
|
18364
|
-
const { width } = measureTextCanvas(ellipsis, paragraph.character);
|
|
18444
|
+
const { width } = measureTextCanvas(ellipsis, paragraph.character, paragraph.ascentDescentMode);
|
|
18365
18445
|
const ellipsisWidth = width || 0;
|
|
18366
18446
|
if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
|
|
18367
18447
|
lastLine && (paragraph.ellipsis = 'add');
|
|
@@ -18437,7 +18517,7 @@ class Line {
|
|
|
18437
18517
|
if (paragraph instanceof RichTextIcon) {
|
|
18438
18518
|
break;
|
|
18439
18519
|
}
|
|
18440
|
-
const { width } = measureTextCanvas(ellipsis, paragraph.character);
|
|
18520
|
+
const { width } = measureTextCanvas(ellipsis, paragraph.character, paragraph.ascentDescentMode);
|
|
18441
18521
|
const ellipsisWidth = width || 0;
|
|
18442
18522
|
if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
|
|
18443
18523
|
paragraph.ellipsis = 'add';
|
|
@@ -18598,6 +18678,13 @@ class Wrapper {
|
|
|
18598
18678
|
}
|
|
18599
18679
|
}
|
|
18600
18680
|
|
|
18681
|
+
let supportIntl = false;
|
|
18682
|
+
try {
|
|
18683
|
+
supportIntl = Intl && typeof Intl.Segmenter === 'function';
|
|
18684
|
+
}
|
|
18685
|
+
catch (e) {
|
|
18686
|
+
supportIntl = false;
|
|
18687
|
+
}
|
|
18601
18688
|
const RICHTEXT_UPDATE_TAG_KEY = [
|
|
18602
18689
|
'width',
|
|
18603
18690
|
'height',
|
|
@@ -18757,15 +18844,14 @@ class RichText extends Graphic {
|
|
|
18757
18844
|
return tc.every(item => item.isComposing ||
|
|
18758
18845
|
!(item.text && isString(item.text) && RichText.splitText(item.text).length > 1));
|
|
18759
18846
|
}
|
|
18760
|
-
static splitEmoji(text) {
|
|
18761
|
-
return [...new Intl.Segmenter().segment(text)].map(x => x.segment);
|
|
18762
|
-
}
|
|
18763
18847
|
static splitText(text) {
|
|
18764
|
-
|
|
18765
|
-
const
|
|
18766
|
-
|
|
18767
|
-
|
|
18768
|
-
|
|
18848
|
+
if (supportIntl) {
|
|
18849
|
+
const segmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
|
|
18850
|
+
const segments = [];
|
|
18851
|
+
for (const { segment } of segmenter.segment(text)) {
|
|
18852
|
+
segments.push(segment);
|
|
18853
|
+
}
|
|
18854
|
+
return segments;
|
|
18769
18855
|
}
|
|
18770
18856
|
return Array.from(text);
|
|
18771
18857
|
}
|
|
@@ -18786,8 +18872,8 @@ class RichText extends Graphic {
|
|
|
18786
18872
|
return tc;
|
|
18787
18873
|
}
|
|
18788
18874
|
updateAABBBounds(attribute, richtextTheme, aabbBounds) {
|
|
18789
|
-
var _a, _b;
|
|
18790
|
-
const { width = richtextTheme.width, height = richtextTheme.height, maxWidth = richtextTheme.maxWidth, maxHeight = richtextTheme.maxHeight, textAlign = richtextTheme.textAlign,
|
|
18875
|
+
var _a, _b, _c, _d;
|
|
18876
|
+
const { width = richtextTheme.width, height = richtextTheme.height, maxWidth = richtextTheme.maxWidth, maxHeight = richtextTheme.maxHeight, textAlign = richtextTheme.textAlign, verticalDirection = (_b = (_a = attribute.textBaseline) !== null && _a !== void 0 ? _a : richtextTheme.textBaseline) !== null && _b !== void 0 ? _b : richtextTheme.verticalDirection, editOptions } = attribute;
|
|
18791
18877
|
if (width > 0 && height > 0) {
|
|
18792
18878
|
aabbBounds.set(0, 0, width, height);
|
|
18793
18879
|
}
|
|
@@ -18800,12 +18886,12 @@ class RichText extends Graphic {
|
|
|
18800
18886
|
contentWidth = typeof maxWidth === 'number' && contentWidth > maxWidth ? maxWidth : contentWidth || 0;
|
|
18801
18887
|
aabbBounds.set(0, 0, contentWidth, contentHeight);
|
|
18802
18888
|
}
|
|
18803
|
-
if (editOptions && editOptions.keepHeightWhileEmpty && !aabbBounds.height() && !((
|
|
18804
|
-
aabbBounds.y2 = aabbBounds.y1 + ((
|
|
18889
|
+
if (editOptions && editOptions.keepHeightWhileEmpty && !aabbBounds.height() && !((_c = attribute.textConfig) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
18890
|
+
aabbBounds.y2 = aabbBounds.y1 + ((_d = attribute.fontSize) !== null && _d !== void 0 ? _d : 12);
|
|
18805
18891
|
aabbBounds.x2 = aabbBounds.x1 + 2;
|
|
18806
18892
|
}
|
|
18807
18893
|
let deltaY = 0;
|
|
18808
|
-
switch (
|
|
18894
|
+
switch (verticalDirection) {
|
|
18809
18895
|
case 'top':
|
|
18810
18896
|
deltaY = 0;
|
|
18811
18897
|
break;
|
|
@@ -18834,6 +18920,9 @@ class RichText extends Graphic {
|
|
|
18834
18920
|
application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds);
|
|
18835
18921
|
}
|
|
18836
18922
|
application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, false, this);
|
|
18923
|
+
if (aabbBounds.width() === 0 && aabbBounds.height() === 0) {
|
|
18924
|
+
aabbBounds.clear();
|
|
18925
|
+
}
|
|
18837
18926
|
return aabbBounds;
|
|
18838
18927
|
}
|
|
18839
18928
|
needUpdateTags(keys) {
|
|
@@ -18869,8 +18958,8 @@ class RichText extends Graphic {
|
|
|
18869
18958
|
return false;
|
|
18870
18959
|
}
|
|
18871
18960
|
combinedStyleToCharacter(config) {
|
|
18872
|
-
const { fill, stroke, fontSize, fontFamily, fontStyle, fontWeight, lineWidth, opacity, fillOpacity, strokeOpacity } = this.attribute;
|
|
18873
|
-
|
|
18961
|
+
const { fill, stroke, fontSize, fontFamily, fontStyle, fontWeight, lineWidth, opacity, fillOpacity, lineHeight, strokeOpacity, upgradeAttrs } = this.attribute;
|
|
18962
|
+
const out = Object.assign({ fill,
|
|
18874
18963
|
stroke,
|
|
18875
18964
|
fontSize,
|
|
18876
18965
|
fontFamily,
|
|
@@ -18880,10 +18969,15 @@ class RichText extends Graphic {
|
|
|
18880
18969
|
opacity,
|
|
18881
18970
|
fillOpacity,
|
|
18882
18971
|
strokeOpacity }, config);
|
|
18972
|
+
if (upgradeAttrs === null || upgradeAttrs === void 0 ? void 0 : upgradeAttrs.lineHeight) {
|
|
18973
|
+
out.lineHeight = lineHeight;
|
|
18974
|
+
}
|
|
18975
|
+
return out;
|
|
18883
18976
|
}
|
|
18884
18977
|
doUpdateFrameCache(tc) {
|
|
18885
18978
|
var _a;
|
|
18886
|
-
const { maxWidth, maxHeight, width, height, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection, singleLine, disableAutoWrapLine, editable } = this.attribute;
|
|
18979
|
+
const { maxWidth, maxHeight, width, height, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection, singleLine, disableAutoWrapLine, editable, ascentDescentMode, upgradeAttrs } = this.attribute;
|
|
18980
|
+
const enableMultiBreakLine = upgradeAttrs && upgradeAttrs.multiBreakLine;
|
|
18887
18981
|
let { textConfig: _tc = [] } = this.attribute;
|
|
18888
18982
|
if (editable && _tc.length > 0 && !RichText.AllSingleCharacter(_tc)) {
|
|
18889
18983
|
_tc = RichText.TransformTextConfig2SingleCharacter(_tc);
|
|
@@ -18918,11 +19012,20 @@ class RichText extends Graphic {
|
|
|
18918
19012
|
if (richTextConfig.text && richTextConfig.text.includes('\n')) {
|
|
18919
19013
|
const textParts = richTextConfig.text.split('\n');
|
|
18920
19014
|
for (let j = 0; j < textParts.length; j++) {
|
|
18921
|
-
|
|
19015
|
+
if (j === 0) {
|
|
19016
|
+
paragraphs.push(new Paragraph(textParts[j], false, richTextConfig, ascentDescentMode));
|
|
19017
|
+
}
|
|
19018
|
+
else if (textParts[j] || i === textConfig.length - 1) {
|
|
19019
|
+
paragraphs.push(new Paragraph(textParts[j], true, richTextConfig, ascentDescentMode));
|
|
19020
|
+
}
|
|
19021
|
+
else {
|
|
19022
|
+
const nextRichTextConfig = this.combinedStyleToCharacter(textConfig[i + 1]);
|
|
19023
|
+
paragraphs.push(new Paragraph(textParts[j], true, nextRichTextConfig, ascentDescentMode));
|
|
19024
|
+
}
|
|
18922
19025
|
}
|
|
18923
19026
|
}
|
|
18924
19027
|
else if (richTextConfig.text) {
|
|
18925
|
-
paragraphs.push(new Paragraph(richTextConfig.text, false, richTextConfig));
|
|
19028
|
+
paragraphs.push(new Paragraph(richTextConfig.text, false, richTextConfig, ascentDescentMode));
|
|
18926
19029
|
}
|
|
18927
19030
|
}
|
|
18928
19031
|
}
|
|
@@ -18940,7 +19043,7 @@ class RichText extends Graphic {
|
|
|
18940
19043
|
const frameHeight = richTextHeightEnable ? height : maxHeightFinite ? maxHeight : 0;
|
|
18941
19044
|
const frame = new Frame(0, 0, frameWidth || 0, frameHeight || 0, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection || 'horizontal', !richTextWidthEnable && maxWidthFinite, !richTextHeightEnable && maxHeightFinite, singleLine || false, (_a = this._frameCache) === null || _a === void 0 ? void 0 : _a.icons);
|
|
18942
19045
|
const wrapper = new Wrapper(frame);
|
|
18943
|
-
wrapper.newLine =
|
|
19046
|
+
wrapper.newLine = enableMultiBreakLine;
|
|
18944
19047
|
if (disableAutoWrapLine) {
|
|
18945
19048
|
let lineCount = 0;
|
|
18946
19049
|
let skip = false;
|
|
@@ -18988,7 +19091,7 @@ class RichText extends Graphic {
|
|
|
18988
19091
|
l.calcOffset(offsetSize, false);
|
|
18989
19092
|
});
|
|
18990
19093
|
}
|
|
18991
|
-
if (
|
|
19094
|
+
if (enableMultiBreakLine) {
|
|
18992
19095
|
frame.lines.forEach(item => {
|
|
18993
19096
|
const lastParagraphs = item.paragraphs;
|
|
18994
19097
|
item.paragraphs = item.paragraphs.filter(p => p.text !== '');
|
|
@@ -20094,7 +20197,7 @@ class DefaultBaseBackgroundRenderContribution {
|
|
|
20094
20197
|
}
|
|
20095
20198
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
|
|
20096
20199
|
var _a;
|
|
20097
|
-
const { background, backgroundOpacity = (_a = graphic.attribute.fillOpacity) !== null && _a !== void 0 ? _a : graphicAttribute.backgroundOpacity, opacity = graphicAttribute.opacity, backgroundMode = graphicAttribute.backgroundMode, backgroundFit = graphicAttribute.backgroundFit, backgroundScale = graphicAttribute.backgroundScale, backgroundOffsetX = graphicAttribute.backgroundOffsetX, backgroundOffsetY = graphicAttribute.backgroundOffsetY, backgroundClip = graphicAttribute.backgroundClip } = graphic.attribute;
|
|
20200
|
+
const { background, backgroundOpacity = (_a = graphic.attribute.fillOpacity) !== null && _a !== void 0 ? _a : graphicAttribute.backgroundOpacity, opacity = graphicAttribute.opacity, backgroundMode = graphicAttribute.backgroundMode, backgroundFit = graphicAttribute.backgroundFit, backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio, backgroundScale = graphicAttribute.backgroundScale, backgroundOffsetX = graphicAttribute.backgroundOffsetX, backgroundOffsetY = graphicAttribute.backgroundOffsetY, backgroundClip = graphicAttribute.backgroundClip } = graphic.attribute;
|
|
20098
20201
|
if (!background) {
|
|
20099
20202
|
return;
|
|
20100
20203
|
}
|
|
@@ -20117,6 +20220,7 @@ class DefaultBaseBackgroundRenderContribution {
|
|
|
20117
20220
|
this.doDrawImage(context, res.data, b, {
|
|
20118
20221
|
backgroundMode,
|
|
20119
20222
|
backgroundFit,
|
|
20223
|
+
backgroundKeepAspectRatio,
|
|
20120
20224
|
backgroundScale,
|
|
20121
20225
|
backgroundOffsetX,
|
|
20122
20226
|
backgroundOffsetY
|
|
@@ -20136,14 +20240,20 @@ class DefaultBaseBackgroundRenderContribution {
|
|
|
20136
20240
|
}
|
|
20137
20241
|
}
|
|
20138
20242
|
doDrawImage(context, data, b, params) {
|
|
20139
|
-
const { backgroundMode, backgroundFit, backgroundScale = 1, backgroundOffsetX = 0, backgroundOffsetY = 0 } = params;
|
|
20243
|
+
const { backgroundMode, backgroundFit, backgroundKeepAspectRatio, backgroundScale = 1, backgroundOffsetX = 0, backgroundOffsetY = 0 } = params;
|
|
20140
20244
|
const targetW = b.width();
|
|
20141
20245
|
const targetH = b.height();
|
|
20142
20246
|
let w = targetW;
|
|
20143
20247
|
let h = targetH;
|
|
20144
20248
|
if (backgroundMode === 'no-repeat') {
|
|
20145
20249
|
if (backgroundFit) {
|
|
20146
|
-
|
|
20250
|
+
if (!backgroundKeepAspectRatio) {
|
|
20251
|
+
context.drawImage(data, b.x1, b.y1, b.width(), b.height());
|
|
20252
|
+
}
|
|
20253
|
+
else {
|
|
20254
|
+
const maxScale = Math.max(targetW / data.width, targetH / data.height);
|
|
20255
|
+
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
|
|
20256
|
+
}
|
|
20147
20257
|
}
|
|
20148
20258
|
else {
|
|
20149
20259
|
const resW = data.width * backgroundScale;
|
|
@@ -20247,6 +20357,7 @@ class DefaultBaseTextureRenderContribution {
|
|
|
20247
20357
|
this.time = BaseRenderContributionTime.afterFillStroke;
|
|
20248
20358
|
this.useStyle = true;
|
|
20249
20359
|
this.order = 10;
|
|
20360
|
+
this._tempSymbolGraphic = null;
|
|
20250
20361
|
}
|
|
20251
20362
|
createCommonPattern(size, padding, color, targetContext, cb) {
|
|
20252
20363
|
const r = (size - padding * 2) / 2;
|
|
@@ -20393,7 +20504,45 @@ class DefaultBaseTextureRenderContribution {
|
|
|
20393
20504
|
break;
|
|
20394
20505
|
}
|
|
20395
20506
|
}
|
|
20396
|
-
if (
|
|
20507
|
+
if (textureOptions && textureOptions.dynamicTexture) {
|
|
20508
|
+
context.save();
|
|
20509
|
+
context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);
|
|
20510
|
+
context.clip();
|
|
20511
|
+
const { gridConfig = {} } = textureOptions;
|
|
20512
|
+
const b = graphic.AABBBounds;
|
|
20513
|
+
const width = b.width();
|
|
20514
|
+
const height = b.height();
|
|
20515
|
+
const padding = texturePadding;
|
|
20516
|
+
const cellSize = textureSize;
|
|
20517
|
+
const gridColumns = gridConfig.columns ? gridConfig.columns : Math.ceil(width / cellSize);
|
|
20518
|
+
const gridRows = gridConfig.rows ? gridConfig.rows : Math.ceil(height / cellSize);
|
|
20519
|
+
const gutterColumn = gridConfig.gutterColumn ? gridConfig.gutterColumn : padding * 2;
|
|
20520
|
+
const gutterRow = gridConfig.gutterRow ? gridConfig.gutterRow : padding * 2;
|
|
20521
|
+
if (!this._tempSymbolGraphic) {
|
|
20522
|
+
this._tempSymbolGraphic = createSymbol({});
|
|
20523
|
+
}
|
|
20524
|
+
const sizeW = gridConfig.columns ? width / gridConfig.columns : cellSize;
|
|
20525
|
+
const sizeH = gridConfig.rows ? height / gridConfig.rows : cellSize;
|
|
20526
|
+
this._tempSymbolGraphic.setAttributes({
|
|
20527
|
+
size: [sizeW - gutterColumn, sizeH - gutterRow],
|
|
20528
|
+
symbolType: texture
|
|
20529
|
+
});
|
|
20530
|
+
const parsedPath = this._tempSymbolGraphic.getParsedPath();
|
|
20531
|
+
for (let i = 0; i < gridRows; i++) {
|
|
20532
|
+
for (let j = 0; j < gridColumns; j++) {
|
|
20533
|
+
const _x = x + cellSize / 2 + j * cellSize;
|
|
20534
|
+
const _y = y + cellSize / 2 + i * cellSize;
|
|
20535
|
+
context.beginPath();
|
|
20536
|
+
if (parsedPath.draw(context, Math.min(sizeW - gutterColumn, sizeH - gutterRow), _x, _y, 0) === false) {
|
|
20537
|
+
context.closePath();
|
|
20538
|
+
}
|
|
20539
|
+
context.fillStyle = textureColor;
|
|
20540
|
+
textureOptions.dynamicTexture(context, i, j, gridRows, gridColumns, textureRatio, graphic);
|
|
20541
|
+
}
|
|
20542
|
+
}
|
|
20543
|
+
context.restore();
|
|
20544
|
+
}
|
|
20545
|
+
else if (pattern) {
|
|
20397
20546
|
context.highPerformanceSave();
|
|
20398
20547
|
context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);
|
|
20399
20548
|
context.fillStyle = pattern;
|
|
@@ -20512,7 +20661,7 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
|
|
|
20512
20661
|
this.time = BaseRenderContributionTime.beforeFillStroke;
|
|
20513
20662
|
}
|
|
20514
20663
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
20515
|
-
const { background, backgroundMode = graphicAttribute.backgroundMode, backgroundFit = graphicAttribute.backgroundFit, backgroundScale = graphicAttribute.backgroundScale, backgroundOffsetX = graphicAttribute.backgroundOffsetX, backgroundOffsetY = graphicAttribute.backgroundOffsetY } = graphic.attribute;
|
|
20664
|
+
const { background, backgroundMode = graphicAttribute.backgroundMode, backgroundFit = graphicAttribute.backgroundFit, backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio, backgroundScale = graphicAttribute.backgroundScale, backgroundOffsetX = graphicAttribute.backgroundOffsetX, backgroundOffsetY = graphicAttribute.backgroundOffsetY } = graphic.attribute;
|
|
20516
20665
|
if (!background) {
|
|
20517
20666
|
return;
|
|
20518
20667
|
}
|
|
@@ -20527,6 +20676,7 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
|
|
|
20527
20676
|
this.doDrawImage(context, res.data, b, {
|
|
20528
20677
|
backgroundMode,
|
|
20529
20678
|
backgroundFit,
|
|
20679
|
+
backgroundKeepAspectRatio,
|
|
20530
20680
|
backgroundScale,
|
|
20531
20681
|
backgroundOffsetX,
|
|
20532
20682
|
backgroundOffsetY
|
|
@@ -20825,8 +20975,8 @@ class DefaultImageRenderContribution extends DefaultRectRenderContribution {
|
|
|
20825
20975
|
this.useStyle = true;
|
|
20826
20976
|
this.order = 0;
|
|
20827
20977
|
}
|
|
20828
|
-
drawShape(
|
|
20829
|
-
return super.drawShape(
|
|
20978
|
+
drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
|
|
20979
|
+
return super.drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
|
|
20830
20980
|
}
|
|
20831
20981
|
}
|
|
20832
20982
|
const defaultImageRenderContribution = new DefaultImageRenderContribution();
|
|
@@ -21424,7 +21574,7 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
|
|
|
21424
21574
|
this._draw(line, lineAttribute, false, drawContext, params);
|
|
21425
21575
|
}
|
|
21426
21576
|
drawSegmentItem(context, cache, fill, stroke, fillOpacity, strokeOpacity, attribute, defaultAttribute, clipRange, clipRangeByDimension, offsetX, offsetY, line, fillCb, strokeCb) {
|
|
21427
|
-
var _a
|
|
21577
|
+
var _a;
|
|
21428
21578
|
if (!cache) {
|
|
21429
21579
|
return;
|
|
21430
21580
|
}
|
|
@@ -21463,60 +21613,6 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
|
|
|
21463
21613
|
context.stroke();
|
|
21464
21614
|
}
|
|
21465
21615
|
}
|
|
21466
|
-
let { connectedType, connectedX, connectedY, connectedStyle } = attribute;
|
|
21467
|
-
if (isArray(defaultAttribute)) {
|
|
21468
|
-
connectedType = (_b = connectedType !== null && connectedType !== void 0 ? connectedType : defaultAttribute[0].connectedType) !== null && _b !== void 0 ? _b : defaultAttribute[1].connectedType;
|
|
21469
|
-
connectedX = (_c = connectedX !== null && connectedX !== void 0 ? connectedX : defaultAttribute[0].connectedX) !== null && _c !== void 0 ? _c : defaultAttribute[1].connectedX;
|
|
21470
|
-
connectedY = (_d = connectedY !== null && connectedY !== void 0 ? connectedY : defaultAttribute[0].connectedY) !== null && _d !== void 0 ? _d : defaultAttribute[1].connectedY;
|
|
21471
|
-
connectedStyle = (_e = connectedStyle !== null && connectedStyle !== void 0 ? connectedStyle : defaultAttribute[0].connectedStyle) !== null && _e !== void 0 ? _e : defaultAttribute[1].connectedStyle;
|
|
21472
|
-
}
|
|
21473
|
-
else {
|
|
21474
|
-
connectedType = connectedType !== null && connectedType !== void 0 ? connectedType : defaultAttribute.connectedType;
|
|
21475
|
-
connectedX = connectedX !== null && connectedX !== void 0 ? connectedX : defaultAttribute.connectedX;
|
|
21476
|
-
connectedY = connectedY !== null && connectedY !== void 0 ? connectedY : defaultAttribute.connectedY;
|
|
21477
|
-
connectedStyle = connectedStyle !== null && connectedStyle !== void 0 ? connectedStyle : defaultAttribute.connectedStyle;
|
|
21478
|
-
}
|
|
21479
|
-
if (connectedType !== 'connect' && connectedType !== 'zero') {
|
|
21480
|
-
connectedType = 'none';
|
|
21481
|
-
}
|
|
21482
|
-
if (connectedType !== 'none') {
|
|
21483
|
-
context.beginPath();
|
|
21484
|
-
drawSegments(context.camera ? context : context.nativeContext, cache, clipRange, clipRangeByDimension, {
|
|
21485
|
-
offsetX,
|
|
21486
|
-
offsetY,
|
|
21487
|
-
offsetZ: z,
|
|
21488
|
-
drawConnect: true,
|
|
21489
|
-
mode: connectedType,
|
|
21490
|
-
zeroX: connectedX,
|
|
21491
|
-
zeroY: connectedY
|
|
21492
|
-
});
|
|
21493
|
-
const da = [];
|
|
21494
|
-
if (isArray(defaultAttribute)) {
|
|
21495
|
-
defaultAttribute.forEach(i => da.push(i));
|
|
21496
|
-
}
|
|
21497
|
-
else {
|
|
21498
|
-
da.push(defaultAttribute);
|
|
21499
|
-
}
|
|
21500
|
-
da.push(attribute);
|
|
21501
|
-
if (fill !== false) {
|
|
21502
|
-
if (fillCb) {
|
|
21503
|
-
fillCb(context, attribute, defaultAttribute);
|
|
21504
|
-
}
|
|
21505
|
-
else if (fillOpacity) {
|
|
21506
|
-
context.setCommonStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da);
|
|
21507
|
-
context.fill();
|
|
21508
|
-
}
|
|
21509
|
-
}
|
|
21510
|
-
if (stroke !== false) {
|
|
21511
|
-
if (strokeCb) {
|
|
21512
|
-
strokeCb(context, attribute, defaultAttribute);
|
|
21513
|
-
}
|
|
21514
|
-
else if (strokeOpacity) {
|
|
21515
|
-
context.setStrokeStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da);
|
|
21516
|
-
context.stroke();
|
|
21517
|
-
}
|
|
21518
|
-
}
|
|
21519
|
-
}
|
|
21520
21616
|
return !!ret;
|
|
21521
21617
|
}
|
|
21522
21618
|
drawLinearLineHighPerformance(line, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, lineAttribute, drawContext, params, fillCb, strokeCb) {
|
|
@@ -21553,7 +21649,7 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
|
|
|
21553
21649
|
}
|
|
21554
21650
|
drawShape(line, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
21555
21651
|
const lineAttribute = getTheme(line, params === null || params === void 0 ? void 0 : params.theme).line;
|
|
21556
|
-
const { fill = lineAttribute.fill, stroke = lineAttribute.stroke, fillOpacity = lineAttribute.fillOpacity, strokeOpacity = lineAttribute.strokeOpacity, segments, points, closePath, curveTension = lineAttribute.curveTension } = line.attribute;
|
|
21652
|
+
const { fill = lineAttribute.fill, stroke = lineAttribute.stroke, fillOpacity = lineAttribute.fillOpacity, strokeOpacity = lineAttribute.strokeOpacity, segments, points, closePath, curveTension = lineAttribute.curveTension, connectedType = lineAttribute.connectedType } = line.attribute;
|
|
21557
21653
|
const data = this.valid(line, lineAttribute, fillCb, strokeCb);
|
|
21558
21654
|
if (!data) {
|
|
21559
21655
|
return;
|
|
@@ -21566,6 +21662,12 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
|
|
|
21566
21662
|
if (clipRange === 1 && !segments && !points.some(p => p.defined === false) && curveType === 'linear') {
|
|
21567
21663
|
return this.drawLinearLineHighPerformance(line, context, !!fill, !!stroke, fillOpacity, strokeOpacity, x, y, lineAttribute, drawContext, params, fillCb, strokeCb);
|
|
21568
21664
|
}
|
|
21665
|
+
function parsePoint(points, connectedType) {
|
|
21666
|
+
if (connectedType === 'none') {
|
|
21667
|
+
return points;
|
|
21668
|
+
}
|
|
21669
|
+
return points.filter(p => p.defined !== false);
|
|
21670
|
+
}
|
|
21569
21671
|
if (line.shouldUpdateShape()) {
|
|
21570
21672
|
const { points, segments } = line.attribute;
|
|
21571
21673
|
const _points = points;
|
|
@@ -21597,7 +21699,7 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
|
|
|
21597
21699
|
startPoint.y = lastSeg.endY;
|
|
21598
21700
|
startPoint.defined = lastSeg.curves[lastSeg.curves.length - 1].defined;
|
|
21599
21701
|
}
|
|
21600
|
-
const data = calcLineCache(seg.points, curveType, {
|
|
21702
|
+
const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
|
|
21601
21703
|
startPoint,
|
|
21602
21704
|
curveTension
|
|
21603
21705
|
});
|
|
@@ -21623,7 +21725,7 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
|
|
|
21623
21725
|
}
|
|
21624
21726
|
}
|
|
21625
21727
|
else if (points && points.length) {
|
|
21626
|
-
line.cache = calcLineCache(_points, curveType, { curveTension });
|
|
21728
|
+
line.cache = calcLineCache(parsePoint(_points, connectedType), curveType, { curveTension });
|
|
21627
21729
|
}
|
|
21628
21730
|
else {
|
|
21629
21731
|
line.cache = null;
|
|
@@ -21675,10 +21777,6 @@ DefaultCanvasLineRender = __decorate([
|
|
|
21675
21777
|
|
|
21676
21778
|
function drawAreaSegments(path, segPath, percent, params) {
|
|
21677
21779
|
var _a;
|
|
21678
|
-
const { drawConnect = false, mode = 'none' } = params || {};
|
|
21679
|
-
if (drawConnect && mode === 'none') {
|
|
21680
|
-
return;
|
|
21681
|
-
}
|
|
21682
21780
|
const { top, bottom } = segPath;
|
|
21683
21781
|
if (top.curves.length !== bottom.curves.length) {
|
|
21684
21782
|
return;
|
|
@@ -21687,90 +21785,28 @@ function drawAreaSegments(path, segPath, percent, params) {
|
|
|
21687
21785
|
const topList = [];
|
|
21688
21786
|
const bottomList = [];
|
|
21689
21787
|
let lastDefined = true;
|
|
21690
|
-
|
|
21691
|
-
|
|
21692
|
-
|
|
21693
|
-
|
|
21694
|
-
|
|
21695
|
-
|
|
21696
|
-
|
|
21697
|
-
let currentTopCurve = curve;
|
|
21698
|
-
let currentBottomCurve = bototmCurve;
|
|
21699
|
-
if (curve.originP1 === curve.originP2) {
|
|
21700
|
-
lastCurve = curve;
|
|
21701
|
-
lastBottomCurve = bototmCurve;
|
|
21702
|
-
return;
|
|
21703
|
-
}
|
|
21704
|
-
if (lastCurve && lastCurve.originP1 === lastCurve.originP2) {
|
|
21705
|
-
currentTopCurve = lastCurve;
|
|
21706
|
-
currentBottomCurve = lastBottomCurve;
|
|
21707
|
-
}
|
|
21708
|
-
if (curve.defined) {
|
|
21709
|
-
if (!defined0) {
|
|
21710
|
-
topList.push(currentTopCurve);
|
|
21711
|
-
bottomList.push(currentBottomCurve);
|
|
21712
|
-
drawAreaConnectBlock(path, topList, bottomList, params);
|
|
21713
|
-
topList.length = 0;
|
|
21714
|
-
bottomList.length = 0;
|
|
21715
|
-
defined0 = !defined0;
|
|
21716
|
-
}
|
|
21788
|
+
for (let i = 0, n = top.curves.length; i < n; i++) {
|
|
21789
|
+
const topCurve = top.curves[i];
|
|
21790
|
+
if (lastDefined !== topCurve.defined) {
|
|
21791
|
+
if (lastDefined) {
|
|
21792
|
+
drawAreaBlock(path, topList, bottomList, params);
|
|
21793
|
+
topList.length = 0;
|
|
21794
|
+
bottomList.length = 0;
|
|
21717
21795
|
}
|
|
21718
21796
|
else {
|
|
21719
|
-
|
|
21720
|
-
|
|
21721
|
-
let validBottomCurve;
|
|
21722
|
-
if (originP1 && originP1.defined !== false) {
|
|
21723
|
-
validTopCurve = currentTopCurve;
|
|
21724
|
-
validBottomCurve = currentBottomCurve;
|
|
21725
|
-
}
|
|
21726
|
-
else if (originP1 && originP2.defined !== false) {
|
|
21727
|
-
validTopCurve = curve;
|
|
21728
|
-
validBottomCurve = bototmCurve;
|
|
21729
|
-
}
|
|
21730
|
-
if (defined0) {
|
|
21731
|
-
defined0 = !defined0;
|
|
21732
|
-
topList.push(validTopCurve || curve);
|
|
21733
|
-
bottomList.push(validBottomCurve || bototmCurve);
|
|
21734
|
-
}
|
|
21735
|
-
else {
|
|
21736
|
-
if (validTopCurve) {
|
|
21737
|
-
defined0 = !defined0;
|
|
21738
|
-
topList.push(validTopCurve || curve);
|
|
21739
|
-
bottomList.push(validBottomCurve || bototmCurve);
|
|
21740
|
-
drawAreaConnectBlock(path, topList, bottomList, params);
|
|
21741
|
-
topList.length = 0;
|
|
21742
|
-
bottomList.length = 0;
|
|
21743
|
-
}
|
|
21744
|
-
}
|
|
21797
|
+
topList.push(topCurve);
|
|
21798
|
+
bottomList.push(bottom.curves[n - i - 1]);
|
|
21745
21799
|
}
|
|
21746
|
-
|
|
21747
|
-
}
|
|
21748
|
-
|
|
21749
|
-
|
|
21750
|
-
|
|
21751
|
-
|
|
21752
|
-
const topCurve = top.curves[i];
|
|
21753
|
-
if (lastDefined !== topCurve.defined) {
|
|
21754
|
-
if (lastDefined) {
|
|
21755
|
-
drawAreaBlock(path, topList, bottomList, params);
|
|
21756
|
-
topList.length = 0;
|
|
21757
|
-
bottomList.length = 0;
|
|
21758
|
-
}
|
|
21759
|
-
else {
|
|
21760
|
-
topList.push(topCurve);
|
|
21761
|
-
bottomList.push(bottom.curves[n - i - 1]);
|
|
21762
|
-
}
|
|
21763
|
-
lastDefined = !lastDefined;
|
|
21764
|
-
}
|
|
21765
|
-
else {
|
|
21766
|
-
if (lastDefined) {
|
|
21767
|
-
topList.push(topCurve);
|
|
21768
|
-
bottomList.push(bottom.curves[n - i - 1]);
|
|
21769
|
-
}
|
|
21800
|
+
lastDefined = !lastDefined;
|
|
21801
|
+
}
|
|
21802
|
+
else {
|
|
21803
|
+
if (lastDefined) {
|
|
21804
|
+
topList.push(topCurve);
|
|
21805
|
+
bottomList.push(bottom.curves[n - i - 1]);
|
|
21770
21806
|
}
|
|
21771
21807
|
}
|
|
21772
|
-
drawAreaBlock(path, topList, bottomList, params);
|
|
21773
21808
|
}
|
|
21809
|
+
drawAreaBlock(path, topList, bottomList, params);
|
|
21774
21810
|
return;
|
|
21775
21811
|
}
|
|
21776
21812
|
if (percent <= 0) {
|
|
@@ -21794,9 +21830,6 @@ function drawAreaSegments(path, segPath, percent, params) {
|
|
|
21794
21830
|
let lastDefined = true;
|
|
21795
21831
|
const topList = [];
|
|
21796
21832
|
const bottomList = [];
|
|
21797
|
-
let defined0 = true;
|
|
21798
|
-
let lastTopCurve;
|
|
21799
|
-
let lastBottomCurve;
|
|
21800
21833
|
for (let i = 0, n = top.curves.length; i < n; i++) {
|
|
21801
21834
|
const topCurve = top.curves[i];
|
|
21802
21835
|
const curCurveLength = topCurve.getLength(direction);
|
|
@@ -21805,127 +21838,50 @@ function drawAreaSegments(path, segPath, percent, params) {
|
|
|
21805
21838
|
break;
|
|
21806
21839
|
}
|
|
21807
21840
|
drawedLengthUntilLast += curCurveLength;
|
|
21808
|
-
|
|
21809
|
-
|
|
21810
|
-
|
|
21811
|
-
|
|
21812
|
-
|
|
21813
|
-
|
|
21814
|
-
|
|
21815
|
-
continue;
|
|
21816
|
-
}
|
|
21817
|
-
if (lastTopCurve && lastTopCurve.originP1 === lastTopCurve.originP2) {
|
|
21818
|
-
currentTopCurve = lastTopCurve;
|
|
21819
|
-
currentBottomCurve = lastBottomCurve;
|
|
21820
|
-
}
|
|
21821
|
-
if (topCurve.defined) {
|
|
21822
|
-
if (!defined0) {
|
|
21823
|
-
topList.push(currentTopCurve);
|
|
21824
|
-
bottomList.push(currentBottomCurve);
|
|
21825
|
-
drawAreaConnectBlock(path, topList, bottomList, params);
|
|
21826
|
-
topList.length = 0;
|
|
21827
|
-
bottomList.length = 0;
|
|
21828
|
-
defined0 = !defined0;
|
|
21829
|
-
}
|
|
21841
|
+
let tc = null;
|
|
21842
|
+
let bc = null;
|
|
21843
|
+
if (lastDefined !== topCurve.defined) {
|
|
21844
|
+
if (lastDefined) {
|
|
21845
|
+
drawAreaBlock(path, topList, bottomList, params);
|
|
21846
|
+
topList.length = 0;
|
|
21847
|
+
bottomList.length = 0;
|
|
21830
21848
|
}
|
|
21831
21849
|
else {
|
|
21832
|
-
|
|
21833
|
-
|
|
21834
|
-
let validBottomCurve;
|
|
21835
|
-
if (originP1 && originP1.defined !== false) {
|
|
21836
|
-
validTopCurve = currentTopCurve;
|
|
21837
|
-
validBottomCurve = currentBottomCurve;
|
|
21838
|
-
}
|
|
21839
|
-
else if (originP1 && originP2.defined !== false) {
|
|
21840
|
-
validTopCurve = topCurve;
|
|
21841
|
-
validBottomCurve = bototmCurve;
|
|
21842
|
-
}
|
|
21843
|
-
if (defined0) {
|
|
21844
|
-
defined0 = !defined0;
|
|
21845
|
-
topList.push(validTopCurve || topCurve);
|
|
21846
|
-
bottomList.push(validBottomCurve || bototmCurve);
|
|
21847
|
-
}
|
|
21848
|
-
else {
|
|
21849
|
-
if (validTopCurve) {
|
|
21850
|
-
defined0 = !defined0;
|
|
21851
|
-
topList.push(validTopCurve || topCurve);
|
|
21852
|
-
bottomList.push(validBottomCurve || bototmCurve);
|
|
21853
|
-
drawAreaConnectBlock(path, topList, bottomList, params);
|
|
21854
|
-
topList.length = 0;
|
|
21855
|
-
bottomList.length = 0;
|
|
21856
|
-
}
|
|
21857
|
-
}
|
|
21850
|
+
tc = topCurve;
|
|
21851
|
+
bc = bottom.curves[n - i - 1];
|
|
21858
21852
|
}
|
|
21859
|
-
|
|
21853
|
+
lastDefined = !lastDefined;
|
|
21860
21854
|
}
|
|
21861
21855
|
else {
|
|
21862
|
-
|
|
21863
|
-
|
|
21864
|
-
|
|
21865
|
-
|
|
21866
|
-
|
|
21867
|
-
|
|
21868
|
-
|
|
21856
|
+
if (lastDefined) {
|
|
21857
|
+
tc = topCurve;
|
|
21858
|
+
bc = bottom.curves[n - i - 1];
|
|
21859
|
+
}
|
|
21860
|
+
}
|
|
21861
|
+
if (tc && bc) {
|
|
21862
|
+
if (percent < 1) {
|
|
21863
|
+
if (tc.p2 && tc.p3) {
|
|
21864
|
+
tc = divideCubic(tc, percent)[0];
|
|
21869
21865
|
}
|
|
21870
21866
|
else {
|
|
21871
|
-
tc =
|
|
21872
|
-
bc = bottom.curves[n - i - 1];
|
|
21867
|
+
tc = divideLinear(tc, percent)[0];
|
|
21873
21868
|
}
|
|
21874
|
-
|
|
21875
|
-
|
|
21876
|
-
else {
|
|
21877
|
-
if (lastDefined) {
|
|
21878
|
-
tc = topCurve;
|
|
21879
|
-
bc = bottom.curves[n - i - 1];
|
|
21869
|
+
if (bc.p2 && bc.p3) {
|
|
21870
|
+
bc = divideCubic(bc, 1 - percent)[1];
|
|
21880
21871
|
}
|
|
21881
|
-
|
|
21882
|
-
|
|
21883
|
-
if (percent < 1) {
|
|
21884
|
-
if (tc.p2 && tc.p3) {
|
|
21885
|
-
tc = divideCubic(tc, percent)[0];
|
|
21886
|
-
}
|
|
21887
|
-
else {
|
|
21888
|
-
tc = divideLinear(tc, percent)[0];
|
|
21889
|
-
}
|
|
21890
|
-
if (bc.p2 && bc.p3) {
|
|
21891
|
-
bc = divideCubic(bc, 1 - percent)[1];
|
|
21892
|
-
}
|
|
21893
|
-
else {
|
|
21894
|
-
bc = divideLinear(bc, 1 - percent)[1];
|
|
21895
|
-
}
|
|
21872
|
+
else {
|
|
21873
|
+
bc = divideLinear(bc, 1 - percent)[1];
|
|
21896
21874
|
}
|
|
21897
|
-
tc.defined = lastDefined;
|
|
21898
|
-
bc.defined = lastDefined;
|
|
21899
|
-
topList.push(tc);
|
|
21900
|
-
bottomList.push(bc);
|
|
21901
21875
|
}
|
|
21902
|
-
tc =
|
|
21903
|
-
bc =
|
|
21876
|
+
tc.defined = lastDefined;
|
|
21877
|
+
bc.defined = lastDefined;
|
|
21878
|
+
topList.push(tc);
|
|
21879
|
+
bottomList.push(bc);
|
|
21904
21880
|
}
|
|
21881
|
+
tc = null;
|
|
21882
|
+
bc = null;
|
|
21905
21883
|
}
|
|
21906
|
-
|
|
21907
|
-
drawAreaConnectBlock(path, topList, bottomList, params);
|
|
21908
|
-
}
|
|
21909
|
-
else {
|
|
21910
|
-
drawAreaBlock(path, topList, bottomList, params);
|
|
21911
|
-
}
|
|
21912
|
-
}
|
|
21913
|
-
function drawAreaConnectBlock(path, topList, bottomList, params) {
|
|
21914
|
-
if (topList.length < 2) {
|
|
21915
|
-
return;
|
|
21916
|
-
}
|
|
21917
|
-
const { offsetX = 0, offsetY = 0, offsetZ = 0, mode } = params || {};
|
|
21918
|
-
let curve = topList[0];
|
|
21919
|
-
path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);
|
|
21920
|
-
curve = topList[topList.length - 1];
|
|
21921
|
-
let end = curve.p3 || curve.p1;
|
|
21922
|
-
path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ);
|
|
21923
|
-
curve = bottomList[bottomList.length - 1];
|
|
21924
|
-
path.lineTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);
|
|
21925
|
-
curve = bottomList[0];
|
|
21926
|
-
end = curve.p3 || curve.p1;
|
|
21927
|
-
path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ);
|
|
21928
|
-
path.closePath();
|
|
21884
|
+
drawAreaBlock(path, topList, bottomList, params);
|
|
21929
21885
|
}
|
|
21930
21886
|
function drawAreaBlock(path, topList, bottomList, params) {
|
|
21931
21887
|
const { offsetX = 0, offsetY = 0, offsetZ = 0 } = params || {};
|
|
@@ -22039,7 +21995,7 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
22039
21995
|
drawShape(area, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
22040
21996
|
var _a, _b, _c, _d, _e, _f;
|
|
22041
21997
|
const areaAttribute = getTheme(area, params === null || params === void 0 ? void 0 : params.theme).area;
|
|
22042
|
-
const { fill = areaAttribute.fill, stroke = areaAttribute.stroke, fillOpacity = areaAttribute.fillOpacity, z = areaAttribute.z, strokeOpacity = areaAttribute.strokeOpacity, curveTension = areaAttribute.curveTension } = area.attribute;
|
|
21998
|
+
const { fill = areaAttribute.fill, stroke = areaAttribute.stroke, fillOpacity = areaAttribute.fillOpacity, z = areaAttribute.z, strokeOpacity = areaAttribute.strokeOpacity, curveTension = areaAttribute.curveTension, connectedType = areaAttribute.connectedType } = area.attribute;
|
|
22043
21999
|
const data = this.valid(area, areaAttribute, fillCb, strokeCb);
|
|
22044
22000
|
if (!data) {
|
|
22045
22001
|
return;
|
|
@@ -22051,6 +22007,12 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
22051
22007
|
if (closePath && curveType === 'linear') {
|
|
22052
22008
|
curveType = 'linearClosed';
|
|
22053
22009
|
}
|
|
22010
|
+
function parsePoint(points, connectedType) {
|
|
22011
|
+
if (connectedType !== 'connect') {
|
|
22012
|
+
return points;
|
|
22013
|
+
}
|
|
22014
|
+
return points.filter(p => p.defined !== false);
|
|
22015
|
+
}
|
|
22054
22016
|
if (clipRange === 1 && !segments && !points.some(p => p.defined === false) && curveType === 'linear') {
|
|
22055
22017
|
return this.drawLinearAreaHighPerformance(area, context, !!fill, doStroke, fillOpacity, strokeOpacity, x, y, areaAttribute, drawContext, params, fillCb, strokeCb);
|
|
22056
22018
|
}
|
|
@@ -22073,7 +22035,7 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
22073
22035
|
startPoint.x = lastTopSeg.endX;
|
|
22074
22036
|
startPoint.y = lastTopSeg.endY;
|
|
22075
22037
|
}
|
|
22076
|
-
const data = calcLineCache(seg.points, curveType, {
|
|
22038
|
+
const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
|
|
22077
22039
|
startPoint,
|
|
22078
22040
|
curveTension
|
|
22079
22041
|
});
|
|
@@ -22102,7 +22064,7 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
22102
22064
|
});
|
|
22103
22065
|
}
|
|
22104
22066
|
if (bottomPoints.length > 1) {
|
|
22105
|
-
lastBottomSeg = calcLineCache(bottomPoints, curveType === 'stepBefore' ? 'stepAfter' : curveType === 'stepAfter' ? 'stepBefore' : curveType, { curveTension });
|
|
22067
|
+
lastBottomSeg = calcLineCache(parsePoint(bottomPoints, connectedType), curveType === 'stepBefore' ? 'stepAfter' : curveType === 'stepAfter' ? 'stepBefore' : curveType, { curveTension });
|
|
22106
22068
|
bottomCaches.unshift(lastBottomSeg);
|
|
22107
22069
|
}
|
|
22108
22070
|
}
|
|
@@ -22112,12 +22074,12 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
22112
22074
|
}));
|
|
22113
22075
|
}
|
|
22114
22076
|
else if (points && points.length) {
|
|
22115
|
-
const topPoints = points;
|
|
22077
|
+
const topPoints = parsePoint(points, connectedType);
|
|
22116
22078
|
const bottomPoints = [];
|
|
22117
|
-
for (let i =
|
|
22079
|
+
for (let i = topPoints.length - 1; i >= 0; i--) {
|
|
22118
22080
|
bottomPoints.push({
|
|
22119
|
-
x: (_e =
|
|
22120
|
-
y: (_f =
|
|
22081
|
+
x: (_e = topPoints[i].x1) !== null && _e !== void 0 ? _e : topPoints[i].x,
|
|
22082
|
+
y: (_f = topPoints[i].y1) !== null && _f !== void 0 ? _f : topPoints[i].y
|
|
22121
22083
|
});
|
|
22122
22084
|
}
|
|
22123
22085
|
const topCache = calcLineCache(topPoints, curveType, { curveTension });
|
|
@@ -22172,17 +22134,9 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
22172
22134
|
this._draw(area, areaAttribute, false, drawContext, params);
|
|
22173
22135
|
}
|
|
22174
22136
|
drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
|
|
22175
|
-
|
|
22176
|
-
ret =
|
|
22177
|
-
ret ||
|
|
22178
|
-
this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, false, fillCb, strokeCb);
|
|
22179
|
-
ret =
|
|
22180
|
-
ret ||
|
|
22181
|
-
this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, true, fillCb, strokeCb);
|
|
22182
|
-
return ret;
|
|
22137
|
+
return this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb);
|
|
22183
22138
|
}
|
|
22184
|
-
_drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext,
|
|
22185
|
-
var _a, _b, _c, _d;
|
|
22139
|
+
_drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
|
|
22186
22140
|
if (!(cache &&
|
|
22187
22141
|
cache.top &&
|
|
22188
22142
|
cache.bottom &&
|
|
@@ -22192,35 +22146,6 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
22192
22146
|
cache.bottom.curves.length)) {
|
|
22193
22147
|
return;
|
|
22194
22148
|
}
|
|
22195
|
-
let { connectedType, connectedX, connectedY, connectedStyle } = attribute;
|
|
22196
|
-
const da = [];
|
|
22197
|
-
if (connect) {
|
|
22198
|
-
if (isArray(defaultAttribute)) {
|
|
22199
|
-
connectedType = (_a = connectedType !== null && connectedType !== void 0 ? connectedType : defaultAttribute[0].connectedType) !== null && _a !== void 0 ? _a : defaultAttribute[1].connectedType;
|
|
22200
|
-
connectedX = (_b = connectedX !== null && connectedX !== void 0 ? connectedX : defaultAttribute[0].connectedX) !== null && _b !== void 0 ? _b : defaultAttribute[1].connectedX;
|
|
22201
|
-
connectedY = (_c = connectedY !== null && connectedY !== void 0 ? connectedY : defaultAttribute[0].connectedY) !== null && _c !== void 0 ? _c : defaultAttribute[1].connectedY;
|
|
22202
|
-
connectedStyle = (_d = connectedStyle !== null && connectedStyle !== void 0 ? connectedStyle : defaultAttribute[0].connectedStyle) !== null && _d !== void 0 ? _d : defaultAttribute[1].connectedStyle;
|
|
22203
|
-
}
|
|
22204
|
-
else {
|
|
22205
|
-
connectedType = connectedType !== null && connectedType !== void 0 ? connectedType : defaultAttribute.connectedType;
|
|
22206
|
-
connectedX = connectedX !== null && connectedX !== void 0 ? connectedX : defaultAttribute.connectedX;
|
|
22207
|
-
connectedY = connectedY !== null && connectedY !== void 0 ? connectedY : defaultAttribute.connectedY;
|
|
22208
|
-
connectedStyle = connectedStyle !== null && connectedStyle !== void 0 ? connectedStyle : defaultAttribute.connectedStyle;
|
|
22209
|
-
}
|
|
22210
|
-
if (connectedType !== 'connect' && connectedType !== 'zero') {
|
|
22211
|
-
connectedType = 'none';
|
|
22212
|
-
}
|
|
22213
|
-
if (isArray(defaultAttribute)) {
|
|
22214
|
-
defaultAttribute.forEach(i => da.push(i));
|
|
22215
|
-
}
|
|
22216
|
-
else {
|
|
22217
|
-
da.push(defaultAttribute);
|
|
22218
|
-
}
|
|
22219
|
-
da.push(attribute);
|
|
22220
|
-
}
|
|
22221
|
-
if (connect && connectedType === 'none') {
|
|
22222
|
-
return false;
|
|
22223
|
-
}
|
|
22224
22149
|
context.beginPath();
|
|
22225
22150
|
const ret = false;
|
|
22226
22151
|
const { points, segments } = area.attribute;
|
|
@@ -22255,11 +22180,7 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
22255
22180
|
offsetX,
|
|
22256
22181
|
offsetY,
|
|
22257
22182
|
offsetZ,
|
|
22258
|
-
direction
|
|
22259
|
-
drawConnect: connect,
|
|
22260
|
-
mode: connectedType,
|
|
22261
|
-
zeroX: connectedX,
|
|
22262
|
-
zeroY: connectedY
|
|
22183
|
+
direction
|
|
22263
22184
|
});
|
|
22264
22185
|
this.beforeRenderStep(area, context, offsetX, offsetY, !!fillOpacity, false, fill, false, defaultAttribute, drawContext, fillCb, null, { attribute });
|
|
22265
22186
|
context.setShadowBlendStyle && context.setShadowBlendStyle(area, attribute, defaultAttribute);
|
|
@@ -22270,7 +22191,7 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
22270
22191
|
fillCb(context, attribute, defaultAttribute);
|
|
22271
22192
|
}
|
|
22272
22193
|
else if (fillOpacity) {
|
|
22273
|
-
context.setCommonStyle(area,
|
|
22194
|
+
context.setCommonStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute);
|
|
22274
22195
|
context.fill();
|
|
22275
22196
|
}
|
|
22276
22197
|
}
|
|
@@ -22287,14 +22208,10 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
22287
22208
|
drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === Direction$1.ROW ? 'x' : 'y', {
|
|
22288
22209
|
offsetX,
|
|
22289
22210
|
offsetY,
|
|
22290
|
-
offsetZ
|
|
22291
|
-
drawConnect: connect,
|
|
22292
|
-
mode: connectedType,
|
|
22293
|
-
zeroX: connectedX,
|
|
22294
|
-
zeroY: connectedY
|
|
22211
|
+
offsetZ
|
|
22295
22212
|
});
|
|
22296
22213
|
}
|
|
22297
|
-
context.setStrokeStyle(area,
|
|
22214
|
+
context.setStrokeStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute);
|
|
22298
22215
|
context.stroke();
|
|
22299
22216
|
}
|
|
22300
22217
|
}
|
|
@@ -22663,7 +22580,7 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
|
|
|
22663
22580
|
}
|
|
22664
22581
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
22665
22582
|
var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
22666
|
-
const { backgroundMode = graphicAttribute.backgroundMode, backgroundFit = graphicAttribute.backgroundFit } = graphic.attribute;
|
|
22583
|
+
const { backgroundMode = graphicAttribute.backgroundMode, backgroundFit = graphicAttribute.backgroundFit, backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio } = graphic.attribute;
|
|
22667
22584
|
let { background } = graphic.attribute;
|
|
22668
22585
|
if (!background) {
|
|
22669
22586
|
return;
|
|
@@ -22720,7 +22637,7 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
|
|
|
22720
22637
|
context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);
|
|
22721
22638
|
}
|
|
22722
22639
|
context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);
|
|
22723
|
-
this.doDrawImage(context, res.data, b, { backgroundMode, backgroundFit });
|
|
22640
|
+
this.doDrawImage(context, res.data, b, { backgroundMode, backgroundFit, backgroundKeepAspectRatio });
|
|
22724
22641
|
context.highPerformanceRestore();
|
|
22725
22642
|
context.setTransformForCurrent();
|
|
22726
22643
|
}
|
|
@@ -24318,6 +24235,9 @@ let DefaultDrawContribution = class DefaultDrawContribution {
|
|
|
24318
24235
|
this.backupDirtyBounds = new Bounds();
|
|
24319
24236
|
this.global = application.global;
|
|
24320
24237
|
this.layerService = application.layerService;
|
|
24238
|
+
if (!isArray(this.contributions)) {
|
|
24239
|
+
this.contributions = [this.contributions];
|
|
24240
|
+
}
|
|
24321
24241
|
this.init();
|
|
24322
24242
|
}
|
|
24323
24243
|
init() {
|
|
@@ -27039,7 +26959,7 @@ function flatten_simplify(points, tolerance, highestQuality) {
|
|
|
27039
26959
|
}
|
|
27040
26960
|
|
|
27041
26961
|
function getDefaultCharacterConfig(attribute) {
|
|
27042
|
-
const { fill = 'black', stroke = false, fontWeight = 'normal', fontFamily = 'Arial' } = attribute;
|
|
26962
|
+
const { fill = 'black', stroke = false, fontWeight = 'normal', lineHeight, fontFamily = 'Arial' } = attribute;
|
|
27043
26963
|
let { fontSize = 12 } = attribute;
|
|
27044
26964
|
if (!isFinite(fontSize)) {
|
|
27045
26965
|
fontSize = 12;
|
|
@@ -27049,7 +26969,8 @@ function getDefaultCharacterConfig(attribute) {
|
|
|
27049
26969
|
stroke,
|
|
27050
26970
|
fontSize,
|
|
27051
26971
|
fontWeight,
|
|
27052
|
-
fontFamily
|
|
26972
|
+
fontFamily,
|
|
26973
|
+
lineHeight
|
|
27053
26974
|
};
|
|
27054
26975
|
}
|
|
27055
26976
|
function findConfigIndexByCursorIdx(textConfig, cursorIndex) {
|
|
@@ -27133,12 +27054,12 @@ class EditModule {
|
|
|
27133
27054
|
this.composingConfigIdx = this.cursorIndex < 0 ? 0 : findConfigIndexByCursorIdx(textConfig, this.cursorIndex);
|
|
27134
27055
|
if (this.cursorIndex < 0) {
|
|
27135
27056
|
const config = textConfig[0];
|
|
27136
|
-
textConfig.unshift(Object.assign(Object.assign(Object.assign({}, getDefaultCharacterConfig(this.currRt.attribute)), config), { text: '' }));
|
|
27057
|
+
textConfig.unshift(Object.assign(Object.assign(Object.assign({ fill: 'black' }, getDefaultCharacterConfig(this.currRt.attribute)), config), { text: '' }));
|
|
27137
27058
|
}
|
|
27138
27059
|
else {
|
|
27139
27060
|
const configIdx = this.composingConfigIdx;
|
|
27140
27061
|
const lastConfig = textConfig[configIdx] || textConfig[configIdx - 1];
|
|
27141
|
-
textConfig.splice(configIdx, 0, Object.assign(Object.assign({}, lastConfig), { text: '' }));
|
|
27062
|
+
textConfig.splice(configIdx, 0, Object.assign(Object.assign({ fill: 'black' }, lastConfig), { text: '' }));
|
|
27142
27063
|
}
|
|
27143
27064
|
};
|
|
27144
27065
|
this.handleCompositionEnd = () => {
|
|
@@ -27262,13 +27183,14 @@ class EditModule {
|
|
|
27262
27183
|
application.global.addEventListener('keydown', this.handleKeyDown);
|
|
27263
27184
|
}
|
|
27264
27185
|
parseCompositionStr(configIdx) {
|
|
27186
|
+
var _a;
|
|
27265
27187
|
const { textConfig = [] } = this.currRt.attribute;
|
|
27266
|
-
const lastConfig = textConfig[configIdx];
|
|
27188
|
+
const lastConfig = (_a = textConfig[configIdx]) !== null && _a !== void 0 ? _a : {};
|
|
27267
27189
|
textConfig.splice(configIdx, 1);
|
|
27268
27190
|
const text = lastConfig.text;
|
|
27269
27191
|
const textList = text ? Array.from(text.toString()) : [];
|
|
27270
27192
|
for (let i = 0; i < textList.length; i++) {
|
|
27271
|
-
textConfig.splice(i + configIdx, 0, Object.assign(Object.assign(
|
|
27193
|
+
textConfig.splice(i + configIdx, 0, Object.assign(Object.assign({ fill: 'black' }, lastConfig), { isComposing: false, text: textList[i] }));
|
|
27272
27194
|
}
|
|
27273
27195
|
this.currRt.setAttributes({ textConfig });
|
|
27274
27196
|
const nextConfigIdx = configIdx + textList.length;
|
|
@@ -27343,18 +27265,23 @@ class Selection {
|
|
|
27343
27265
|
}
|
|
27344
27266
|
return (_a = config[Math.min(idx, config.length - 1)][key]) !== null && _a !== void 0 ? _a : this.rt.attribute[key];
|
|
27345
27267
|
}
|
|
27346
|
-
getFormat(key) {
|
|
27347
|
-
return this.getAllFormat(key)[0];
|
|
27268
|
+
getFormat(key, supportOutAttr = false) {
|
|
27269
|
+
return this.getAllFormat(key, supportOutAttr)[0];
|
|
27348
27270
|
}
|
|
27349
|
-
getAllFormat(key) {
|
|
27271
|
+
getAllFormat(key, supportOutAttr = false) {
|
|
27272
|
+
var _a, _b, _c, _d;
|
|
27350
27273
|
const valSet = new Set();
|
|
27351
27274
|
const minCursorIdx = Math.min(this.selectionStartCursorIdx, this.curCursorIdx);
|
|
27352
27275
|
const maxCursorIdx = Math.max(this.selectionStartCursorIdx, this.curCursorIdx);
|
|
27353
27276
|
if (minCursorIdx === maxCursorIdx) {
|
|
27354
|
-
return
|
|
27277
|
+
return supportOutAttr
|
|
27278
|
+
? [(_a = this._getFormat(key, minCursorIdx)) !== null && _a !== void 0 ? _a : ((_b = this.rt) === null || _b === void 0 ? void 0 : _b.attribute)[key]]
|
|
27279
|
+
: [this._getFormat(key, minCursorIdx)];
|
|
27355
27280
|
}
|
|
27356
27281
|
for (let i = Math.ceil(minCursorIdx); i <= Math.floor(maxCursorIdx); i++) {
|
|
27357
|
-
const val =
|
|
27282
|
+
const val = supportOutAttr
|
|
27283
|
+
? (_c = this._getFormat(key, i)) !== null && _c !== void 0 ? _c : ((_d = this.rt) === null || _d === void 0 ? void 0 : _d.attribute)[key]
|
|
27284
|
+
: this._getFormat(key, i);
|
|
27358
27285
|
val && valSet.add(val);
|
|
27359
27286
|
}
|
|
27360
27287
|
return Array.from(valSet.values());
|
|
@@ -27419,10 +27346,10 @@ class RichTextEditPlugin {
|
|
|
27419
27346
|
if (this.copyToClipboard(e)) {
|
|
27420
27347
|
return;
|
|
27421
27348
|
}
|
|
27422
|
-
if (this.
|
|
27349
|
+
if (this.fullSelectionKeyHandler(e)) {
|
|
27423
27350
|
return;
|
|
27424
27351
|
}
|
|
27425
|
-
if (this.
|
|
27352
|
+
if (this.directKeyHandler(e)) {
|
|
27426
27353
|
return;
|
|
27427
27354
|
}
|
|
27428
27355
|
};
|
|
@@ -27463,7 +27390,7 @@ class RichTextEditPlugin {
|
|
|
27463
27390
|
return;
|
|
27464
27391
|
}
|
|
27465
27392
|
this.handleEnter();
|
|
27466
|
-
e.target.once('pointerleave', this.handleLeave);
|
|
27393
|
+
e.target.once('pointerleave', this.handleLeave, { capture: true });
|
|
27467
27394
|
this.tryShowSelection(e, false);
|
|
27468
27395
|
};
|
|
27469
27396
|
this.handleEnter = () => {
|
|
@@ -27557,11 +27484,11 @@ class RichTextEditPlugin {
|
|
|
27557
27484
|
activate(context) {
|
|
27558
27485
|
this.pluginService = context;
|
|
27559
27486
|
this.editModule = new EditModule();
|
|
27560
|
-
context.stage.on('pointermove', this.handleMove);
|
|
27561
|
-
context.stage.on('pointerdown', this.handlePointerDown);
|
|
27562
|
-
context.stage.on('pointerup', this.handlePointerUp);
|
|
27563
|
-
context.stage.on('pointerleave', this.handlePointerUp);
|
|
27564
|
-
context.stage.on('dblclick', this.handleDBLClick);
|
|
27487
|
+
context.stage.on('pointermove', this.handleMove, { capture: true });
|
|
27488
|
+
context.stage.on('pointerdown', this.handlePointerDown, { capture: true });
|
|
27489
|
+
context.stage.on('pointerup', this.handlePointerUp, { capture: true });
|
|
27490
|
+
context.stage.on('pointerleave', this.handlePointerUp, { capture: true });
|
|
27491
|
+
context.stage.on('dblclick', this.handleDBLClick, { capture: true });
|
|
27565
27492
|
application.global.addEventListener('keydown', this.handleKeyDown);
|
|
27566
27493
|
this.editModule.onInput(this.handleInput);
|
|
27567
27494
|
this.editModule.onChange(this.handleChange);
|
|
@@ -27605,32 +27532,32 @@ class RichTextEditPlugin {
|
|
|
27605
27532
|
this.setCursorAndTextArea(pos.x, pos.y1, pos.y2, this.currRt);
|
|
27606
27533
|
this._tryShowSelection(pos, cache);
|
|
27607
27534
|
}
|
|
27608
|
-
fullSelection(
|
|
27535
|
+
fullSelection() {
|
|
27536
|
+
const currRt = this.currRt;
|
|
27537
|
+
if (!currRt) {
|
|
27538
|
+
return;
|
|
27539
|
+
}
|
|
27540
|
+
const cache = currRt.getFrameCache();
|
|
27541
|
+
if (!cache) {
|
|
27542
|
+
return;
|
|
27543
|
+
}
|
|
27544
|
+
const { lines } = cache;
|
|
27545
|
+
if (!(lines.length && lines[0].paragraphs.length)) {
|
|
27546
|
+
return;
|
|
27547
|
+
}
|
|
27548
|
+
const totalCursorCount = lines.reduce((total, line) => total + line.paragraphs.length, 0) - 1;
|
|
27549
|
+
this.selectionRange(-0.1, totalCursorCount + 0.1);
|
|
27550
|
+
}
|
|
27551
|
+
fullSelectionKeyHandler(e) {
|
|
27609
27552
|
if ((application.global.isMacOS() && e.metaKey && e.key === 'a') ||
|
|
27610
27553
|
(!application.global.isMacOS() && e.ctrlKey && e.key === 'a')) {
|
|
27611
|
-
|
|
27612
|
-
if (!currRt) {
|
|
27613
|
-
return;
|
|
27614
|
-
}
|
|
27615
|
-
const cache = currRt.getFrameCache();
|
|
27616
|
-
if (!cache) {
|
|
27617
|
-
return;
|
|
27618
|
-
}
|
|
27619
|
-
const { lines } = cache;
|
|
27620
|
-
if (lines.length === 0) {
|
|
27621
|
-
return;
|
|
27622
|
-
}
|
|
27623
|
-
if (!lines[0].paragraphs || lines[0].paragraphs.length === 0) {
|
|
27624
|
-
return;
|
|
27625
|
-
}
|
|
27626
|
-
const totalCursorCount = lines.reduce((total, line) => total + line.paragraphs.length, 0) - 1;
|
|
27627
|
-
this.selectionRange(-0.1, totalCursorCount + 0.1);
|
|
27554
|
+
this.fullSelection();
|
|
27628
27555
|
e.preventDefault();
|
|
27629
27556
|
return true;
|
|
27630
27557
|
}
|
|
27631
27558
|
return false;
|
|
27632
27559
|
}
|
|
27633
|
-
|
|
27560
|
+
directKeyHandler(e) {
|
|
27634
27561
|
if (!(e.key === 'ArrowUp' || e.key === 'ArrowDown' || e.key === 'ArrowLeft' || e.key === 'ArrowRight')) {
|
|
27635
27562
|
return false;
|
|
27636
27563
|
}
|
|
@@ -27681,6 +27608,7 @@ class RichTextEditPlugin {
|
|
|
27681
27608
|
else if (this.curCursorIdx > totalCursorCount + 0.1) {
|
|
27682
27609
|
this.curCursorIdx = totalCursorCount + 0.1;
|
|
27683
27610
|
}
|
|
27611
|
+
this.selectionStartCursorIdx = this.curCursorIdx;
|
|
27684
27612
|
const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt);
|
|
27685
27613
|
this.setCursorAndTextArea(pos.x, pos.y1, pos.y2, this.currRt);
|
|
27686
27614
|
this.hideSelection();
|
|
@@ -27728,7 +27656,7 @@ class RichTextEditPlugin {
|
|
|
27728
27656
|
const placeholder = shadowRoot.getElementsByType('richtext')[0];
|
|
27729
27657
|
placeholder && shadowRoot.removeChild(placeholder);
|
|
27730
27658
|
}
|
|
27731
|
-
const { textConfig, editOptions } = this.currRt.attribute;
|
|
27659
|
+
const { textConfig, editOptions = {} } = this.currRt.attribute;
|
|
27732
27660
|
if (textConfig && textConfig.length) {
|
|
27733
27661
|
return;
|
|
27734
27662
|
}
|
|
@@ -27747,9 +27675,16 @@ class RichTextEditPlugin {
|
|
|
27747
27675
|
if (placeholderFontSize) {
|
|
27748
27676
|
textConfigItem.fontSize = placeholderFontSize;
|
|
27749
27677
|
}
|
|
27750
|
-
this.shadowPlaceHolder = createRichText(Object.assign(Object.assign({}, this.currRt.attribute), { x: 0, y: 0,
|
|
27678
|
+
this.shadowPlaceHolder = createRichText(Object.assign(Object.assign({}, this.currRt.attribute), { x: 0, y: 0, dx: -this.deltaX, dy: -this.deltaY, angle: 0, textConfig: [textConfigItem] }));
|
|
27751
27679
|
shadow.add(this.shadowPlaceHolder);
|
|
27752
27680
|
}
|
|
27681
|
+
getRichTextAABBBounds(rt) {
|
|
27682
|
+
const { attribute } = rt;
|
|
27683
|
+
if (!attribute.textConfig.length) {
|
|
27684
|
+
return getRichTextBounds(Object.assign(Object.assign({}, this.shadowPlaceHolder.attribute), { x: attribute.x, y: attribute.y, textAlign: attribute.textAlign, boundsMode: 'accurate' }));
|
|
27685
|
+
}
|
|
27686
|
+
return rt.AABBBounds;
|
|
27687
|
+
}
|
|
27753
27688
|
tryShowInputBounds() {
|
|
27754
27689
|
if (!(this.currRt && this.focusing)) {
|
|
27755
27690
|
return;
|
|
@@ -27759,28 +27694,24 @@ class RichTextEditPlugin {
|
|
|
27759
27694
|
if (!editOptions || !boundsStrokeWhenInput) {
|
|
27760
27695
|
return;
|
|
27761
27696
|
}
|
|
27762
|
-
const
|
|
27763
|
-
|
|
27764
|
-
|
|
27765
|
-
if (!attribute.textConfig.length && this.editLine) {
|
|
27766
|
-
const { points } = this.editLine.attribute;
|
|
27767
|
-
h = points[1].y - points[0].y;
|
|
27768
|
-
b = getRichTextBounds(Object.assign({}, this.shadowPlaceHolder.attribute));
|
|
27769
|
-
}
|
|
27697
|
+
const b = this.getRichTextAABBBounds(this.currRt);
|
|
27698
|
+
const height = b.height();
|
|
27699
|
+
const width = b.width();
|
|
27770
27700
|
this.shadowBounds = this.shadowBounds || createRect({});
|
|
27771
27701
|
this.shadowBounds.setAttributes({
|
|
27772
27702
|
x: 0,
|
|
27773
27703
|
y: 0,
|
|
27774
|
-
width
|
|
27775
|
-
height
|
|
27704
|
+
width,
|
|
27705
|
+
height,
|
|
27776
27706
|
fill: false,
|
|
27777
27707
|
stroke: boundsStrokeWhenInput,
|
|
27778
27708
|
lineWidth: 1,
|
|
27779
27709
|
zIndex: -1
|
|
27780
27710
|
});
|
|
27781
27711
|
const shadow = this.getShadow(this.currRt);
|
|
27782
|
-
|
|
27712
|
+
this.addEditLineOrBgOrBounds(this.shadowBounds, shadow);
|
|
27783
27713
|
this.offsetLineBgAndShadowBounds();
|
|
27714
|
+
this.offsetShadowRoot();
|
|
27784
27715
|
}
|
|
27785
27716
|
trySyncPlaceholderToTextConfig() {
|
|
27786
27717
|
if (!this.currRt) {
|
|
@@ -27790,7 +27721,7 @@ class RichTextEditPlugin {
|
|
|
27790
27721
|
if (textConfig && textConfig.length) {
|
|
27791
27722
|
return;
|
|
27792
27723
|
}
|
|
27793
|
-
if (!(editOptions && editOptions.placeholder && editOptions.
|
|
27724
|
+
if (!(editOptions && editOptions.placeholder && editOptions.syncPlaceholderToTextConfig)) {
|
|
27794
27725
|
return;
|
|
27795
27726
|
}
|
|
27796
27727
|
const { placeholder } = editOptions;
|
|
@@ -27801,17 +27732,37 @@ class RichTextEditPlugin {
|
|
|
27801
27732
|
});
|
|
27802
27733
|
}
|
|
27803
27734
|
deactivate(context) {
|
|
27804
|
-
context.stage.off('pointermove', this.handleMove);
|
|
27805
|
-
context.stage.off('pointerdown', this.handlePointerDown);
|
|
27806
|
-
context.stage.off('pointerup', this.handlePointerUp);
|
|
27807
|
-
context.stage.off('pointerleave', this.handlePointerUp);
|
|
27808
|
-
context.stage.off('dblclick', this.handleDBLClick);
|
|
27735
|
+
context.stage.off('pointermove', this.handleMove, { capture: true });
|
|
27736
|
+
context.stage.off('pointerdown', this.handlePointerDown, { capture: true });
|
|
27737
|
+
context.stage.off('pointerup', this.handlePointerUp, { capture: true });
|
|
27738
|
+
context.stage.off('pointerleave', this.handlePointerUp, { capture: true });
|
|
27739
|
+
context.stage.off('dblclick', this.handleDBLClick, { capture: true });
|
|
27809
27740
|
application.global.addEventListener('keydown', this.handleKeyDown);
|
|
27810
27741
|
}
|
|
27742
|
+
stopPropagation(e) {
|
|
27743
|
+
e.stopPropagation();
|
|
27744
|
+
}
|
|
27745
|
+
addEditLineOrBgOrBounds(graphic, shadowRoot) {
|
|
27746
|
+
let group = shadowRoot.getElementById('emptyBoundsContainer');
|
|
27747
|
+
if (!group) {
|
|
27748
|
+
group = createGroup({ x: 0, y: 0, width: 0, height: 0, boundsMode: 'empty' });
|
|
27749
|
+
group.id = 'emptyBoundsContainer';
|
|
27750
|
+
shadowRoot.add(group);
|
|
27751
|
+
}
|
|
27752
|
+
group.add(graphic);
|
|
27753
|
+
}
|
|
27754
|
+
removeEditLineOrBgOrBounds(graphic, shadowRoot) {
|
|
27755
|
+
const group = shadowRoot.getElementById('emptyBoundsContainer');
|
|
27756
|
+
if (!group) {
|
|
27757
|
+
return;
|
|
27758
|
+
}
|
|
27759
|
+
group.removeChild(graphic);
|
|
27760
|
+
}
|
|
27811
27761
|
onFocus(e, data) {
|
|
27812
27762
|
this.updateCbs && this.updateCbs.forEach(cb => cb('beforeOnfocus', this));
|
|
27813
27763
|
this.deFocus(false);
|
|
27814
27764
|
this.focusing = true;
|
|
27765
|
+
this.editing = true;
|
|
27815
27766
|
const target = e.target;
|
|
27816
27767
|
if (!(target && target.type === 'richtext')) {
|
|
27817
27768
|
return;
|
|
@@ -27823,8 +27774,11 @@ class RichTextEditPlugin {
|
|
|
27823
27774
|
if (!cache) {
|
|
27824
27775
|
return;
|
|
27825
27776
|
}
|
|
27826
|
-
this.
|
|
27827
|
-
|
|
27777
|
+
const { editOptions = {} } = this.currRt.attribute;
|
|
27778
|
+
if (editOptions.stopPropagation) {
|
|
27779
|
+
target.addEventListener('*', this.stopPropagation);
|
|
27780
|
+
}
|
|
27781
|
+
this.offsetShadowRoot(target);
|
|
27828
27782
|
if (!this.editLine) {
|
|
27829
27783
|
const line = createLine({ x: 0, y: 0, lineWidth: 1, stroke: 'black' });
|
|
27830
27784
|
this.addAnimateToLine(line);
|
|
@@ -27832,8 +27786,8 @@ class RichTextEditPlugin {
|
|
|
27832
27786
|
this.ticker.start(true);
|
|
27833
27787
|
const g = createGroup({ x: 0, y: 0, width: 0, height: 0 });
|
|
27834
27788
|
this.editBg = g;
|
|
27835
|
-
|
|
27836
|
-
|
|
27789
|
+
this.addEditLineOrBgOrBounds(this.editLine, shadowRoot);
|
|
27790
|
+
this.addEditLineOrBgOrBounds(this.editBg, shadowRoot);
|
|
27837
27791
|
}
|
|
27838
27792
|
data = data || this.computedCursorPosByEvent(e, cache);
|
|
27839
27793
|
if (data) {
|
|
@@ -27856,6 +27810,23 @@ class RichTextEditPlugin {
|
|
|
27856
27810
|
this.tryShowInputBounds();
|
|
27857
27811
|
this.currRt.addUpdateBoundTag();
|
|
27858
27812
|
}
|
|
27813
|
+
offsetShadowRoot(rt) {
|
|
27814
|
+
rt = rt || this.currRt;
|
|
27815
|
+
if (!rt) {
|
|
27816
|
+
return;
|
|
27817
|
+
}
|
|
27818
|
+
const shadowRoot = this.getShadow(rt);
|
|
27819
|
+
if (!shadowRoot) {
|
|
27820
|
+
return;
|
|
27821
|
+
}
|
|
27822
|
+
const cache = rt.getFrameCache();
|
|
27823
|
+
if (!cache) {
|
|
27824
|
+
return;
|
|
27825
|
+
}
|
|
27826
|
+
this.computeGlobalDelta(cache);
|
|
27827
|
+
shadowRoot.setAttributes({ shadowRootIdx: 1, pickable: false, x: this.deltaX, y: this.deltaY });
|
|
27828
|
+
this.shadowPlaceHolder && this.shadowPlaceHolder.setAttributes({ dx: -this.deltaX, dy: -this.deltaY });
|
|
27829
|
+
}
|
|
27859
27830
|
offsetLineBgAndShadowBounds() {
|
|
27860
27831
|
const rt = this.currRt;
|
|
27861
27832
|
const { textBaseline } = rt.attribute;
|
|
@@ -27881,28 +27852,33 @@ class RichTextEditPlugin {
|
|
|
27881
27852
|
}
|
|
27882
27853
|
}
|
|
27883
27854
|
deFocus(trulyDeFocus = false) {
|
|
27884
|
-
|
|
27885
|
-
|
|
27855
|
+
this.editing = false;
|
|
27856
|
+
this.updateCbs && this.updateCbs.forEach(cb => cb('beforeDefocus', this, { trulyDeFocus }));
|
|
27857
|
+
const currRt = this.currRt;
|
|
27858
|
+
if (!currRt) {
|
|
27886
27859
|
return;
|
|
27887
27860
|
}
|
|
27888
|
-
|
|
27861
|
+
const { editOptions = {} } = currRt.attribute;
|
|
27862
|
+
if (editOptions.stopPropagation) {
|
|
27863
|
+
currRt.removeEventListener('*', this.stopPropagation);
|
|
27864
|
+
}
|
|
27889
27865
|
if (trulyDeFocus) {
|
|
27890
27866
|
this.trySyncPlaceholderToTextConfig();
|
|
27891
|
-
|
|
27867
|
+
currRt.detachShadow();
|
|
27892
27868
|
}
|
|
27893
|
-
const currRt = this.currRt;
|
|
27894
27869
|
this.currRt = null;
|
|
27870
|
+
const shadowRoot = this.getShadow(currRt);
|
|
27895
27871
|
if (this.editLine) {
|
|
27896
|
-
this.
|
|
27872
|
+
this.removeEditLineOrBgOrBounds(this.editLine, shadowRoot);
|
|
27897
27873
|
this.editLine.release();
|
|
27898
27874
|
this.editLine = null;
|
|
27899
|
-
this.
|
|
27875
|
+
this.removeEditLineOrBgOrBounds(this.editBg, shadowRoot);
|
|
27900
27876
|
this.editBg.release();
|
|
27901
27877
|
this.editBg = null;
|
|
27902
27878
|
}
|
|
27903
27879
|
if (trulyDeFocus) {
|
|
27904
27880
|
if (this.shadowBounds) {
|
|
27905
|
-
this.
|
|
27881
|
+
this.removeEditLineOrBgOrBounds(this.shadowBounds, shadowRoot);
|
|
27906
27882
|
this.shadowBounds.release();
|
|
27907
27883
|
this.shadowBounds = null;
|
|
27908
27884
|
}
|
|
@@ -27913,18 +27889,10 @@ class RichTextEditPlugin {
|
|
|
27913
27889
|
}
|
|
27914
27890
|
}
|
|
27915
27891
|
this.focusing = false;
|
|
27916
|
-
const textConfig = currRt.attribute.textConfig;
|
|
27917
|
-
let lastConfig = textConfig[textConfig.length - 1];
|
|
27918
|
-
let cleared = false;
|
|
27919
|
-
while (lastConfig && lastConfig.text === '\n') {
|
|
27920
|
-
textConfig.pop();
|
|
27921
|
-
lastConfig = textConfig[textConfig.length - 1];
|
|
27922
|
-
cleared = true;
|
|
27923
|
-
}
|
|
27924
|
-
cleared && currRt.setAttributes({ textConfig });
|
|
27925
27892
|
currRt.removeEventListener('pointerleave', this.handleLeave);
|
|
27926
27893
|
}
|
|
27927
27894
|
addAnimateToLine(line) {
|
|
27895
|
+
line.setAttributes({ opacity: 1 });
|
|
27928
27896
|
line.animates &&
|
|
27929
27897
|
line.animates.forEach(animate => {
|
|
27930
27898
|
animate.stop();
|
|
@@ -27983,9 +27951,6 @@ class RichTextEditPlugin {
|
|
|
27983
27951
|
};
|
|
27984
27952
|
let line0Info = this.getLineByPoint(cache, startCursorPos);
|
|
27985
27953
|
let line1Info = this.getLineByPoint(cache, endCursorPos);
|
|
27986
|
-
if (!line0Info || !line1Info) {
|
|
27987
|
-
return;
|
|
27988
|
-
}
|
|
27989
27954
|
if (startCursorPos.y > endCursorPos.y ||
|
|
27990
27955
|
(startCursorPos.y === endCursorPos.y && startCursorPos.x > endCursorPos.x)) {
|
|
27991
27956
|
[startCursorPos, endCursorPos] = [endCursorPos, startCursorPos];
|
|
@@ -28058,7 +28023,7 @@ class RichTextEditPlugin {
|
|
|
28058
28023
|
}
|
|
28059
28024
|
getShadow(rt) {
|
|
28060
28025
|
const sr = rt.shadowRoot || rt.attachShadow();
|
|
28061
|
-
sr.setAttributes({
|
|
28026
|
+
sr.setAttributes({ width: 1, height: 1 });
|
|
28062
28027
|
return sr;
|
|
28063
28028
|
}
|
|
28064
28029
|
getLineByPoint(cache, p1) {
|
|
@@ -28130,6 +28095,9 @@ class RichTextEditPlugin {
|
|
|
28130
28095
|
computeGlobalDelta(cache) {
|
|
28131
28096
|
this.deltaX = 0;
|
|
28132
28097
|
this.deltaY = 0;
|
|
28098
|
+
if (cache.lines.length === 0 && this.shadowPlaceHolder) {
|
|
28099
|
+
cache = this.shadowPlaceHolder.getFrameCache();
|
|
28100
|
+
}
|
|
28133
28101
|
const height = cache.height;
|
|
28134
28102
|
const actualHeight = cache.actualHeight;
|
|
28135
28103
|
const width = cache.lines.reduce((w, item) => Math.max(w, item.actualWidth), 0);
|
|
@@ -28180,6 +28148,7 @@ class RichTextEditPlugin {
|
|
|
28180
28148
|
out.x += left;
|
|
28181
28149
|
out.y += top;
|
|
28182
28150
|
this.offsetLineBgAndShadowBounds();
|
|
28151
|
+
this.offsetShadowRoot();
|
|
28183
28152
|
this.editModule.moveTo(out.x, out.y, rt, this.curCursorIdx, this.selectionStartCursorIdx);
|
|
28184
28153
|
}
|
|
28185
28154
|
computedCursorPosByEvent(e, cache) {
|