@visactor/vrender-components 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/axis/type.js.map +1 -1
- package/cjs/brush/brush.js +2 -1
- package/cjs/brush/type.js +1 -2
- package/cjs/constant.d.ts +2 -0
- package/cjs/constant.js +3 -2
- package/cjs/constant.js.map +1 -1
- package/cjs/core/type.js.map +1 -1
- package/cjs/data-zoom/data-zoom.js +7 -4
- package/cjs/data-zoom/data-zoom.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/base.js +7 -4
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/type.d.ts +3 -3
- package/cjs/label/type.js.map +1 -1
- package/cjs/legend/discrete/type.js.map +1 -1
- package/cjs/marker/area.js +5 -14
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/type.js.map +1 -1
- package/cjs/poptip/type.js.map +1 -1
- package/cjs/scrollbar/scrollbar.js +3 -3
- package/cjs/scrollbar/scrollbar.js.map +1 -1
- package/cjs/title/title.js +40 -40
- package/cjs/title/title.js.map +1 -1
- package/dist/index.es.js +346 -332
- package/es/axis/type.js.map +1 -1
- package/es/brush/brush.js +2 -1
- package/es/brush/type.js +1 -2
- package/es/constant.d.ts +2 -0
- package/es/constant.js +5 -1
- package/es/constant.js.map +1 -1
- package/es/core/type.js.map +1 -1
- package/es/data-zoom/data-zoom.js +7 -4
- package/es/data-zoom/data-zoom.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/base.js +7 -4
- package/es/label/base.js.map +1 -1
- package/es/label/type.d.ts +3 -3
- package/es/label/type.js.map +1 -1
- package/es/legend/discrete/type.js.map +1 -1
- package/es/marker/area.js +5 -14
- package/es/marker/area.js.map +1 -1
- package/es/marker/type.js.map +1 -1
- package/es/poptip/type.js.map +1 -1
- package/es/scrollbar/scrollbar.js +4 -4
- package/es/scrollbar/scrollbar.js.map +1 -1
- package/es/title/title.js +37 -38
- package/es/title/title.js.map +1 -1
- package/package.json +8 -8
package/dist/index.es.js
CHANGED
|
@@ -434,12 +434,15 @@ class Container {
|
|
|
434
434
|
serviceIdentifier: injectIdentifier,
|
|
435
435
|
constructorArgsMetadata: constructorArgsMetadata
|
|
436
436
|
},
|
|
437
|
-
|
|
437
|
+
bindings = (this._bindingDictionary.get(injectIdentifier) || []).filter(b => b.constraint(target));
|
|
438
|
+
if (bindings.length) {
|
|
439
|
+
const request = {
|
|
438
440
|
injectIdentifier: injectIdentifier,
|
|
439
441
|
metadata: constructorArgsMetadata,
|
|
440
|
-
bindings:
|
|
442
|
+
bindings: bindings
|
|
441
443
|
};
|
|
442
|
-
|
|
444
|
+
arr.push(request);
|
|
445
|
+
}
|
|
443
446
|
}
|
|
444
447
|
return arr;
|
|
445
448
|
}
|
|
@@ -618,6 +621,12 @@ let DefaultGlobal = class {
|
|
|
618
621
|
get env() {
|
|
619
622
|
return this._env;
|
|
620
623
|
}
|
|
624
|
+
get isImageAnonymous() {
|
|
625
|
+
return this._isImageAnonymous;
|
|
626
|
+
}
|
|
627
|
+
set isImageAnonymous(isImageAnonymous) {
|
|
628
|
+
this._isImageAnonymous = isImageAnonymous;
|
|
629
|
+
}
|
|
621
630
|
get devicePixelRatio() {
|
|
622
631
|
return this._env || this.setEnv("browser"), this.envContribution.getDevicePixelRatio();
|
|
623
632
|
}
|
|
@@ -652,7 +661,7 @@ let DefaultGlobal = class {
|
|
|
652
661
|
this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
|
|
653
662
|
}
|
|
654
663
|
constructor(contributions) {
|
|
655
|
-
this.contributions = contributions, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
664
|
+
this.contributions = contributions, this._isImageAnonymous = !0, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
656
665
|
onSetEnv: new SyncHook(["lastEnv", "env", "global"])
|
|
657
666
|
}, this.measureTextMethod = "native", this.optimizeVisible = !1;
|
|
658
667
|
}
|
|
@@ -1593,7 +1602,7 @@ let Step$1 = class Step {
|
|
|
1593
1602
|
default:
|
|
1594
1603
|
if (this._t <= 0) this.context.lineTo(this._x, y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p);else {
|
|
1595
1604
|
const x1 = this._x * (1 - this._t) + x * this._t;
|
|
1596
|
-
this.context.lineTo(x1, this._y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x1, y, !1 !== this._lastDefined && !1 !== p.defined, p);
|
|
1605
|
+
.5 === this._t ? this.context.lineTo(x1, this._y, !1 !== this._lastDefined, this.lastPoint) : this.context.lineTo(x1, this._y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x1, y, !1 !== this._lastDefined && !1 !== p.defined, p);
|
|
1597
1606
|
}
|
|
1598
1607
|
}
|
|
1599
1608
|
this._lastDefined = p.defined, this._x = x, this._y = y, this.lastPoint = p;
|
|
@@ -2028,10 +2037,10 @@ class CustomPath2D extends CurvePath {
|
|
|
2028
2037
|
x = current[5], y = current[6], controlX = current[3], controlY = current[4], this.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x + l, y + t);
|
|
2029
2038
|
break;
|
|
2030
2039
|
case "s":
|
|
2031
|
-
tempX = x + current[3], tempY = y + current[4], controlX = 2 * x - controlX, controlY = 2 * y - controlY, this.bezierCurveTo(controlX + l, controlY + t,
|
|
2040
|
+
tempX = x + current[3], tempY = y + current[4], null === previous[0].match(/[CcSs]/) ? (controlX = x, controlY = y) : (controlX = 2 * x - controlX, controlY = 2 * y - controlY), tempControlX = x + current[1], tempControlY = y + current[2], this.bezierCurveTo(controlX + l, controlY + t, tempControlX + l, tempControlY + t, tempX + l, tempY + t), controlX = tempControlX, controlY = tempControlY, x = tempX, y = tempY;
|
|
2032
2041
|
break;
|
|
2033
2042
|
case "S":
|
|
2034
|
-
tempX = current[3], tempY = current[4], controlX = 2 * x - controlX, controlY = 2 * y - controlY, this.bezierCurveTo(controlX + l, controlY + t,
|
|
2043
|
+
tempX = current[3], tempY = current[4], null === previous[0].match(/[CcSs]/) ? (controlX = x, controlY = y) : (controlX = 2 * x - controlX, controlY = 2 * y - controlY), tempControlX = current[1], tempControlY = current[2], this.bezierCurveTo(controlX + l, controlY + t, tempControlX + l, tempControlY + t, tempX + l, tempY + t), controlX = tempControlX, controlY = tempControlY, x = tempX, y = tempY;
|
|
2035
2044
|
break;
|
|
2036
2045
|
case "q":
|
|
2037
2046
|
tempX = x + current[3], tempY = y + current[4], controlX = x + current[1], controlY = y + current[2], this.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t), x = tempX, y = tempY;
|
|
@@ -2259,7 +2268,7 @@ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
|
|
|
2259
2268
|
opacity: 1,
|
|
2260
2269
|
background: null,
|
|
2261
2270
|
autoAnimateTexture: !1,
|
|
2262
|
-
textureRatio:
|
|
2271
|
+
textureRatio: 1,
|
|
2263
2272
|
textureOptions: null,
|
|
2264
2273
|
backgroundOpacity: 1,
|
|
2265
2274
|
backgroundCornerRadius: 0,
|
|
@@ -2269,6 +2278,7 @@ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
|
|
|
2269
2278
|
texturePadding: 2,
|
|
2270
2279
|
backgroundMode: "no-repeat",
|
|
2271
2280
|
backgroundFit: !0,
|
|
2281
|
+
backgroundKeepAspectRatio: !1,
|
|
2272
2282
|
backgroundClip: !0,
|
|
2273
2283
|
backgroundScale: 1,
|
|
2274
2284
|
backgroundOffsetX: 0,
|
|
@@ -2413,8 +2423,10 @@ const DefaultTextAttribute = Object.assign(Object.assign(Object.assign({}, Defau
|
|
|
2413
2423
|
keepDirIn3d: !0
|
|
2414
2424
|
});
|
|
2415
2425
|
const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), {
|
|
2426
|
+
upgradeAttrs: null,
|
|
2416
2427
|
editable: !1,
|
|
2417
2428
|
editOptions: null,
|
|
2429
|
+
ascentDescentMode: "actual",
|
|
2418
2430
|
width: 300,
|
|
2419
2431
|
height: 300,
|
|
2420
2432
|
ellipsis: !0,
|
|
@@ -2852,14 +2864,17 @@ function testLetter2(string, index) {
|
|
|
2852
2864
|
return i + 1;
|
|
2853
2865
|
}
|
|
2854
2866
|
function measureTextCanvas(text, character) {
|
|
2867
|
+
let mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "actual";
|
|
2855
2868
|
const measurement = application.graphicUtil.textMeasure.measureText(text, character),
|
|
2856
2869
|
result = {
|
|
2857
2870
|
ascent: 0,
|
|
2858
2871
|
height: 0,
|
|
2859
2872
|
descent: 0,
|
|
2860
2873
|
width: 0
|
|
2861
|
-
}
|
|
2862
|
-
|
|
2874
|
+
},
|
|
2875
|
+
ascent = "actual" === mode ? measurement.actualBoundingBoxAscent : measurement.fontBoundingBoxAscent,
|
|
2876
|
+
descent = "actual" === mode ? measurement.actualBoundingBoxDescent : measurement.fontBoundingBoxDescent;
|
|
2877
|
+
return "number" != typeof ascent || "number" != typeof descent ? (result.width = Math.floor(measurement.width), result.height = character.fontSize || 0, result.ascent = result.height, result.descent = 0) : (result.width = Math.floor(measurement.width), result.height = Math.floor(ascent + descent), result.ascent = Math.floor(ascent), result.descent = result.height - result.ascent), result;
|
|
2863
2878
|
}
|
|
2864
2879
|
|
|
2865
2880
|
var __decorate$O = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
@@ -2885,6 +2900,9 @@ let ATextMeasure = class {
|
|
|
2885
2900
|
}
|
|
2886
2901
|
compatibleMetrics(metrics, options) {
|
|
2887
2902
|
if (null == metrics.actualBoundingBoxAscent || null == metrics.actualBoundingBoxDescent || null == metrics.fontBoundingBoxAscent || null == metrics.fontBoundingBoxDescent) {
|
|
2903
|
+
metrics = {
|
|
2904
|
+
width: metrics.width
|
|
2905
|
+
};
|
|
2888
2906
|
const {
|
|
2889
2907
|
ascent: ascent,
|
|
2890
2908
|
descent: descent
|
|
@@ -2892,6 +2910,13 @@ let ATextMeasure = class {
|
|
|
2892
2910
|
metrics.actualBoundingBoxAscent = ascent, metrics.actualBoundingBoxDescent = descent, metrics.fontBoundingBoxAscent = ascent, metrics.fontBoundingBoxDescent = descent;
|
|
2893
2911
|
}
|
|
2894
2912
|
if (null == metrics.actualBoundingBoxLeft || null == metrics.actualBoundingBoxRight) {
|
|
2913
|
+
metrics = {
|
|
2914
|
+
width: metrics.width,
|
|
2915
|
+
actualBoundingBoxAscent: metrics.actualBoundingBoxAscent,
|
|
2916
|
+
actualBoundingBoxDescent: metrics.actualBoundingBoxDescent,
|
|
2917
|
+
fontBoundingBoxAscent: metrics.fontBoundingBoxAscent,
|
|
2918
|
+
fontBoundingBoxDescent: metrics.fontBoundingBoxDescent
|
|
2919
|
+
};
|
|
2895
2920
|
const {
|
|
2896
2921
|
left: left,
|
|
2897
2922
|
right: right
|
|
@@ -4381,7 +4406,7 @@ class Animate {
|
|
|
4381
4406
|
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Generator.GenAutoIncrementId();
|
|
4382
4407
|
let timeline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultTimeline;
|
|
4383
4408
|
let slience = arguments.length > 2 ? arguments[2] : undefined;
|
|
4384
|
-
this.id = id, this.timeline = timeline, this.status = AnimateStatus.INITIAL, this.tailAnimate = new SubAnimate(this), this.subAnimates = [this.tailAnimate], this.timeScale = 1, this.rawPosition = -1, this._startTime = 0, this._duringTime = 0, this.timeline.addAnimate(this), this.slience = slience;
|
|
4409
|
+
this.id = id, this.timeline = timeline || defaultTimeline, this.status = AnimateStatus.INITIAL, this.tailAnimate = new SubAnimate(this), this.subAnimates = [this.tailAnimate], this.timeScale = 1, this.rawPosition = -1, this._startTime = 0, this._duringTime = 0, this.timeline.addAnimate(this), this.slience = slience;
|
|
4385
4410
|
}
|
|
4386
4411
|
setTimeline(timeline) {
|
|
4387
4412
|
timeline !== this.timeline && (this.timeline.removeAnimate(this, !1), timeline.addAnimate(this));
|
|
@@ -4829,7 +4854,8 @@ class IncreaseCount extends ACustomAnimate {
|
|
|
4829
4854
|
}
|
|
4830
4855
|
onEnd() {}
|
|
4831
4856
|
onUpdate(end, ratio, out) {
|
|
4832
|
-
|
|
4857
|
+
var _a;
|
|
4858
|
+
!1 !== this.valid && (out.text = end ? null === (_a = this.to) || void 0 === _a ? void 0 : _a.text : (this.fromNumber + (this.toNumber - this.fromNumber) * ratio).toFixed(this.decimalLength));
|
|
4833
4859
|
}
|
|
4834
4860
|
}
|
|
4835
4861
|
var Direction;
|
|
@@ -5045,7 +5071,7 @@ class ResourceLoader {
|
|
|
5045
5071
|
}
|
|
5046
5072
|
static GetFile(url, type) {
|
|
5047
5073
|
let data = ResourceLoader.cache.get(url);
|
|
5048
|
-
return data ? "
|
|
5074
|
+
return data ? "fail" === data.loadState ? Promise.reject() : "init" === data.loadState || "loading" === data.loadState ? data.dataPromise.then(data => data.data) : Promise.resolve(data.data) : (data = {
|
|
5049
5075
|
type: type,
|
|
5050
5076
|
loadState: "init"
|
|
5051
5077
|
}, ResourceLoader.cache.set(url, data), "arrayBuffer" === type ? data.dataPromise = application.global.loadArrayBuffer(url) : "blob" === type ? data.dataPromise = application.global.loadBlob(url) : "json" === type && (data.dataPromise = application.global.loadJson(url)), data.dataPromise.then(data => data.data));
|
|
@@ -5441,7 +5467,7 @@ class Graphic extends Node {
|
|
|
5441
5467
|
null != onStart && animate.onStart(onStart), null != onFrame && animate.onFrame(onFrame), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove), animate.interpolateFunc = params.interpolate;
|
|
5442
5468
|
}
|
|
5443
5469
|
return this.animates.set(animate.id, animate), animate.onRemove(() => {
|
|
5444
|
-
this.animates.delete(animate.id);
|
|
5470
|
+
animate.stop(), this.animates.delete(animate.id);
|
|
5445
5471
|
}), animate;
|
|
5446
5472
|
}
|
|
5447
5473
|
onAttributeUpdate(context) {
|
|
@@ -5506,9 +5532,10 @@ class Graphic extends Node {
|
|
|
5506
5532
|
this.hasState() && this.normalAttrs ? (this.currentStates = [], this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, !0)) : this.currentStates = [], this.normalAttrs = null;
|
|
5507
5533
|
}
|
|
5508
5534
|
removeState(stateName, hasAnimation) {
|
|
5509
|
-
if (
|
|
5510
|
-
const
|
|
5511
|
-
|
|
5535
|
+
if (this.currentStates) {
|
|
5536
|
+
const filter = isArray(stateName) ? s => !stateName.includes(s) : s => s !== stateName,
|
|
5537
|
+
newStates = this.currentStates.filter(filter);
|
|
5538
|
+
newStates.length !== this.currentStates.length && this.useStates(newStates, hasAnimation);
|
|
5512
5539
|
}
|
|
5513
5540
|
}
|
|
5514
5541
|
toggleState(stateName, hasAnimation) {
|
|
@@ -5645,7 +5672,7 @@ class Graphic extends Node {
|
|
|
5645
5672
|
if (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this.animates && this.animates.size) {
|
|
5646
5673
|
const timeline = stage.getTimeline();
|
|
5647
5674
|
this.animates.forEach(a => {
|
|
5648
|
-
a.setTimeline(timeline);
|
|
5675
|
+
a.timeline === defaultTimeline && a.setTimeline(timeline);
|
|
5649
5676
|
});
|
|
5650
5677
|
}
|
|
5651
5678
|
this._onSetStage && this._onSetStage(this, stage, layer), application.graphicService.onSetStage(this, stage);
|
|
@@ -5749,7 +5776,7 @@ class Graphic extends Node {
|
|
|
5749
5776
|
return shadowRoot && (shadowRoot.shadowHost = this), this.shadowRoot = null != shadowRoot ? shadowRoot : application.graphicService.creator.shadowRoot(this), this.addUpdateBoundTag(), this.shadowRoot.setStage(this.stage, this.layer), this.shadowRoot;
|
|
5750
5777
|
}
|
|
5751
5778
|
detachShadow() {
|
|
5752
|
-
this.shadowRoot && (this.addUpdateBoundTag(), this.shadowRoot = null);
|
|
5779
|
+
this.shadowRoot && (this.addUpdateBoundTag(), this.shadowRoot.release(!0), this.shadowRoot = null);
|
|
5753
5780
|
}
|
|
5754
5781
|
toJson() {
|
|
5755
5782
|
return {
|
|
@@ -5801,7 +5828,7 @@ class Graphic extends Node {
|
|
|
5801
5828
|
});
|
|
5802
5829
|
}
|
|
5803
5830
|
release() {
|
|
5804
|
-
this.releaseStatus = "released", application.graphicService.onRelease(this);
|
|
5831
|
+
this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
|
|
5805
5832
|
}
|
|
5806
5833
|
_emitCustomEvent(type, context) {
|
|
5807
5834
|
var _a, _b;
|
|
@@ -6295,6 +6322,11 @@ class Group extends Graphic {
|
|
|
6295
6322
|
getNoWorkAnimateAttr() {
|
|
6296
6323
|
return Group.NOWORK_ANIMATE_ATTR;
|
|
6297
6324
|
}
|
|
6325
|
+
release(all) {
|
|
6326
|
+
all && this.forEachChildren(g => {
|
|
6327
|
+
g.release(all);
|
|
6328
|
+
}), super.release();
|
|
6329
|
+
}
|
|
6298
6330
|
}
|
|
6299
6331
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
6300
6332
|
function createGroup(attributes) {
|
|
@@ -8341,6 +8373,20 @@ let Symbol$1 = class Symbol extends Graphic {
|
|
|
8341
8373
|
getParsedPath() {
|
|
8342
8374
|
return this.shouldUpdateShape() && (this.doUpdateParsedPath(), this.clearUpdateShapeTag()), this._parsedPath;
|
|
8343
8375
|
}
|
|
8376
|
+
getParsedPath2D() {
|
|
8377
|
+
let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
8378
|
+
let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
8379
|
+
let size = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
8380
|
+
let path = null;
|
|
8381
|
+
try {
|
|
8382
|
+
path = new Path2D();
|
|
8383
|
+
} catch (err) {
|
|
8384
|
+
return null;
|
|
8385
|
+
}
|
|
8386
|
+
const parsedPath = this.getParsedPath();
|
|
8387
|
+
if (!parsedPath) return null;
|
|
8388
|
+
parsedPath.draw(path, size, x, y);
|
|
8389
|
+
}
|
|
8344
8390
|
isValid() {
|
|
8345
8391
|
return super.isValid() && this._isValid();
|
|
8346
8392
|
}
|
|
@@ -8483,7 +8529,7 @@ let Line$1 = class Line extends Graphic {
|
|
|
8483
8529
|
} = attribute,
|
|
8484
8530
|
b = aabbBounds;
|
|
8485
8531
|
return points.forEach(p => {
|
|
8486
|
-
!1 === p.defined && "
|
|
8532
|
+
!1 === p.defined && "connect" !== connectedType || b.add(p.x, p.y);
|
|
8487
8533
|
}), b;
|
|
8488
8534
|
}
|
|
8489
8535
|
updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds, graphic) {
|
|
@@ -8494,7 +8540,7 @@ let Line$1 = class Line extends Graphic {
|
|
|
8494
8540
|
b = aabbBounds;
|
|
8495
8541
|
return segments.forEach(s => {
|
|
8496
8542
|
s.points.forEach(p => {
|
|
8497
|
-
!1 === p.defined && "
|
|
8543
|
+
!1 === p.defined && "connect" !== connectedType || b.add(p.x, p.y);
|
|
8498
8544
|
});
|
|
8499
8545
|
}), b;
|
|
8500
8546
|
}
|
|
@@ -8746,16 +8792,20 @@ class Frame {
|
|
|
8746
8792
|
}
|
|
8747
8793
|
|
|
8748
8794
|
function getFixedLRTB(left, right, top, bottom) {
|
|
8795
|
+
const leftInt = Math.round(left),
|
|
8796
|
+
topInt = Math.round(top),
|
|
8797
|
+
rightInt = Math.round(right),
|
|
8798
|
+
bottomInt = Math.round(bottom);
|
|
8749
8799
|
return {
|
|
8750
|
-
left:
|
|
8751
|
-
top:
|
|
8752
|
-
right:
|
|
8753
|
-
bottom:
|
|
8800
|
+
left: left > leftInt ? leftInt : leftInt - .5,
|
|
8801
|
+
top: top > topInt ? topInt : topInt - .5,
|
|
8802
|
+
right: rightInt > right ? rightInt : rightInt + .5,
|
|
8803
|
+
bottom: bottomInt > bottom ? bottomInt : bottomInt + .5
|
|
8754
8804
|
};
|
|
8755
8805
|
}
|
|
8756
8806
|
class Paragraph {
|
|
8757
|
-
constructor(text, newLine, character) {
|
|
8758
|
-
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic";
|
|
8807
|
+
constructor(text, newLine, character, ascentDescentMode) {
|
|
8808
|
+
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic", this.ascentDescentMode = ascentDescentMode;
|
|
8759
8809
|
const lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
|
|
8760
8810
|
this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
|
|
8761
8811
|
const {
|
|
@@ -8763,7 +8813,7 @@ class Paragraph {
|
|
|
8763
8813
|
height: height,
|
|
8764
8814
|
descent: descent,
|
|
8765
8815
|
width: width
|
|
8766
|
-
} = measureTextCanvas(text, character);
|
|
8816
|
+
} = measureTextCanvas(text, character, this.ascentDescentMode);
|
|
8767
8817
|
let halfDetaHeight = 0,
|
|
8768
8818
|
deltaAscent = 0,
|
|
8769
8819
|
deltaDescent = 0;
|
|
@@ -8772,11 +8822,11 @@ class Paragraph {
|
|
|
8772
8822
|
updateWidth() {
|
|
8773
8823
|
const {
|
|
8774
8824
|
width: width
|
|
8775
|
-
} = measureTextCanvas(this.text, this.character);
|
|
8825
|
+
} = measureTextCanvas(this.text, this.character, this.ascentDescentMode);
|
|
8776
8826
|
this.width = width, "vertical" === this.direction && (this.widthOrigin = this.width, this.width = this.heightOrigin, this.height = this.widthOrigin);
|
|
8777
8827
|
}
|
|
8778
8828
|
drawBackground(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
|
|
8779
|
-
if (!this.character.background || this.character.backgroundOpacity && !(this.character.backgroundOpacity > 0)) return;
|
|
8829
|
+
if ("" === this.text || "\n" === this.text || !this.character.background || this.character.backgroundOpacity && !(this.character.backgroundOpacity > 0)) return;
|
|
8780
8830
|
let baseline = top + ascent,
|
|
8781
8831
|
text = this.text,
|
|
8782
8832
|
left = this.left + deltaLeft;
|
|
@@ -8789,7 +8839,7 @@ class Paragraph {
|
|
|
8789
8839
|
if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
|
|
8790
8840
|
const {
|
|
8791
8841
|
width: width
|
|
8792
|
-
} = measureTextCanvas(this.text.slice(index), this.character);
|
|
8842
|
+
} = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
|
|
8793
8843
|
"vertical" === direction || (left -= this.ellipsisWidth - width);
|
|
8794
8844
|
}
|
|
8795
8845
|
}
|
|
@@ -8813,7 +8863,7 @@ class Paragraph {
|
|
|
8813
8863
|
if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
|
|
8814
8864
|
const {
|
|
8815
8865
|
width: width
|
|
8816
|
-
} = measureTextCanvas(this.text.slice(index), this.character);
|
|
8866
|
+
} = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
|
|
8817
8867
|
"vertical" === direction || (left -= this.ellipsisWidth - width);
|
|
8818
8868
|
}
|
|
8819
8869
|
}
|
|
@@ -8833,21 +8883,21 @@ class Paragraph {
|
|
|
8833
8883
|
if (this.character.underline) {
|
|
8834
8884
|
const top = 1 + baseline,
|
|
8835
8885
|
lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
|
|
8836
|
-
ctx.fillRect(lrtb.left,
|
|
8886
|
+
ctx.fillRect(lrtb.left, 1 + baseline, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
|
|
8837
8887
|
}
|
|
8838
8888
|
if (this.character.lineThrough) {
|
|
8839
8889
|
const top = 1 + baseline - this.ascent / 2,
|
|
8840
8890
|
lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
|
|
8841
|
-
ctx.fillRect(lrtb.left,
|
|
8891
|
+
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);
|
|
8842
8892
|
}
|
|
8843
8893
|
} else if ("underline" === this.character.textDecoration) {
|
|
8844
8894
|
const top = 1 + baseline,
|
|
8845
8895
|
lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
|
|
8846
|
-
ctx.fillRect(lrtb.left,
|
|
8896
|
+
ctx.fillRect(lrtb.left, 1 + baseline, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
|
|
8847
8897
|
} else if ("line-through" === this.character.textDecoration) {
|
|
8848
8898
|
const top = 1 + baseline - this.ascent / 2,
|
|
8849
8899
|
lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
|
|
8850
|
-
ctx.fillRect(lrtb.left,
|
|
8900
|
+
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);
|
|
8851
8901
|
}
|
|
8852
8902
|
"vertical" === direction && ctx.restore();
|
|
8853
8903
|
}
|
|
@@ -8861,7 +8911,7 @@ class Paragraph {
|
|
|
8861
8911
|
text = text.slice(0, index), text += this.ellipsisStr;
|
|
8862
8912
|
const {
|
|
8863
8913
|
width: measureWidth
|
|
8864
|
-
} = measureTextCanvas(this.text.slice(index), this.character);
|
|
8914
|
+
} = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
|
|
8865
8915
|
return width + this.ellipsisWidth - measureWidth;
|
|
8866
8916
|
}
|
|
8867
8917
|
return width;
|
|
@@ -8870,7 +8920,7 @@ class Paragraph {
|
|
|
8870
8920
|
function seperateParagraph(paragraph, index) {
|
|
8871
8921
|
const text1 = paragraph.text.slice(0, index),
|
|
8872
8922
|
text2 = paragraph.text.slice(index);
|
|
8873
|
-
return [new Paragraph(text1, paragraph.newLine, paragraph.character), new Paragraph(text2, !0, paragraph.character)];
|
|
8923
|
+
return [new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode), new Paragraph(text2, !0, paragraph.character, paragraph.ascentDescentMode)];
|
|
8874
8924
|
}
|
|
8875
8925
|
|
|
8876
8926
|
const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
@@ -9059,7 +9109,7 @@ class Line {
|
|
|
9059
9109
|
paragraph.ellipsisStr = ellipsis;
|
|
9060
9110
|
const {
|
|
9061
9111
|
width: width
|
|
9062
|
-
} = measureTextCanvas(ellipsis, paragraph.character),
|
|
9112
|
+
} = measureTextCanvas(ellipsis, paragraph.character, paragraph.ascentDescentMode),
|
|
9063
9113
|
ellipsisWidth = width || 0;
|
|
9064
9114
|
if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
|
|
9065
9115
|
lastLine && (paragraph.ellipsis = "add");
|
|
@@ -9106,7 +9156,7 @@ class Line {
|
|
|
9106
9156
|
if (paragraph instanceof RichTextIcon) break;
|
|
9107
9157
|
const {
|
|
9108
9158
|
width: width
|
|
9109
|
-
} = measureTextCanvas(ellipsis, paragraph.character),
|
|
9159
|
+
} = measureTextCanvas(ellipsis, paragraph.character, paragraph.ascentDescentMode),
|
|
9110
9160
|
ellipsisWidth = width || 0;
|
|
9111
9161
|
if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
|
|
9112
9162
|
paragraph.ellipsis = "add", paragraph.ellipsisWidth = ellipsisWidth;
|
|
@@ -9159,6 +9209,12 @@ class Wrapper {
|
|
|
9159
9209
|
}
|
|
9160
9210
|
}
|
|
9161
9211
|
|
|
9212
|
+
let supportIntl = !1;
|
|
9213
|
+
try {
|
|
9214
|
+
supportIntl = Intl && "function" == typeof Intl.Segmenter;
|
|
9215
|
+
} catch (e) {
|
|
9216
|
+
supportIntl = !1;
|
|
9217
|
+
}
|
|
9162
9218
|
const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", "fontFamily", "fontStyle", "fontWeight", "lineWidth", "opacity", "fillOpacity", "strokeOpacity", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
9163
9219
|
class RichText extends Graphic {
|
|
9164
9220
|
constructor(params) {
|
|
@@ -9247,13 +9303,17 @@ class RichText extends Graphic {
|
|
|
9247
9303
|
}
|
|
9248
9304
|
return cache.every(item => item.isComposing || !(item.text && isString(item.text) && RichText.splitText(item.text).length > 1));
|
|
9249
9305
|
}
|
|
9250
|
-
static splitEmoji(text) {
|
|
9251
|
-
return [...new Intl.Segmenter().segment(text)].map(x => x.segment);
|
|
9252
|
-
}
|
|
9253
9306
|
static splitText(text) {
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9307
|
+
if (supportIntl) {
|
|
9308
|
+
const segmenter = new Intl.Segmenter(void 0, {
|
|
9309
|
+
granularity: "grapheme"
|
|
9310
|
+
}),
|
|
9311
|
+
segments = [];
|
|
9312
|
+
for (const {
|
|
9313
|
+
segment: segment
|
|
9314
|
+
} of segmenter.segment(text)) segments.push(segment);
|
|
9315
|
+
return segments;
|
|
9316
|
+
}
|
|
9257
9317
|
return Array.from(text);
|
|
9258
9318
|
}
|
|
9259
9319
|
static TransformTextConfig2SingleCharacter(textConfig) {
|
|
@@ -9269,14 +9329,14 @@ class RichText extends Graphic {
|
|
|
9269
9329
|
}), tc;
|
|
9270
9330
|
}
|
|
9271
9331
|
updateAABBBounds(attribute, richtextTheme, aabbBounds) {
|
|
9272
|
-
var _a, _b;
|
|
9332
|
+
var _a, _b, _c, _d;
|
|
9273
9333
|
const {
|
|
9274
9334
|
width = richtextTheme.width,
|
|
9275
9335
|
height = richtextTheme.height,
|
|
9276
9336
|
maxWidth = richtextTheme.maxWidth,
|
|
9277
9337
|
maxHeight = richtextTheme.maxHeight,
|
|
9278
9338
|
textAlign = richtextTheme.textAlign,
|
|
9279
|
-
|
|
9339
|
+
verticalDirection = null !== (_b = null !== (_a = attribute.textBaseline) && void 0 !== _a ? _a : richtextTheme.textBaseline) && void 0 !== _b ? _b : richtextTheme.verticalDirection,
|
|
9280
9340
|
editOptions: editOptions
|
|
9281
9341
|
} = attribute;
|
|
9282
9342
|
if (width > 0 && height > 0) aabbBounds.set(0, 0, width, height);else {
|
|
@@ -9289,9 +9349,9 @@ class RichText extends Graphic {
|
|
|
9289
9349
|
contentHeight = height || actualHeight || 0;
|
|
9290
9350
|
contentHeight = "number" == typeof maxHeight && contentHeight > maxHeight ? maxHeight : contentHeight || 0, contentWidth = "number" == typeof maxWidth && contentWidth > maxWidth ? maxWidth : contentWidth || 0, aabbBounds.set(0, 0, contentWidth, contentHeight);
|
|
9291
9351
|
}
|
|
9292
|
-
editOptions && editOptions.keepHeightWhileEmpty && !aabbBounds.height() && !(null === (
|
|
9352
|
+
editOptions && editOptions.keepHeightWhileEmpty && !aabbBounds.height() && !(null === (_c = attribute.textConfig) || void 0 === _c ? void 0 : _c.length) && (aabbBounds.y2 = aabbBounds.y1 + (null !== (_d = attribute.fontSize) && void 0 !== _d ? _d : 12), aabbBounds.x2 = aabbBounds.x1 + 2);
|
|
9293
9353
|
let deltaY = 0;
|
|
9294
|
-
switch (
|
|
9354
|
+
switch (verticalDirection) {
|
|
9295
9355
|
case "top":
|
|
9296
9356
|
deltaY = 0;
|
|
9297
9357
|
break;
|
|
@@ -9312,7 +9372,7 @@ class RichText extends Graphic {
|
|
|
9312
9372
|
case "right":
|
|
9313
9373
|
deltaX = -aabbBounds.width();
|
|
9314
9374
|
}
|
|
9315
|
-
return aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), aabbBounds;
|
|
9375
|
+
return aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
|
|
9316
9376
|
}
|
|
9317
9377
|
needUpdateTags(keys) {
|
|
9318
9378
|
return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);
|
|
@@ -9340,47 +9400,53 @@ class RichText extends Graphic {
|
|
|
9340
9400
|
}
|
|
9341
9401
|
combinedStyleToCharacter(config) {
|
|
9342
9402
|
const {
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9403
|
+
fill: fill,
|
|
9404
|
+
stroke: stroke,
|
|
9405
|
+
fontSize: fontSize,
|
|
9406
|
+
fontFamily: fontFamily,
|
|
9407
|
+
fontStyle: fontStyle,
|
|
9408
|
+
fontWeight: fontWeight,
|
|
9409
|
+
lineWidth: lineWidth,
|
|
9410
|
+
opacity: opacity,
|
|
9411
|
+
fillOpacity: fillOpacity,
|
|
9412
|
+
lineHeight: lineHeight,
|
|
9413
|
+
strokeOpacity: strokeOpacity,
|
|
9414
|
+
upgradeAttrs: upgradeAttrs
|
|
9415
|
+
} = this.attribute,
|
|
9416
|
+
out = Object.assign({
|
|
9417
|
+
fill: fill,
|
|
9418
|
+
stroke: stroke,
|
|
9419
|
+
fontSize: fontSize,
|
|
9420
|
+
fontFamily: fontFamily,
|
|
9421
|
+
fontStyle: fontStyle,
|
|
9422
|
+
fontWeight: fontWeight,
|
|
9423
|
+
lineWidth: lineWidth,
|
|
9424
|
+
opacity: opacity,
|
|
9425
|
+
fillOpacity: fillOpacity,
|
|
9426
|
+
strokeOpacity: strokeOpacity
|
|
9427
|
+
}, config);
|
|
9428
|
+
return (null == upgradeAttrs ? void 0 : upgradeAttrs.lineHeight) && (out.lineHeight = lineHeight), out;
|
|
9366
9429
|
}
|
|
9367
9430
|
doUpdateFrameCache(tc) {
|
|
9368
9431
|
var _a;
|
|
9369
9432
|
const {
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9433
|
+
maxWidth: maxWidth,
|
|
9434
|
+
maxHeight: maxHeight,
|
|
9435
|
+
width: width,
|
|
9436
|
+
height: height,
|
|
9437
|
+
ellipsis: ellipsis,
|
|
9438
|
+
wordBreak: wordBreak,
|
|
9439
|
+
verticalDirection: verticalDirection,
|
|
9440
|
+
textAlign: textAlign,
|
|
9441
|
+
textBaseline: textBaseline,
|
|
9442
|
+
layoutDirection: layoutDirection,
|
|
9443
|
+
singleLine: singleLine,
|
|
9444
|
+
disableAutoWrapLine: disableAutoWrapLine,
|
|
9445
|
+
editable: editable,
|
|
9446
|
+
ascentDescentMode: ascentDescentMode,
|
|
9447
|
+
upgradeAttrs: upgradeAttrs
|
|
9448
|
+
} = this.attribute,
|
|
9449
|
+
enableMultiBreakLine = upgradeAttrs && upgradeAttrs.multiBreakLine;
|
|
9384
9450
|
let {
|
|
9385
9451
|
textConfig: _tc = []
|
|
9386
9452
|
} = this.attribute;
|
|
@@ -9402,8 +9468,11 @@ class RichText extends Graphic {
|
|
|
9402
9468
|
const richTextConfig = this.combinedStyleToCharacter(textConfig[i]);
|
|
9403
9469
|
if (isNumber(richTextConfig.text) && (richTextConfig.text = `${richTextConfig.text}`), richTextConfig.text && richTextConfig.text.includes("\n")) {
|
|
9404
9470
|
const textParts = richTextConfig.text.split("\n");
|
|
9405
|
-
for (let j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j],
|
|
9406
|
-
|
|
9471
|
+
for (let j = 0; j < textParts.length; j++) if (0 === j) paragraphs.push(new Paragraph(textParts[j], !1, richTextConfig, ascentDescentMode));else if (textParts[j] || i === textConfig.length - 1) paragraphs.push(new Paragraph(textParts[j], !0, richTextConfig, ascentDescentMode));else {
|
|
9472
|
+
const nextRichTextConfig = this.combinedStyleToCharacter(textConfig[i + 1]);
|
|
9473
|
+
paragraphs.push(new Paragraph(textParts[j], !0, nextRichTextConfig, ascentDescentMode));
|
|
9474
|
+
}
|
|
9475
|
+
} else richTextConfig.text && paragraphs.push(new Paragraph(richTextConfig.text, !1, richTextConfig, ascentDescentMode));
|
|
9407
9476
|
}
|
|
9408
9477
|
const maxWidthFinite = "number" == typeof maxWidth && Number.isFinite(maxWidth) && maxWidth > 0,
|
|
9409
9478
|
maxHeightFinite = "number" == typeof maxHeight && Number.isFinite(maxHeight) && maxHeight > 0,
|
|
@@ -9411,7 +9480,7 @@ class RichText extends Graphic {
|
|
|
9411
9480
|
richTextHeightEnable = "number" == typeof height && Number.isFinite(height) && height > 0 && (!maxHeightFinite || height <= maxHeight),
|
|
9412
9481
|
frame = new Frame(0, 0, (richTextWidthEnable ? width : maxWidthFinite ? maxWidth : 0) || 0, (richTextHeightEnable ? height : maxHeightFinite ? maxHeight : 0) || 0, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection || "horizontal", !richTextWidthEnable && maxWidthFinite, !richTextHeightEnable && maxHeightFinite, singleLine || !1, null === (_a = this._frameCache) || void 0 === _a ? void 0 : _a.icons),
|
|
9413
9482
|
wrapper = new Wrapper(frame);
|
|
9414
|
-
if (wrapper.newLine =
|
|
9483
|
+
if (wrapper.newLine = enableMultiBreakLine, disableAutoWrapLine) {
|
|
9415
9484
|
let lineCount = 0,
|
|
9416
9485
|
skip = !1;
|
|
9417
9486
|
for (let i = 0; i < paragraphs.length; i++) {
|
|
@@ -9427,7 +9496,7 @@ class RichText extends Graphic {
|
|
|
9427
9496
|
l.calcOffset(offsetSize, !1);
|
|
9428
9497
|
});
|
|
9429
9498
|
}
|
|
9430
|
-
|
|
9499
|
+
enableMultiBreakLine && frame.lines.forEach(item => {
|
|
9431
9500
|
const lastParagraphs = item.paragraphs;
|
|
9432
9501
|
item.paragraphs = item.paragraphs.filter(p => "" !== p.text), 0 === item.paragraphs.length && lastParagraphs.length && (lastParagraphs[0].text = "\n", item.paragraphs.push(lastParagraphs[0]));
|
|
9433
9502
|
}), this._frameCache = frame;
|
|
@@ -10137,6 +10206,7 @@ class DefaultBaseBackgroundRenderContribution {
|
|
|
10137
10206
|
opacity = graphicAttribute.opacity,
|
|
10138
10207
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
10139
10208
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
10209
|
+
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
10140
10210
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
10141
10211
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
10142
10212
|
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
@@ -10158,6 +10228,7 @@ class DefaultBaseBackgroundRenderContribution {
|
|
|
10158
10228
|
context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, this.doDrawImage(context, res.data, b, {
|
|
10159
10229
|
backgroundMode: backgroundMode,
|
|
10160
10230
|
backgroundFit: backgroundFit,
|
|
10231
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
10161
10232
|
backgroundScale: backgroundScale,
|
|
10162
10233
|
backgroundOffsetX: backgroundOffsetX,
|
|
10163
10234
|
backgroundOffsetY: backgroundOffsetY
|
|
@@ -10168,6 +10239,7 @@ class DefaultBaseBackgroundRenderContribution {
|
|
|
10168
10239
|
const {
|
|
10169
10240
|
backgroundMode: backgroundMode,
|
|
10170
10241
|
backgroundFit: backgroundFit,
|
|
10242
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
10171
10243
|
backgroundScale = 1,
|
|
10172
10244
|
backgroundOffsetX = 0,
|
|
10173
10245
|
backgroundOffsetY = 0
|
|
@@ -10177,7 +10249,12 @@ class DefaultBaseBackgroundRenderContribution {
|
|
|
10177
10249
|
let w = targetW,
|
|
10178
10250
|
h = targetH;
|
|
10179
10251
|
if ("no-repeat" === backgroundMode) {
|
|
10180
|
-
if (backgroundFit)
|
|
10252
|
+
if (backgroundFit) {
|
|
10253
|
+
if (backgroundKeepAspectRatio) {
|
|
10254
|
+
const maxScale = Math.max(targetW / data.width, targetH / data.height);
|
|
10255
|
+
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
|
|
10256
|
+
} else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
|
|
10257
|
+
} else {
|
|
10181
10258
|
const resW = data.width * backgroundScale,
|
|
10182
10259
|
resH = data.height * backgroundScale;
|
|
10183
10260
|
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
|
|
@@ -10248,7 +10325,7 @@ function drawWave(ctx, ratio, boundsWidth, boundsHeight, textureOptions, offsetX
|
|
|
10248
10325
|
}
|
|
10249
10326
|
class DefaultBaseTextureRenderContribution {
|
|
10250
10327
|
constructor() {
|
|
10251
|
-
this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 10;
|
|
10328
|
+
this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 10, this._tempSymbolGraphic = null;
|
|
10252
10329
|
}
|
|
10253
10330
|
createCommonPattern(size, padding, color, targetContext, cb) {
|
|
10254
10331
|
const r = (size - 2 * padding) / 2,
|
|
@@ -10362,7 +10439,35 @@ class DefaultBaseTextureRenderContribution {
|
|
|
10362
10439
|
case "grid":
|
|
10363
10440
|
pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
|
|
10364
10441
|
}
|
|
10365
|
-
if (
|
|
10442
|
+
if (textureOptions && textureOptions.dynamicTexture) {
|
|
10443
|
+
context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
|
|
10444
|
+
const {
|
|
10445
|
+
gridConfig = {}
|
|
10446
|
+
} = textureOptions,
|
|
10447
|
+
b = graphic.AABBBounds,
|
|
10448
|
+
width = b.width(),
|
|
10449
|
+
height = b.height(),
|
|
10450
|
+
padding = texturePadding,
|
|
10451
|
+
cellSize = textureSize,
|
|
10452
|
+
gridColumns = gridConfig.columns ? gridConfig.columns : Math.ceil(width / cellSize),
|
|
10453
|
+
gridRows = gridConfig.rows ? gridConfig.rows : Math.ceil(height / cellSize),
|
|
10454
|
+
gutterColumn = gridConfig.gutterColumn ? gridConfig.gutterColumn : 2 * padding,
|
|
10455
|
+
gutterRow = gridConfig.gutterRow ? gridConfig.gutterRow : 2 * padding;
|
|
10456
|
+
this._tempSymbolGraphic || (this._tempSymbolGraphic = createSymbol({}));
|
|
10457
|
+
const sizeW = gridConfig.columns ? width / gridConfig.columns : cellSize,
|
|
10458
|
+
sizeH = gridConfig.rows ? height / gridConfig.rows : cellSize;
|
|
10459
|
+
this._tempSymbolGraphic.setAttributes({
|
|
10460
|
+
size: [sizeW - gutterColumn, sizeH - gutterRow],
|
|
10461
|
+
symbolType: texture
|
|
10462
|
+
});
|
|
10463
|
+
const parsedPath = this._tempSymbolGraphic.getParsedPath();
|
|
10464
|
+
for (let i = 0; i < gridRows; i++) for (let j = 0; j < gridColumns; j++) {
|
|
10465
|
+
const _x = x + cellSize / 2 + j * cellSize,
|
|
10466
|
+
_y = y + cellSize / 2 + i * cellSize;
|
|
10467
|
+
context.beginPath(), !1 === parsedPath.draw(context, Math.min(sizeW - gutterColumn, sizeH - gutterRow), _x, _y, 0) && context.closePath(), context.fillStyle = textureColor, textureOptions.dynamicTexture(context, i, j, gridRows, gridColumns, textureRatio, graphic);
|
|
10468
|
+
}
|
|
10469
|
+
context.restore();
|
|
10470
|
+
} else if (pattern) context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();else if ("wave" === texture) {
|
|
10366
10471
|
context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
|
|
10367
10472
|
const b = graphic.AABBBounds;
|
|
10368
10473
|
drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
|
|
@@ -10483,6 +10588,7 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
|
|
|
10483
10588
|
background: background,
|
|
10484
10589
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
10485
10590
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
10591
|
+
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
10486
10592
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
10487
10593
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
10488
10594
|
backgroundOffsetY = graphicAttribute.backgroundOffsetY
|
|
@@ -10495,6 +10601,7 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
|
|
|
10495
10601
|
this.doDrawImage(context, res.data, b, {
|
|
10496
10602
|
backgroundMode: backgroundMode,
|
|
10497
10603
|
backgroundFit: backgroundFit,
|
|
10604
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
10498
10605
|
backgroundScale: backgroundScale,
|
|
10499
10606
|
backgroundOffsetX: backgroundOffsetX,
|
|
10500
10607
|
backgroundOffsetY: backgroundOffsetY
|
|
@@ -10676,8 +10783,8 @@ class DefaultImageRenderContribution extends DefaultRectRenderContribution {
|
|
|
10676
10783
|
constructor() {
|
|
10677
10784
|
super(...arguments), this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
10678
10785
|
}
|
|
10679
|
-
drawShape(
|
|
10680
|
-
return super.drawShape(
|
|
10786
|
+
drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
|
|
10787
|
+
return super.drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
|
|
10681
10788
|
}
|
|
10682
10789
|
}
|
|
10683
10790
|
const defaultImageRenderContribution = new DefaultImageRenderContribution();
|
|
@@ -11140,7 +11247,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
11140
11247
|
this._draw(line, lineAttribute, !1, drawContext, params);
|
|
11141
11248
|
}
|
|
11142
11249
|
drawSegmentItem(context, cache, fill, stroke, fillOpacity, strokeOpacity, attribute, defaultAttribute, clipRange, clipRangeByDimension, offsetX, offsetY, line, fillCb, strokeCb) {
|
|
11143
|
-
var _a
|
|
11250
|
+
var _a;
|
|
11144
11251
|
if (!cache) return;
|
|
11145
11252
|
context.beginPath();
|
|
11146
11253
|
const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
|
|
@@ -11153,27 +11260,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
11153
11260
|
x: originX = 0,
|
|
11154
11261
|
x: originY = 0
|
|
11155
11262
|
} = attribute;
|
|
11156
|
-
!1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke()));
|
|
11157
|
-
let {
|
|
11158
|
-
connectedType: connectedType,
|
|
11159
|
-
connectedX: connectedX,
|
|
11160
|
-
connectedY: connectedY,
|
|
11161
|
-
connectedStyle: connectedStyle
|
|
11162
|
-
} = attribute;
|
|
11163
|
-
if (isArray(defaultAttribute) ? (connectedType = null !== (_b = null != connectedType ? connectedType : defaultAttribute[0].connectedType) && void 0 !== _b ? _b : defaultAttribute[1].connectedType, connectedX = null !== (_c = null != connectedX ? connectedX : defaultAttribute[0].connectedX) && void 0 !== _c ? _c : defaultAttribute[1].connectedX, connectedY = null !== (_d = null != connectedY ? connectedY : defaultAttribute[0].connectedY) && void 0 !== _d ? _d : defaultAttribute[1].connectedY, connectedStyle = null !== (_e = null != connectedStyle ? connectedStyle : defaultAttribute[0].connectedStyle) && void 0 !== _e ? _e : defaultAttribute[1].connectedStyle) : (connectedType = null != connectedType ? connectedType : defaultAttribute.connectedType, connectedX = null != connectedX ? connectedX : defaultAttribute.connectedX, connectedY = null != connectedY ? connectedY : defaultAttribute.connectedY, connectedStyle = null != connectedStyle ? connectedStyle : defaultAttribute.connectedStyle), "connect" !== connectedType && "zero" !== connectedType && (connectedType = "none"), "none" !== connectedType) {
|
|
11164
|
-
context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, cache, clipRange, clipRangeByDimension, {
|
|
11165
|
-
offsetX: offsetX,
|
|
11166
|
-
offsetY: offsetY,
|
|
11167
|
-
offsetZ: z,
|
|
11168
|
-
drawConnect: !0,
|
|
11169
|
-
mode: connectedType,
|
|
11170
|
-
zeroX: connectedX,
|
|
11171
|
-
zeroY: connectedY
|
|
11172
|
-
});
|
|
11173
|
-
const da = [];
|
|
11174
|
-
isArray(defaultAttribute) ? defaultAttribute.forEach(i => da.push(i)) : da.push(defaultAttribute), da.push(attribute), !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da), context.stroke()));
|
|
11175
|
-
}
|
|
11176
|
-
return !1;
|
|
11263
|
+
return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke())), !1;
|
|
11177
11264
|
}
|
|
11178
11265
|
drawLinearLineHighPerformance(line, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, lineAttribute, drawContext, params, fillCb, strokeCb) {
|
|
11179
11266
|
var _a;
|
|
@@ -11205,7 +11292,8 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
11205
11292
|
segments: segments,
|
|
11206
11293
|
points: points,
|
|
11207
11294
|
closePath: closePath,
|
|
11208
|
-
curveTension = lineAttribute.curveTension
|
|
11295
|
+
curveTension = lineAttribute.curveTension,
|
|
11296
|
+
connectedType = lineAttribute.connectedType
|
|
11209
11297
|
} = line.attribute;
|
|
11210
11298
|
if (!this.valid(line, lineAttribute, fillCb, strokeCb)) return;
|
|
11211
11299
|
let {
|
|
@@ -11217,6 +11305,9 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
11217
11305
|
clipRangeByDimension = lineAttribute.clipRangeByDimension
|
|
11218
11306
|
} = line.attribute;
|
|
11219
11307
|
if (1 === clipRange && !segments && !points.some(p => !1 === p.defined) && "linear" === curveType) return this.drawLinearLineHighPerformance(line, context, !!fill, !!stroke, fillOpacity, strokeOpacity, x, y, lineAttribute, drawContext, params, fillCb, strokeCb);
|
|
11308
|
+
function parsePoint(points, connectedType) {
|
|
11309
|
+
return "none" === connectedType ? points : points.filter(p => !1 !== p.defined);
|
|
11310
|
+
}
|
|
11220
11311
|
if (line.shouldUpdateShape()) {
|
|
11221
11312
|
const {
|
|
11222
11313
|
points: points,
|
|
@@ -11238,7 +11329,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
11238
11329
|
y: lastSeg.endY,
|
|
11239
11330
|
defined: lastSeg.curves[lastSeg.curves.length - 1].defined
|
|
11240
11331
|
} : index > 1 && (startPoint.x = lastSeg.endX, startPoint.y = lastSeg.endY, startPoint.defined = lastSeg.curves[lastSeg.curves.length - 1].defined);
|
|
11241
|
-
const data = calcLineCache(seg.points, curveType, {
|
|
11332
|
+
const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
|
|
11242
11333
|
startPoint: startPoint,
|
|
11243
11334
|
curveTension: curveTension
|
|
11244
11335
|
});
|
|
@@ -11257,7 +11348,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
11257
11348
|
}
|
|
11258
11349
|
} else {
|
|
11259
11350
|
if (!points || !points.length) return line.cache = null, void line.clearUpdateShapeTag();
|
|
11260
|
-
line.cache = calcLineCache(_points, curveType, {
|
|
11351
|
+
line.cache = calcLineCache(parsePoint(_points, connectedType), curveType, {
|
|
11261
11352
|
curveTension: curveTension
|
|
11262
11353
|
});
|
|
11263
11354
|
}
|
|
@@ -11289,11 +11380,6 @@ DefaultCanvasLineRender = __decorate$E([injectable()], DefaultCanvasLineRender);
|
|
|
11289
11380
|
|
|
11290
11381
|
function drawAreaSegments(path, segPath, percent, params) {
|
|
11291
11382
|
var _a;
|
|
11292
|
-
const {
|
|
11293
|
-
drawConnect = !1,
|
|
11294
|
-
mode = "none"
|
|
11295
|
-
} = params || {};
|
|
11296
|
-
if (drawConnect && "none" === mode) return;
|
|
11297
11383
|
const {
|
|
11298
11384
|
top: top,
|
|
11299
11385
|
bottom: bottom
|
|
@@ -11303,34 +11389,11 @@ function drawAreaSegments(path, segPath, percent, params) {
|
|
|
11303
11389
|
const topList = [],
|
|
11304
11390
|
bottomList = [];
|
|
11305
11391
|
let lastDefined = !0;
|
|
11306
|
-
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
defined0 = !0;
|
|
11310
|
-
const n = top.curves.length;
|
|
11311
|
-
top.curves.forEach((curve, i) => {
|
|
11312
|
-
const bototmCurve = bottom.curves[n - i - 1];
|
|
11313
|
-
let currentTopCurve = curve,
|
|
11314
|
-
currentBottomCurve = bototmCurve;
|
|
11315
|
-
if (curve.originP1 === curve.originP2) return lastCurve = curve, void (lastBottomCurve = bototmCurve);
|
|
11316
|
-
if (lastCurve && lastCurve.originP1 === lastCurve.originP2 && (currentTopCurve = lastCurve, currentBottomCurve = lastBottomCurve), curve.defined) defined0 || (topList.push(currentTopCurve), bottomList.push(currentBottomCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0, defined0 = !defined0);else {
|
|
11317
|
-
const {
|
|
11318
|
-
originP1: originP1,
|
|
11319
|
-
originP2: originP2
|
|
11320
|
-
} = curve;
|
|
11321
|
-
let validTopCurve, validBottomCurve;
|
|
11322
|
-
originP1 && !1 !== originP1.defined ? (validTopCurve = currentTopCurve, validBottomCurve = currentBottomCurve) : originP1 && !1 !== originP2.defined && (validTopCurve = curve, validBottomCurve = bototmCurve), defined0 ? (defined0 = !defined0, topList.push(validTopCurve || curve), bottomList.push(validBottomCurve || bototmCurve)) : validTopCurve && (defined0 = !defined0, topList.push(validTopCurve || curve), bottomList.push(validBottomCurve || bototmCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0);
|
|
11323
|
-
}
|
|
11324
|
-
lastCurve = curve;
|
|
11325
|
-
}), drawAreaConnectBlock(path, topList, bottomList, params);
|
|
11326
|
-
} else {
|
|
11327
|
-
for (let i = 0, n = top.curves.length; i < n; i++) {
|
|
11328
|
-
const topCurve = top.curves[i];
|
|
11329
|
-
lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1])), lastDefined = !lastDefined) : lastDefined && (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1]));
|
|
11330
|
-
}
|
|
11331
|
-
drawAreaBlock(path, topList, bottomList, params);
|
|
11392
|
+
for (let i = 0, n = top.curves.length; i < n; i++) {
|
|
11393
|
+
const topCurve = top.curves[i];
|
|
11394
|
+
lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1])), lastDefined = !lastDefined) : lastDefined && (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1]));
|
|
11332
11395
|
}
|
|
11333
|
-
return;
|
|
11396
|
+
return void drawAreaBlock(path, topList, bottomList, params);
|
|
11334
11397
|
}
|
|
11335
11398
|
if (percent <= 0) return;
|
|
11336
11399
|
let {
|
|
@@ -11348,51 +11411,17 @@ function drawAreaSegments(path, segPath, percent, params) {
|
|
|
11348
11411
|
lastDefined = !0;
|
|
11349
11412
|
const topList = [],
|
|
11350
11413
|
bottomList = [];
|
|
11351
|
-
let lastTopCurve,
|
|
11352
|
-
lastBottomCurve,
|
|
11353
|
-
defined0 = !0;
|
|
11354
11414
|
for (let i = 0, n = top.curves.length; i < n; i++) {
|
|
11355
11415
|
const topCurve = top.curves[i],
|
|
11356
11416
|
curCurveLength = topCurve.getLength(direction),
|
|
11357
11417
|
percent = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;
|
|
11358
11418
|
if (percent < 0) break;
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
|
|
11362
|
-
|
|
11363
|
-
if (topCurve.originP1 === topCurve.originP2) {
|
|
11364
|
-
lastTopCurve = topCurve, lastBottomCurve = bototmCurve;
|
|
11365
|
-
continue;
|
|
11366
|
-
}
|
|
11367
|
-
if (lastTopCurve && lastTopCurve.originP1 === lastTopCurve.originP2 && (currentTopCurve = lastTopCurve, currentBottomCurve = lastBottomCurve), topCurve.defined) defined0 || (topList.push(currentTopCurve), bottomList.push(currentBottomCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0, defined0 = !defined0);else {
|
|
11368
|
-
const {
|
|
11369
|
-
originP1: originP1,
|
|
11370
|
-
originP2: originP2
|
|
11371
|
-
} = topCurve;
|
|
11372
|
-
let validTopCurve, validBottomCurve;
|
|
11373
|
-
originP1 && !1 !== originP1.defined ? (validTopCurve = currentTopCurve, validBottomCurve = currentBottomCurve) : originP1 && !1 !== originP2.defined && (validTopCurve = topCurve, validBottomCurve = bototmCurve), defined0 ? (defined0 = !defined0, topList.push(validTopCurve || topCurve), bottomList.push(validBottomCurve || bototmCurve)) : validTopCurve && (defined0 = !defined0, topList.push(validTopCurve || topCurve), bottomList.push(validBottomCurve || bototmCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0);
|
|
11374
|
-
}
|
|
11375
|
-
lastTopCurve = topCurve;
|
|
11376
|
-
} else {
|
|
11377
|
-
let tc = null,
|
|
11378
|
-
bc = null;
|
|
11379
|
-
lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (tc = topCurve, bc = bottom.curves[n - i - 1]), lastDefined = !lastDefined) : lastDefined && (tc = topCurve, bc = bottom.curves[n - i - 1]), tc && bc && (percent < 1 && (tc = tc.p2 && tc.p3 ? divideCubic(tc, percent)[0] : divideLinear(tc, percent)[0], bc = bc.p2 && bc.p3 ? divideCubic(bc, 1 - percent)[1] : divideLinear(bc, 1 - percent)[1]), tc.defined = lastDefined, bc.defined = lastDefined, topList.push(tc), bottomList.push(bc)), tc = null, bc = null;
|
|
11380
|
-
}
|
|
11419
|
+
drawedLengthUntilLast += curCurveLength;
|
|
11420
|
+
let tc = null,
|
|
11421
|
+
bc = null;
|
|
11422
|
+
lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (tc = topCurve, bc = bottom.curves[n - i - 1]), lastDefined = !lastDefined) : lastDefined && (tc = topCurve, bc = bottom.curves[n - i - 1]), tc && bc && (percent < 1 && (tc = tc.p2 && tc.p3 ? divideCubic(tc, percent)[0] : divideLinear(tc, percent)[0], bc = bc.p2 && bc.p3 ? divideCubic(bc, 1 - percent)[1] : divideLinear(bc, 1 - percent)[1]), tc.defined = lastDefined, bc.defined = lastDefined, topList.push(tc), bottomList.push(bc)), tc = null, bc = null;
|
|
11381
11423
|
}
|
|
11382
|
-
|
|
11383
|
-
}
|
|
11384
|
-
function drawAreaConnectBlock(path, topList, bottomList, params) {
|
|
11385
|
-
if (topList.length < 2) return;
|
|
11386
|
-
const {
|
|
11387
|
-
offsetX = 0,
|
|
11388
|
-
offsetY = 0,
|
|
11389
|
-
offsetZ = 0,
|
|
11390
|
-
mode: mode
|
|
11391
|
-
} = params || {};
|
|
11392
|
-
let curve = topList[0];
|
|
11393
|
-
path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), curve = topList[topList.length - 1];
|
|
11394
|
-
let end = curve.p3 || curve.p1;
|
|
11395
|
-
path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ), curve = bottomList[bottomList.length - 1], path.lineTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), curve = bottomList[0], end = curve.p3 || curve.p1, path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ), path.closePath();
|
|
11424
|
+
drawAreaBlock(path, topList, bottomList, params);
|
|
11396
11425
|
}
|
|
11397
11426
|
function drawAreaBlock(path, topList, bottomList, params) {
|
|
11398
11427
|
const {
|
|
@@ -11493,7 +11522,8 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11493
11522
|
fillOpacity = areaAttribute.fillOpacity,
|
|
11494
11523
|
z = areaAttribute.z,
|
|
11495
11524
|
strokeOpacity = areaAttribute.strokeOpacity,
|
|
11496
|
-
curveTension = areaAttribute.curveTension
|
|
11525
|
+
curveTension = areaAttribute.curveTension,
|
|
11526
|
+
connectedType = areaAttribute.connectedType
|
|
11497
11527
|
} = area.attribute,
|
|
11498
11528
|
data = this.valid(area, areaAttribute, fillCb, strokeCb);
|
|
11499
11529
|
if (!data) return;
|
|
@@ -11510,6 +11540,9 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11510
11540
|
let {
|
|
11511
11541
|
curveType = areaAttribute.curveType
|
|
11512
11542
|
} = area.attribute;
|
|
11543
|
+
function parsePoint(points, connectedType) {
|
|
11544
|
+
return "connect" !== connectedType ? points : points.filter(p => !1 !== p.defined);
|
|
11545
|
+
}
|
|
11513
11546
|
if (closePath && "linear" === curveType && (curveType = "linearClosed"), 1 === clipRange && !segments && !points.some(p => !1 === p.defined) && "linear" === curveType) return this.drawLinearAreaHighPerformance(area, context, !!fill, doStroke, fillOpacity, strokeOpacity, x, y, areaAttribute, drawContext, params, fillCb, strokeCb);
|
|
11514
11547
|
if (area.shouldUpdateShape()) {
|
|
11515
11548
|
if (segments && segments.length) {
|
|
@@ -11523,7 +11556,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11523
11556
|
x: lastTopSeg.endX,
|
|
11524
11557
|
y: lastTopSeg.endY
|
|
11525
11558
|
} : index > 1 && (startPoint.x = lastTopSeg.endX, startPoint.y = lastTopSeg.endY);
|
|
11526
|
-
const data = calcLineCache(seg.points, curveType, {
|
|
11559
|
+
const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
|
|
11527
11560
|
startPoint: startPoint,
|
|
11528
11561
|
curveTension: curveTension
|
|
11529
11562
|
});
|
|
@@ -11546,7 +11579,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11546
11579
|
y: null !== (_d = endPoint.y1) && void 0 !== _d ? _d : endPoint.y
|
|
11547
11580
|
});
|
|
11548
11581
|
}
|
|
11549
|
-
bottomPoints.length > 1 && (lastBottomSeg = calcLineCache(bottomPoints, "stepBefore" === curveType ? "stepAfter" : "stepAfter" === curveType ? "stepBefore" : curveType, {
|
|
11582
|
+
bottomPoints.length > 1 && (lastBottomSeg = calcLineCache(parsePoint(bottomPoints, connectedType), "stepBefore" === curveType ? "stepAfter" : "stepAfter" === curveType ? "stepBefore" : curveType, {
|
|
11550
11583
|
curveTension: curveTension
|
|
11551
11584
|
}), bottomCaches.unshift(lastBottomSeg));
|
|
11552
11585
|
}
|
|
@@ -11557,11 +11590,11 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11557
11590
|
} else {
|
|
11558
11591
|
if (!points || !points.length) return area.cacheArea = null, void area.clearUpdateShapeTag();
|
|
11559
11592
|
{
|
|
11560
|
-
const topPoints = points,
|
|
11593
|
+
const topPoints = parsePoint(points, connectedType),
|
|
11561
11594
|
bottomPoints = [];
|
|
11562
|
-
for (let i =
|
|
11563
|
-
x: null !== (_e =
|
|
11564
|
-
y: null !== (_f =
|
|
11595
|
+
for (let i = topPoints.length - 1; i >= 0; i--) bottomPoints.push({
|
|
11596
|
+
x: null !== (_e = topPoints[i].x1) && void 0 !== _e ? _e : topPoints[i].x,
|
|
11597
|
+
y: null !== (_f = topPoints[i].y1) && void 0 !== _f ? _f : topPoints[i].y
|
|
11565
11598
|
});
|
|
11566
11599
|
const topCache = calcLineCache(topPoints, curveType, {
|
|
11567
11600
|
curveTension: curveTension
|
|
@@ -11603,20 +11636,10 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11603
11636
|
this._draw(area, areaAttribute, !1, drawContext, params);
|
|
11604
11637
|
}
|
|
11605
11638
|
drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
|
|
11606
|
-
|
|
11607
|
-
return ret = ret || this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, !1, fillCb, strokeCb), ret = ret || this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, !0, fillCb, strokeCb), ret;
|
|
11639
|
+
return this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb);
|
|
11608
11640
|
}
|
|
11609
|
-
_drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext,
|
|
11610
|
-
var _a, _b, _c, _d;
|
|
11641
|
+
_drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
|
|
11611
11642
|
if (!(cache && cache.top && cache.bottom && cache.top.curves && cache.top.curves.length && cache.bottom.curves && cache.bottom.curves.length)) return;
|
|
11612
|
-
let {
|
|
11613
|
-
connectedType: connectedType,
|
|
11614
|
-
connectedX: connectedX,
|
|
11615
|
-
connectedY: connectedY,
|
|
11616
|
-
connectedStyle: connectedStyle
|
|
11617
|
-
} = attribute;
|
|
11618
|
-
const da = [];
|
|
11619
|
-
if (connect && (isArray(defaultAttribute) ? (connectedType = null !== (_a = null != connectedType ? connectedType : defaultAttribute[0].connectedType) && void 0 !== _a ? _a : defaultAttribute[1].connectedType, connectedX = null !== (_b = null != connectedX ? connectedX : defaultAttribute[0].connectedX) && void 0 !== _b ? _b : defaultAttribute[1].connectedX, connectedY = null !== (_c = null != connectedY ? connectedY : defaultAttribute[0].connectedY) && void 0 !== _c ? _c : defaultAttribute[1].connectedY, connectedStyle = null !== (_d = null != connectedStyle ? connectedStyle : defaultAttribute[0].connectedStyle) && void 0 !== _d ? _d : defaultAttribute[1].connectedStyle) : (connectedType = null != connectedType ? connectedType : defaultAttribute.connectedType, connectedX = null != connectedX ? connectedX : defaultAttribute.connectedX, connectedY = null != connectedY ? connectedY : defaultAttribute.connectedY, connectedStyle = null != connectedStyle ? connectedStyle : defaultAttribute.connectedStyle), "connect" !== connectedType && "zero" !== connectedType && (connectedType = "none"), isArray(defaultAttribute) ? defaultAttribute.forEach(i => da.push(i)) : da.push(defaultAttribute), da.push(attribute)), connect && "none" === connectedType) return !1;
|
|
11620
11643
|
context.beginPath();
|
|
11621
11644
|
const {
|
|
11622
11645
|
points: points,
|
|
@@ -11635,11 +11658,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11635
11658
|
offsetX: offsetX,
|
|
11636
11659
|
offsetY: offsetY,
|
|
11637
11660
|
offsetZ: offsetZ,
|
|
11638
|
-
direction: direction
|
|
11639
|
-
drawConnect: connect,
|
|
11640
|
-
mode: connectedType,
|
|
11641
|
-
zeroX: connectedX,
|
|
11642
|
-
zeroY: connectedY
|
|
11661
|
+
direction: direction
|
|
11643
11662
|
}), this.beforeRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
|
|
11644
11663
|
attribute: attribute
|
|
11645
11664
|
}), context.setShadowBlendStyle && context.setShadowBlendStyle(area, attribute, defaultAttribute);
|
|
@@ -11647,7 +11666,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11647
11666
|
x: originX = 0,
|
|
11648
11667
|
x: originY = 0
|
|
11649
11668
|
} = attribute;
|
|
11650
|
-
return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area,
|
|
11669
|
+
return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
|
|
11651
11670
|
attribute: attribute
|
|
11652
11671
|
}), (() => {
|
|
11653
11672
|
if (!1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
|
|
@@ -11657,12 +11676,8 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11657
11676
|
isArray(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === Direction$1.ROW ? "x" : "y", {
|
|
11658
11677
|
offsetX: offsetX,
|
|
11659
11678
|
offsetY: offsetY,
|
|
11660
|
-
offsetZ: offsetZ
|
|
11661
|
-
|
|
11662
|
-
mode: connectedType,
|
|
11663
|
-
zeroX: connectedX,
|
|
11664
|
-
zeroY: connectedY
|
|
11665
|
-
})), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
|
|
11679
|
+
offsetZ: offsetZ
|
|
11680
|
+
})), context.setStrokeStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke();
|
|
11666
11681
|
}
|
|
11667
11682
|
})(), !1;
|
|
11668
11683
|
}
|
|
@@ -11918,7 +11933,8 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
|
|
|
11918
11933
|
var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
11919
11934
|
const {
|
|
11920
11935
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
11921
|
-
backgroundFit = graphicAttribute.backgroundFit
|
|
11936
|
+
backgroundFit = graphicAttribute.backgroundFit,
|
|
11937
|
+
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
|
|
11922
11938
|
} = graphic.attribute;
|
|
11923
11939
|
let matrix,
|
|
11924
11940
|
{
|
|
@@ -11957,7 +11973,8 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
|
|
|
11957
11973
|
if ("success" !== res.state || !res.data) return void restore();
|
|
11958
11974
|
context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, {
|
|
11959
11975
|
backgroundMode: backgroundMode,
|
|
11960
|
-
backgroundFit: backgroundFit
|
|
11976
|
+
backgroundFit: backgroundFit,
|
|
11977
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
11961
11978
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
11962
11979
|
} else {
|
|
11963
11980
|
const {
|
|
@@ -13074,7 +13091,7 @@ var __decorate$q = undefined && undefined.__decorate || function (decorators, ta
|
|
|
13074
13091
|
};
|
|
13075
13092
|
let DefaultDrawContribution = class {
|
|
13076
13093
|
constructor(contributions, drawItemInterceptorContributions) {
|
|
13077
|
-
this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this.currentRenderMap = new Map(), this.defaultRenderMap = new Map(), this.styleRenderMap = new Map(), this.dirtyBounds = new Bounds(), this.backupDirtyBounds = new Bounds(), this.global = application.global, this.layerService = application.layerService, this.init();
|
|
13094
|
+
this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this.currentRenderMap = new Map(), this.defaultRenderMap = new Map(), this.styleRenderMap = new Map(), this.dirtyBounds = new Bounds(), this.backupDirtyBounds = new Bounds(), this.global = application.global, this.layerService = application.layerService, isArray(this.contributions) || (this.contributions = [this.contributions]), this.init();
|
|
13078
13095
|
}
|
|
13079
13096
|
init() {
|
|
13080
13097
|
this.contributions.forEach(item => {
|
|
@@ -13877,6 +13894,7 @@ class PickerBase {
|
|
|
13877
13894
|
contains(graphic, point, params) {
|
|
13878
13895
|
if (!graphic.AABBBounds.containsPoint(point)) return !1;
|
|
13879
13896
|
if ("imprecise" === graphic.attribute.pickMode) return !0;
|
|
13897
|
+
if (!this.canvasRenderer) return !0;
|
|
13880
13898
|
const {
|
|
13881
13899
|
pickContext: pickContext
|
|
13882
13900
|
} = null != params ? params : {};
|
|
@@ -14764,7 +14782,9 @@ const DEFAULT_HTML_TEXT_SPEC = {
|
|
|
14764
14782
|
height: 30,
|
|
14765
14783
|
style: {}
|
|
14766
14784
|
};
|
|
14785
|
+
const SCROLLBAR_START_EVENT = 'scrollDown';
|
|
14767
14786
|
const SCROLLBAR_EVENT = 'scrollDrag';
|
|
14787
|
+
const SCROLLBAR_END_EVENT = 'scrollUp';
|
|
14768
14788
|
|
|
14769
14789
|
const delayMap$2 = {
|
|
14770
14790
|
debounce: debounce,
|
|
@@ -14806,7 +14826,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
14806
14826
|
const { direction } = this.attribute;
|
|
14807
14827
|
const { x, y } = this.stage.eventPointTransform(e);
|
|
14808
14828
|
this._prePos = direction === 'horizontal' ? x : y;
|
|
14809
|
-
this._dispatchEvent(
|
|
14829
|
+
this._dispatchEvent(SCROLLBAR_START_EVENT, {
|
|
14810
14830
|
pos: this._prePos,
|
|
14811
14831
|
event: e
|
|
14812
14832
|
});
|
|
@@ -14854,11 +14874,11 @@ class ScrollBar extends AbstractComponent {
|
|
|
14854
14874
|
: delayMap$2[this.attribute.delayType](this._onSliderPointerMove, this.attribute.delayTime);
|
|
14855
14875
|
this._onSliderPointerUp = (e) => {
|
|
14856
14876
|
e.preventDefault();
|
|
14857
|
-
const {
|
|
14877
|
+
const { range: preRange, limitRange = [0, 1] } = this.attribute;
|
|
14858
14878
|
const preScrollRange = this.getScrollRange();
|
|
14859
14879
|
const [currentPos, currentScrollValue] = this._computeScrollValue(e);
|
|
14860
14880
|
const range = [preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue];
|
|
14861
|
-
this._dispatchEvent(
|
|
14881
|
+
this._dispatchEvent(SCROLLBAR_END_EVENT, {
|
|
14862
14882
|
pre: preRange,
|
|
14863
14883
|
value: clampRange(range, limitRange[0], limitRange[1])
|
|
14864
14884
|
});
|
|
@@ -20581,15 +20601,19 @@ class LabelBase extends AbstractComponent {
|
|
|
20581
20601
|
if (isFunction(dataFilter)) {
|
|
20582
20602
|
data = dataFilter(data);
|
|
20583
20603
|
}
|
|
20604
|
+
if (data && data.length) {
|
|
20605
|
+
const seenIds = new Set();
|
|
20606
|
+
data = data.filter(d => !seenIds.has(d.id) && seenIds.add(d.id));
|
|
20607
|
+
}
|
|
20584
20608
|
let labels = this._initText(data);
|
|
20585
20609
|
if (isFunction(customLayoutFunc)) {
|
|
20586
|
-
labels = customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null);
|
|
20610
|
+
labels = customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null, this);
|
|
20587
20611
|
}
|
|
20588
20612
|
else {
|
|
20589
20613
|
labels = this._layout(labels);
|
|
20590
20614
|
}
|
|
20591
20615
|
if (isFunction(customOverlapFunc)) {
|
|
20592
|
-
labels = customOverlapFunc(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null);
|
|
20616
|
+
labels = customOverlapFunc(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null, this);
|
|
20593
20617
|
}
|
|
20594
20618
|
else {
|
|
20595
20619
|
if (overlap !== false) {
|
|
@@ -20597,7 +20621,7 @@ class LabelBase extends AbstractComponent {
|
|
|
20597
20621
|
}
|
|
20598
20622
|
}
|
|
20599
20623
|
if (isFunction(this.attribute.onAfterOverlapping)) {
|
|
20600
|
-
this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null);
|
|
20624
|
+
this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null, this);
|
|
20601
20625
|
}
|
|
20602
20626
|
if (labels && labels.length) {
|
|
20603
20627
|
labels.forEach(label => {
|
|
@@ -22915,14 +22939,11 @@ class DataZoom extends AbstractComponent {
|
|
|
22915
22939
|
}
|
|
22916
22940
|
this._activeState = false;
|
|
22917
22941
|
brushSelect && this.renderDragMask();
|
|
22918
|
-
|
|
22919
|
-
|
|
22920
|
-
this.
|
|
22921
|
-
|
|
22922
|
-
|
|
22923
|
-
tag: this._activeTag
|
|
22924
|
-
});
|
|
22925
|
-
}
|
|
22942
|
+
this._dispatchEvent('change', {
|
|
22943
|
+
start: this.state.start,
|
|
22944
|
+
end: this.state.end,
|
|
22945
|
+
tag: this._activeTag
|
|
22946
|
+
});
|
|
22926
22947
|
if (vglobal.env === 'browser') {
|
|
22927
22948
|
vglobal.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
22928
22949
|
vglobal.removeEventListener('pointerup', this._onHandlerPointerUp);
|
|
@@ -23006,7 +23027,8 @@ class DataZoom extends AbstractComponent {
|
|
|
23006
23027
|
shouldRender && this.setAttributes({ start, end });
|
|
23007
23028
|
}
|
|
23008
23029
|
eventPosToStagePos(e) {
|
|
23009
|
-
|
|
23030
|
+
var _a, _b;
|
|
23031
|
+
return (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventPointTransform(e)) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
|
|
23010
23032
|
}
|
|
23011
23033
|
_onHandlerPointerEnter(e) {
|
|
23012
23034
|
e.stopPropagation();
|
|
@@ -24699,34 +24721,23 @@ class MarkArea extends Marker {
|
|
|
24699
24721
|
}
|
|
24700
24722
|
getPointAttrByPosition(position) {
|
|
24701
24723
|
const { x1, x2, y1, y2 } = this._area.AABBBounds;
|
|
24724
|
+
const result = {
|
|
24725
|
+
x: (x1 + x2) / 2,
|
|
24726
|
+
y: (y1 + y2) / 2
|
|
24727
|
+
};
|
|
24702
24728
|
if (position.includes('left') || position.includes('Left')) {
|
|
24703
|
-
|
|
24704
|
-
x: x1,
|
|
24705
|
-
y: (y1 + y2) / 2
|
|
24706
|
-
};
|
|
24729
|
+
result.x = x1;
|
|
24707
24730
|
}
|
|
24708
24731
|
if (position.includes('right') || position.includes('Right')) {
|
|
24709
|
-
|
|
24710
|
-
x: x2,
|
|
24711
|
-
y: (y1 + y2) / 2
|
|
24712
|
-
};
|
|
24732
|
+
result.x = x2;
|
|
24713
24733
|
}
|
|
24714
24734
|
if (position.includes('top') || position.includes('Top')) {
|
|
24715
|
-
|
|
24716
|
-
x: (x1 + x2) / 2,
|
|
24717
|
-
y: y1
|
|
24718
|
-
};
|
|
24735
|
+
result.y = y1;
|
|
24719
24736
|
}
|
|
24720
24737
|
if (position.includes('bottom') || position.includes('Bottom')) {
|
|
24721
|
-
|
|
24722
|
-
x: (x1 + x2) / 2,
|
|
24723
|
-
y: y2
|
|
24724
|
-
};
|
|
24738
|
+
result.y = y2;
|
|
24725
24739
|
}
|
|
24726
|
-
return
|
|
24727
|
-
x: (x1 + x2) / 2,
|
|
24728
|
-
y: (y1 + y2) / 2
|
|
24729
|
-
};
|
|
24740
|
+
return result;
|
|
24730
24741
|
}
|
|
24731
24742
|
setLabelPos() {
|
|
24732
24743
|
var _a;
|
|
@@ -28156,35 +28167,36 @@ class Title extends AbstractComponent {
|
|
|
28156
28167
|
this.name = 'title';
|
|
28157
28168
|
}
|
|
28158
28169
|
render() {
|
|
28159
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
28170
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
28160
28171
|
const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute;
|
|
28161
28172
|
const parsedPadding = normalizePadding(padding);
|
|
28162
28173
|
const group = this.createOrUpdateChild('title-container', { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 }, 'group');
|
|
28174
|
+
const fixedMainTitleHeight = (_a = textStyle.height) !== null && _a !== void 0 ? _a : height;
|
|
28163
28175
|
if (this.attribute.visible !== false && textStyle.visible !== false) {
|
|
28164
|
-
const { width: mainTitleWidth,
|
|
28176
|
+
const { width: mainTitleWidth, maxHeight: mainTitleMaxHeight, maxWidth: mainTitleMaxWidth, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', maxWidth, lineClamp } = textStyle;
|
|
28165
28177
|
if (textType === 'rich' || isValid(textStyle.character)) {
|
|
28166
28178
|
const attr = Object.assign({ x,
|
|
28167
|
-
y, width: (
|
|
28179
|
+
y, width: (_b = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _b !== void 0 ? _b : 0, height: fixedMainTitleHeight !== null && fixedMainTitleHeight !== void 0 ? fixedMainTitleHeight : 0, ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : true, wordBreak: wordBreak !== null && wordBreak !== void 0 ? wordBreak : 'break-word', maxHeight: mainTitleMaxHeight !== null && mainTitleMaxHeight !== void 0 ? mainTitleMaxHeight : maxHeight, maxWidth: mainTitleMaxWidth !== null && mainTitleMaxWidth !== void 0 ? mainTitleMaxWidth : maxWidth, textConfig: (_c = textStyle.character) !== null && _c !== void 0 ? _c : text }, textStyle);
|
|
28168
28180
|
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
28169
28181
|
}
|
|
28170
28182
|
else if (textType === 'html') {
|
|
28171
28183
|
const attr = Object.assign({ html: Object.assign(Object.assign({ dom: text }, DEFAULT_HTML_TEXT_SPEC), textStyle), x,
|
|
28172
|
-
y, width: (_d = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _d !== void 0 ? _d : 0, height:
|
|
28184
|
+
y, width: (_d = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _d !== void 0 ? _d : 0, height: fixedMainTitleHeight !== null && fixedMainTitleHeight !== void 0 ? fixedMainTitleHeight : 0, ellipsis,
|
|
28173
28185
|
wordBreak, maxHeight: mainTitleMaxHeight !== null && mainTitleMaxHeight !== void 0 ? mainTitleMaxHeight : maxHeight, maxWidth: mainTitleMaxWidth !== null && mainTitleMaxWidth !== void 0 ? mainTitleMaxWidth : maxWidth, textConfig: [] }, textStyle);
|
|
28174
28186
|
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
28175
28187
|
}
|
|
28176
28188
|
else if (isValid(text)) {
|
|
28177
|
-
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: isArray(text) ? text : [text], whiteSpace: 'normal' }, textStyle), { maxLineWidth: (
|
|
28189
|
+
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: isArray(text) ? text : [text], whiteSpace: 'normal' }, textStyle), { maxLineWidth: (_f = (_e = textStyle.maxLineWidth) !== null && _e !== void 0 ? _e : mainTitleWidth) !== null && _f !== void 0 ? _f : width, heightLimit: (_g = textStyle.height) !== null && _g !== void 0 ? _g : maxHeight, lineClamp,
|
|
28178
28190
|
ellipsis,
|
|
28179
28191
|
x,
|
|
28180
28192
|
y }), 'text');
|
|
28181
28193
|
}
|
|
28182
28194
|
}
|
|
28183
|
-
const
|
|
28184
|
-
const
|
|
28195
|
+
const mainTextBoundsHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;
|
|
28196
|
+
const mainTextBoundsWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;
|
|
28185
28197
|
if (this.attribute.visible !== false && subtextStyle.visible !== false) {
|
|
28186
28198
|
const { width: subTitleWidth, height: subTitleHeight, maxWidth: subTitleMaxWidth, maxHeight: subTitleMaxHeight, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', lineClamp } = subtextStyle;
|
|
28187
|
-
const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight -
|
|
28199
|
+
const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - mainTextBoundsHeight);
|
|
28188
28200
|
if (subtextType === 'rich' || isValid(subtextStyle.character)) {
|
|
28189
28201
|
const attr = Object.assign({ x,
|
|
28190
28202
|
y, width: (_h = subTitleWidth !== null && subTitleWidth !== void 0 ? subTitleWidth : width) !== null && _h !== void 0 ? _h : 0, height: (_j = subTitleHeight !== null && subTitleHeight !== void 0 ? subTitleHeight : height) !== null && _j !== void 0 ? _j : 0, ellipsis,
|
|
@@ -28199,47 +28211,43 @@ class Title extends AbstractComponent {
|
|
|
28199
28211
|
}
|
|
28200
28212
|
else if (isValid(subtext)) {
|
|
28201
28213
|
this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: isArray(subtext) ? subtext : [subtext], whiteSpace: 'normal' }, subtextStyle), { maxLineWidth: (_o = subtextStyle.maxLineWidth) !== null && _o !== void 0 ? _o : width, heightLimit: (_p = subtextStyle.heightLimit) !== null && _p !== void 0 ? _p : maxSubTextHeight, lineClamp,
|
|
28202
|
-
ellipsis, x: 0, y:
|
|
28214
|
+
ellipsis, x: 0, y: mainTextBoundsHeight }), 'text');
|
|
28203
28215
|
}
|
|
28204
28216
|
}
|
|
28205
|
-
const
|
|
28206
|
-
const
|
|
28207
|
-
let
|
|
28208
|
-
let
|
|
28217
|
+
const subTextBoundsHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;
|
|
28218
|
+
const subTextBoundsWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
|
|
28219
|
+
let totalWidth = Math.max(mainTextBoundsWidth, subTextBoundsWidth);
|
|
28220
|
+
let totalHeight = mainTextBoundsHeight + ((_q = subtextStyle.height) !== null && _q !== void 0 ? _q : subTextBoundsHeight);
|
|
28209
28221
|
if (isValid(width)) {
|
|
28210
|
-
|
|
28222
|
+
totalWidth = width;
|
|
28211
28223
|
}
|
|
28212
28224
|
if (isValid(height)) {
|
|
28213
|
-
|
|
28225
|
+
totalHeight = height;
|
|
28214
28226
|
}
|
|
28215
|
-
if (isValid(minWidth) &&
|
|
28216
|
-
|
|
28227
|
+
if (isValid(minWidth) && totalWidth < minWidth) {
|
|
28228
|
+
totalWidth = minWidth;
|
|
28217
28229
|
}
|
|
28218
28230
|
if (isValid(maxWidth)) {
|
|
28219
|
-
if (
|
|
28220
|
-
|
|
28231
|
+
if (totalWidth > maxWidth) {
|
|
28232
|
+
totalWidth = maxWidth;
|
|
28221
28233
|
}
|
|
28222
28234
|
}
|
|
28223
|
-
if (isValid(minHeight) &&
|
|
28224
|
-
|
|
28235
|
+
if (isValid(minHeight) && totalHeight < minHeight) {
|
|
28236
|
+
totalHeight = minHeight;
|
|
28225
28237
|
}
|
|
28226
28238
|
if (isValid(maxHeight)) {
|
|
28227
|
-
if (
|
|
28228
|
-
|
|
28239
|
+
if (totalHeight > maxHeight) {
|
|
28240
|
+
totalHeight = maxHeight;
|
|
28229
28241
|
}
|
|
28230
28242
|
}
|
|
28231
|
-
group.attribute.width =
|
|
28232
|
-
group.attribute.height =
|
|
28243
|
+
group.attribute.width = totalWidth;
|
|
28244
|
+
group.attribute.height = totalHeight;
|
|
28233
28245
|
group.attribute.boundsPadding = parsedPadding;
|
|
28234
28246
|
if (this._mainTitle) {
|
|
28235
28247
|
if (isValid(align) || isValid(textStyle.align)) {
|
|
28236
28248
|
const mainTitleAlign = textStyle.align ? textStyle.align : align;
|
|
28237
|
-
const mainTitleWidth = (_r = textStyle.width) !== null && _r !== void 0 ? _r :
|
|
28238
|
-
if (mainTitleAlign === '
|
|
28239
|
-
this._mainTitle.setAttribute('x', 0);
|
|
28240
|
-
this._mainTitle.setAttribute('textAlign', 'left');
|
|
28241
|
-
}
|
|
28242
|
-
else if (mainTitleAlign === 'center') {
|
|
28249
|
+
const mainTitleWidth = (_r = textStyle.width) !== null && _r !== void 0 ? _r : totalWidth;
|
|
28250
|
+
if (mainTitleAlign === 'center') {
|
|
28243
28251
|
this._mainTitle.setAttribute('x', mainTitleWidth / 2);
|
|
28244
28252
|
this._mainTitle.setAttribute('textAlign', 'center');
|
|
28245
28253
|
}
|
|
@@ -28247,33 +28255,31 @@ class Title extends AbstractComponent {
|
|
|
28247
28255
|
this._mainTitle.setAttribute('x', mainTitleWidth);
|
|
28248
28256
|
this._mainTitle.setAttribute('textAlign', 'right');
|
|
28249
28257
|
}
|
|
28250
|
-
|
|
28251
|
-
|
|
28252
|
-
|
|
28253
|
-
const mainTitleHeight = textStyle.height ? textStyle.height : titleHeight;
|
|
28254
|
-
if (mainTitleVerticalAlign === 'top') {
|
|
28255
|
-
this._mainTitle.setAttribute('y', 0);
|
|
28256
|
-
this._mainTitle.setAttribute('textBaseline', 'top');
|
|
28257
|
-
}
|
|
28258
|
-
else if (mainTitleVerticalAlign === 'middle') {
|
|
28259
|
-
this._mainTitle.setAttribute('y', mainTitleHeight / 2);
|
|
28260
|
-
this._mainTitle.setAttribute('textBaseline', 'middle');
|
|
28261
|
-
}
|
|
28262
|
-
else if (mainTitleVerticalAlign === 'bottom') {
|
|
28263
|
-
this._mainTitle.setAttribute('y', mainTitleHeight);
|
|
28264
|
-
this._mainTitle.setAttribute('textBaseline', 'bottom');
|
|
28258
|
+
else {
|
|
28259
|
+
this._mainTitle.setAttribute('x', 0);
|
|
28260
|
+
this._mainTitle.setAttribute('textAlign', 'left');
|
|
28265
28261
|
}
|
|
28266
28262
|
}
|
|
28263
|
+
const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;
|
|
28264
|
+
const mainTitleHeight = fixedMainTitleHeight !== null && fixedMainTitleHeight !== void 0 ? fixedMainTitleHeight : (this._mainTitle.AABBBounds.empty() ? 0 : this._mainTitle.AABBBounds.height());
|
|
28265
|
+
if (mainTitleVerticalAlign === 'middle') {
|
|
28266
|
+
this._mainTitle.setAttribute('y', mainTitleHeight / 2);
|
|
28267
|
+
this._mainTitle.setAttribute('textBaseline', 'middle');
|
|
28268
|
+
}
|
|
28269
|
+
else if (mainTitleVerticalAlign === 'bottom') {
|
|
28270
|
+
this._mainTitle.setAttribute('y', mainTitleHeight);
|
|
28271
|
+
this._mainTitle.setAttribute('textBaseline', 'bottom');
|
|
28272
|
+
}
|
|
28273
|
+
else {
|
|
28274
|
+
this._mainTitle.setAttribute('y', 0);
|
|
28275
|
+
this._mainTitle.setAttribute('textBaseline', 'top');
|
|
28276
|
+
}
|
|
28267
28277
|
}
|
|
28268
28278
|
if (this._subTitle) {
|
|
28269
28279
|
if (isValid(align) || isValid(subtextStyle.align)) {
|
|
28270
28280
|
const subTitleAlign = subtextStyle.align ? subtextStyle.align : align;
|
|
28271
|
-
const subTitleWidth = (_s = subtextStyle.width) !== null && _s !== void 0 ? _s :
|
|
28272
|
-
if (subTitleAlign === '
|
|
28273
|
-
this._subTitle.setAttribute('x', 0);
|
|
28274
|
-
this._subTitle.setAttribute('textAlign', 'left');
|
|
28275
|
-
}
|
|
28276
|
-
else if (subTitleAlign === 'center') {
|
|
28281
|
+
const subTitleWidth = (_t = (_s = subtextStyle.width) !== null && _s !== void 0 ? _s : textStyle.width) !== null && _t !== void 0 ? _t : totalWidth;
|
|
28282
|
+
if (subTitleAlign === 'center') {
|
|
28277
28283
|
this._subTitle.setAttribute('x', subTitleWidth / 2);
|
|
28278
28284
|
this._subTitle.setAttribute('textAlign', 'center');
|
|
28279
28285
|
}
|
|
@@ -28281,24 +28287,32 @@ class Title extends AbstractComponent {
|
|
|
28281
28287
|
this._subTitle.setAttribute('x', subTitleWidth);
|
|
28282
28288
|
this._subTitle.setAttribute('textAlign', 'right');
|
|
28283
28289
|
}
|
|
28284
|
-
|
|
28285
|
-
|
|
28286
|
-
|
|
28287
|
-
const subTitleYStart = maintextHeight;
|
|
28288
|
-
const subTitleHeight = (_t = subtextStyle.height) !== null && _t !== void 0 ? _t : 0;
|
|
28289
|
-
if (subTitleVerticalAlign === 'top') {
|
|
28290
|
-
this._subTitle.setAttribute('y', subTitleYStart);
|
|
28291
|
-
this._subTitle.setAttribute('textBaseline', 'top');
|
|
28292
|
-
}
|
|
28293
|
-
else if (subTitleVerticalAlign === 'middle') {
|
|
28294
|
-
this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);
|
|
28295
|
-
this._subTitle.setAttribute('textBaseline', 'middle');
|
|
28296
|
-
}
|
|
28297
|
-
else if (subTitleVerticalAlign === 'bottom') {
|
|
28298
|
-
this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);
|
|
28299
|
-
this._subTitle.setAttribute('textBaseline', 'bottom');
|
|
28290
|
+
else {
|
|
28291
|
+
this._subTitle.setAttribute('x', 0);
|
|
28292
|
+
this._subTitle.setAttribute('textAlign', 'left');
|
|
28300
28293
|
}
|
|
28301
28294
|
}
|
|
28295
|
+
const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;
|
|
28296
|
+
const subTitleYStart = this._mainTitle
|
|
28297
|
+
? isValid(fixedMainTitleHeight)
|
|
28298
|
+
?
|
|
28299
|
+
this._mainTitle.AABBBounds.y1 +
|
|
28300
|
+
Math.max(this._mainTitle.AABBBounds.empty() ? 0 : this._mainTitle.AABBBounds.height(), fixedMainTitleHeight)
|
|
28301
|
+
: this._mainTitle.AABBBounds.y2
|
|
28302
|
+
: 0;
|
|
28303
|
+
const subTitleHeight = (_v = (_u = subtextStyle.height) !== null && _u !== void 0 ? _u : height) !== null && _v !== void 0 ? _v : (this._subTitle.AABBBounds.empty() ? 0 : this._subTitle.AABBBounds.height());
|
|
28304
|
+
if (subTitleVerticalAlign === 'middle') {
|
|
28305
|
+
this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);
|
|
28306
|
+
this._subTitle.setAttribute('textBaseline', 'middle');
|
|
28307
|
+
}
|
|
28308
|
+
else if (subTitleVerticalAlign === 'bottom') {
|
|
28309
|
+
this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);
|
|
28310
|
+
this._subTitle.setAttribute('textBaseline', 'bottom');
|
|
28311
|
+
}
|
|
28312
|
+
else {
|
|
28313
|
+
this._subTitle.setAttribute('y', subTitleYStart);
|
|
28314
|
+
this._subTitle.setAttribute('textBaseline', 'top');
|
|
28315
|
+
}
|
|
28302
28316
|
}
|
|
28303
28317
|
}
|
|
28304
28318
|
}
|
|
@@ -31301,6 +31315,6 @@ StoryLabelItem.defaultAttributes = {
|
|
|
31301
31315
|
theme: 'default'
|
|
31302
31316
|
};
|
|
31303
31317
|
|
|
31304
|
-
const version = "0.22.
|
|
31318
|
+
const version = "0.22.1";
|
|
31305
31319
|
|
|
31306
31320
|
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, StoryLabelItem, Switch, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, WeatherBox, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, scrollbarModule, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
|