@visactor/vrender-components 0.22.15-alpha.1 → 0.22.15
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/animate/group-transition.d.ts +1 -2
- package/cjs/axis/animate/group-transition.js +2 -2
- package/cjs/axis/animate/group-transition.js.map +1 -1
- package/cjs/axis/base.d.ts +4 -9
- package/cjs/axis/base.js +5 -70
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/register.js +2 -2
- package/cjs/axis/register.js.map +1 -1
- package/cjs/axis/type.d.ts +0 -4
- package/cjs/axis/type.js.map +1 -1
- package/cjs/brush/brush.js.map +1 -1
- package/cjs/brush/config.js +2 -1
- package/cjs/brush/type.js +1 -2
- package/cjs/crosshair/rect.js +2 -1
- package/cjs/crosshair/type.js +1 -2
- 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/indicator/register.js +2 -1
- package/cjs/jsx/index.js +1 -2
- package/cjs/label/animate/animate.d.ts +12 -1
- package/cjs/label/animate/animate.js +84 -1
- package/cjs/label/animate/animate.js.map +1 -1
- package/cjs/label/arc.js +6 -6
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.d.ts +5 -6
- package/cjs/label/base.js +108 -87
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.js +1 -1
- package/cjs/label/register.d.ts +0 -1
- package/cjs/label/register.js +4 -8
- package/cjs/label/register.js.map +1 -1
- package/cjs/label-item/index.js +1 -1
- package/cjs/label-item/label-item.d.ts +20 -9
- package/cjs/label-item/label-item.js +104 -2
- package/cjs/label-item/label-item.js.map +1 -1
- package/cjs/label-item/register.js +1 -1
- package/cjs/label-item/type.js +1 -1
- package/cjs/marker/config.d.ts +18 -0
- package/cjs/marker/config.js +19 -1
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/point.d.ts +18 -0
- package/cjs/marker/point.js +19 -16
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/register.js +7 -8
- package/cjs/marker/register.js.map +1 -1
- package/cjs/marker/type.d.ts +11 -4
- package/cjs/marker/type.js.map +1 -1
- package/cjs/poptip/poptip.d.ts +9 -0
- package/cjs/poptip/poptip.js +37 -1
- package/cjs/poptip/poptip.js.map +1 -1
- package/cjs/weather/weather-box.d.ts +1 -1
- package/cjs/weather/weather-box.js +5 -5
- package/cjs/weather/weather-box.js.map +1 -1
- package/dist/index.es.js +13251 -14607
- package/es/axis/animate/group-transition.d.ts +1 -2
- package/es/axis/animate/group-transition.js +1 -3
- package/es/axis/animate/group-transition.js.map +1 -1
- package/es/axis/base.d.ts +4 -9
- package/es/axis/base.js +9 -75
- package/es/axis/base.js.map +1 -1
- package/es/axis/line.js.map +1 -1
- package/es/axis/register.js +1 -3
- package/es/axis/register.js.map +1 -1
- package/es/axis/type.d.ts +0 -4
- package/es/axis/type.js.map +1 -1
- package/es/brush/brush.js.map +1 -1
- package/es/brush/config.js +2 -1
- package/es/brush/type.js +1 -2
- package/es/crosshair/rect.js +2 -1
- package/es/crosshair/type.js +1 -2
- 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/indicator/register.js +2 -1
- package/es/jsx/index.js +1 -2
- package/es/label/animate/animate.d.ts +12 -1
- package/es/label/animate/animate.js +82 -0
- package/es/label/animate/animate.js.map +1 -1
- package/es/label/arc.js +6 -6
- package/es/label/arc.js.map +1 -1
- package/es/label/base.d.ts +5 -6
- package/es/label/base.js +108 -90
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.js +1 -1
- package/es/label/register.d.ts +0 -1
- package/es/label/register.js +1 -7
- package/es/label/register.js.map +1 -1
- package/es/label-item/index.js +1 -1
- package/es/label-item/label-item.d.ts +20 -9
- package/es/label-item/label-item.js +105 -1
- package/es/label-item/label-item.js.map +1 -1
- package/es/label-item/register.js +1 -1
- package/es/label-item/type.js +1 -1
- package/es/marker/config.d.ts +18 -0
- package/es/marker/config.js +19 -1
- package/es/marker/config.js.map +1 -1
- package/es/marker/point.d.ts +18 -0
- package/es/marker/point.js +19 -16
- package/es/marker/point.js.map +1 -1
- package/es/marker/register.js +6 -8
- package/es/marker/register.js.map +1 -1
- package/es/marker/type.d.ts +11 -4
- package/es/marker/type.js.map +1 -1
- package/es/poptip/poptip.d.ts +9 -0
- package/es/poptip/poptip.js +38 -0
- package/es/poptip/poptip.js.map +1 -1
- package/es/weather/weather-box.d.ts +1 -1
- package/es/weather/weather-box.js +1 -1
- package/es/weather/weather-box.js.map +1 -1
- package/package.json +8 -9
- package/cjs/animation/animate-component.d.ts +0 -22
- package/cjs/animation/animate-component.js +0 -29
- package/cjs/animation/animate-component.js.map +0 -1
- package/cjs/animation/axis-animate.d.ts +0 -10
- package/cjs/animation/axis-animate.js +0 -71
- package/cjs/animation/axis-animate.js.map +0 -1
- package/cjs/animation/label-animate.d.ts +0 -10
- package/cjs/animation/label-animate.js +0 -81
- package/cjs/animation/label-animate.js.map +0 -1
- package/cjs/axis/animate/config.d.ts +0 -6
- package/cjs/axis/animate/config.js +0 -10
- package/cjs/axis/animate/config.js.map +0 -1
- package/es/animation/animate-component.d.ts +0 -22
- package/es/animation/animate-component.js +0 -21
- package/es/animation/animate-component.js.map +0 -1
- package/es/animation/axis-animate.d.ts +0 -10
- package/es/animation/axis-animate.js +0 -60
- package/es/animation/axis-animate.js.map +0 -1
- package/es/animation/label-animate.d.ts +0 -10
- package/es/animation/label-animate.js +0 -70
- package/es/animation/label-animate.js.map +0 -1
- package/es/axis/animate/config.d.ts +0 -6
- package/es/axis/animate/config.js +0 -6
- package/es/axis/animate/config.js.map +0 -1
package/es/label/base.js
CHANGED
|
@@ -8,10 +8,12 @@ var __rest = this && this.__rest || function(s, e) {
|
|
|
8
8
|
return t;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
import { graphicCreator, AttributeUpdateType, CustomPath2D } from "@visactor/vrender-core";
|
|
11
|
+
import { graphicCreator, AttributeUpdateType, IContainPointMode, CustomPath2D } from "@visactor/vrender-core";
|
|
12
12
|
|
|
13
13
|
import { isFunction, isEmpty, isValid, isString, merge, isRectIntersect, isNil, isArray, isObject, pointInRect } from "@visactor/vutils";
|
|
14
14
|
|
|
15
|
+
import { AbstractComponent } from "../core/base";
|
|
16
|
+
|
|
15
17
|
import { labelSmartInvert, contrastAccessibilityChecker, smartInvertStrategy } from "../util/label-smartInvert";
|
|
16
18
|
|
|
17
19
|
import { createTextGraphicByType, getMarksByName, getNoneGroupMarksByName, traverseGroup } from "../util";
|
|
@@ -20,7 +22,7 @@ import { StateValue } from "../constant";
|
|
|
20
22
|
|
|
21
23
|
import { bitmapTool, boundToRange, canPlace, clampText, place } from "./overlap";
|
|
22
24
|
|
|
23
|
-
import { DefaultLabelAnimation } from "./animate/animate";
|
|
25
|
+
import { DefaultLabelAnimation, getAnimationAttributes, updateAnimation } from "./animate/animate";
|
|
24
26
|
|
|
25
27
|
import { connectLineBetweenBounds, getPointsOfLineArea } from "./util";
|
|
26
28
|
|
|
@@ -28,11 +30,9 @@ import { loadLabelComponent } from "./register";
|
|
|
28
30
|
|
|
29
31
|
import { shiftY } from "./overlap/shiftY";
|
|
30
32
|
|
|
31
|
-
import { AnimateComponent } from "../animation/animate-component";
|
|
32
|
-
|
|
33
33
|
loadLabelComponent();
|
|
34
34
|
|
|
35
|
-
export class LabelBase extends
|
|
35
|
+
export class LabelBase extends AbstractComponent {
|
|
36
36
|
setBitmap(bitmap) {
|
|
37
37
|
this._bitmap = bitmap;
|
|
38
38
|
}
|
|
@@ -88,17 +88,13 @@ export class LabelBase extends AnimateComponent {
|
|
|
88
88
|
baseMark: baseMark
|
|
89
89
|
}, attrs, new CustomPath2D);
|
|
90
90
|
}
|
|
91
|
-
return baseMark && baseMark.
|
|
91
|
+
return baseMark && baseMark.attribute.fill && lineGraphic.setAttribute("stroke", baseMark.attribute.fill),
|
|
92
92
|
this.attribute.line && !isEmpty(this.attribute.line.style) && lineGraphic.setAttributes(this.attribute.line.style),
|
|
93
93
|
this._setStatesOfLabelLine(lineGraphic), lineGraphic;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
render() {
|
|
97
97
|
if (this._prepare(), isNil(this._idToGraphic) || this._isCollectionBase && isNil(this._idToPoint)) return;
|
|
98
|
-
const markAttributeList = [];
|
|
99
|
-
!1 !== this._enableAnimation && this._baseMarks.forEach((mark => {
|
|
100
|
-
markAttributeList.push(mark.attribute), mark.initAttributes(mark.getAttributes(!0));
|
|
101
|
-
}));
|
|
102
98
|
const {overlap: overlap, smartInvert: smartInvert, dataFilter: dataFilter, customLayoutFunc: customLayoutFunc, customOverlapFunc: customOverlapFunc} = this.attribute;
|
|
103
99
|
let data = this.attribute.data;
|
|
104
100
|
if (isFunction(dataFilter) && (data = dataFilter(data)), data && data.length) {
|
|
@@ -111,10 +107,7 @@ export class LabelBase extends AnimateComponent {
|
|
|
111
107
|
isFunction(this.attribute.onAfterOverlapping) && this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this),
|
|
112
108
|
labels && labels.length && labels.forEach((label => {
|
|
113
109
|
this._bindEvent(label), this._setStatesOfText(label);
|
|
114
|
-
})), !1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels)
|
|
115
|
-
!1 !== this._enableAnimation && this._baseMarks.forEach(((mark, index) => {
|
|
116
|
-
mark.initAttributes(markAttributeList[index]);
|
|
117
|
-
}));
|
|
110
|
+
})), !1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels);
|
|
118
111
|
}
|
|
119
112
|
_bindEvent(target) {
|
|
120
113
|
if (this.attribute.disableTriggerEvent) return;
|
|
@@ -167,7 +160,18 @@ export class LabelBase extends AnimateComponent {
|
|
|
167
160
|
textData && baseMark && (isValid(textData.id) || (textData.id = `vrender-component-${this.name}-${i}`),
|
|
168
161
|
this._idToGraphic.set(textData.id, baseMark));
|
|
169
162
|
}
|
|
170
|
-
this.
|
|
163
|
+
if (!1 !== this.attribute.animation) {
|
|
164
|
+
const {animation: animation, animationEnter: animationEnter, animationExit: animationExit, animationUpdate: animationUpdate} = this.attribute, animationCfg = isObject(animation) ? animation : {};
|
|
165
|
+
this._animationConfig = {
|
|
166
|
+
enter: !1 !== animationEnter && merge({}, DefaultLabelAnimation, animationCfg, null != animationEnter ? animationEnter : {}),
|
|
167
|
+
exit: !1 !== animationExit && merge({}, DefaultLabelAnimation, animationCfg, null != animationExit ? animationExit : {}),
|
|
168
|
+
update: !1 !== animationUpdate && (isArray(animationUpdate) ? animationUpdate : merge({}, DefaultLabelAnimation, animationCfg, null != animationUpdate ? animationUpdate : {}))
|
|
169
|
+
};
|
|
170
|
+
} else this._animationConfig = {
|
|
171
|
+
enter: !1,
|
|
172
|
+
exit: !1,
|
|
173
|
+
update: !1
|
|
174
|
+
};
|
|
171
175
|
}
|
|
172
176
|
}
|
|
173
177
|
getRelatedGraphic(item) {
|
|
@@ -178,8 +182,8 @@ export class LabelBase extends AnimateComponent {
|
|
|
178
182
|
for (let i = 0; i < data.length; i++) {
|
|
179
183
|
const textData = data[i], baseMark = this.getRelatedGraphic(textData);
|
|
180
184
|
if (!baseMark) continue;
|
|
181
|
-
const
|
|
182
|
-
fill: this._isCollectionBase ? isArray(
|
|
185
|
+
const labelAttribute = Object.assign(Object.assign({
|
|
186
|
+
fill: this._isCollectionBase ? isArray(baseMark.attribute.stroke) ? baseMark.attribute.stroke.find((entry => !!entry && !0 !== entry)) : baseMark.attribute.stroke : baseMark.attribute.fill
|
|
183
187
|
}, textStyle), textData), text = this._createLabelText(labelAttribute);
|
|
184
188
|
labels.push(text);
|
|
185
189
|
}
|
|
@@ -331,15 +335,8 @@ export class LabelBase extends AnimateComponent {
|
|
|
331
335
|
if (baseMarkGroupName) return this.getRootNode().find((node => node.name === baseMarkGroupName), !0);
|
|
332
336
|
}
|
|
333
337
|
getGraphicBounds(graphic, point = {}, position) {
|
|
334
|
-
var _a;
|
|
335
338
|
if (graphic) {
|
|
336
|
-
if (!1 !== graphic.attribute.visible)
|
|
337
|
-
if (null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.animationState) {
|
|
338
|
-
const clonedGraphic = graphic.clone();
|
|
339
|
-
return Object.assign(clonedGraphic.attribute, graphic.getAttributes(!0)), clonedGraphic.AABBBounds;
|
|
340
|
-
}
|
|
341
|
-
return graphic.AABBBounds;
|
|
342
|
-
}
|
|
339
|
+
if (!1 !== graphic.attribute.visible) return graphic.AABBBounds;
|
|
343
340
|
const {x: x, y: y} = graphic.attribute;
|
|
344
341
|
return {
|
|
345
342
|
x1: x,
|
|
@@ -372,88 +369,64 @@ export class LabelBase extends AnimateComponent {
|
|
|
372
369
|
var _a;
|
|
373
370
|
const relatedGraphic = this.getRelatedGraphic(text.attribute), textKey = this._isCollectionBase ? text.attribute.id : relatedGraphic, state = (null == prevTextMap ? void 0 : prevTextMap.get(textKey)) ? "update" : "enter";
|
|
374
371
|
let labelLine;
|
|
375
|
-
showLabelLine && (labelLine = this._createLabelLine(text, relatedGraphic))
|
|
376
|
-
|
|
372
|
+
if (showLabelLine && (labelLine = this._createLabelLine(text, relatedGraphic)),
|
|
373
|
+
syncState && this.updateStatesOfLabels([ labelLine ? {
|
|
377
374
|
text: text,
|
|
378
375
|
labelLine: labelLine
|
|
379
376
|
} : {
|
|
380
377
|
text: text
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
378
|
+
} ], null !== (_a = relatedGraphic.currentStates) && void 0 !== _a ? _a : []), "enter" === state) texts.push(text),
|
|
379
|
+
currentTextMap.set(textKey, labelLine ? {
|
|
380
|
+
text: text,
|
|
381
|
+
labelLine: labelLine
|
|
382
|
+
} : {
|
|
383
|
+
text: text
|
|
384
|
+
}), this._addLabel({
|
|
385
|
+
text: text,
|
|
386
|
+
labelLine: labelLine
|
|
387
|
+
}, texts, labelLines, index); else if ("update" === state) {
|
|
385
388
|
const prevLabel = prevTextMap.get(textKey);
|
|
386
|
-
prevTextMap.delete(textKey), currentTextMap.set(textKey, prevLabel), this._updateLabel(prevLabel,
|
|
389
|
+
prevTextMap.delete(textKey), currentTextMap.set(textKey, prevLabel), this._updateLabel(prevLabel, {
|
|
390
|
+
text: text,
|
|
391
|
+
labelLine: labelLine
|
|
392
|
+
});
|
|
387
393
|
}
|
|
388
394
|
})), this._removeLabel(prevTextMap), this._graphicToText = currentTextMap;
|
|
389
395
|
}
|
|
390
|
-
runEnterAnimation(text, labelLine) {
|
|
391
|
-
if (!1 === this._enableAnimation || !this._animationConfig.enter) return;
|
|
392
|
-
const relatedGraphic = this.getRelatedGraphic(text.attribute), {enter: enter} = this._animationConfig;
|
|
393
|
-
[ text, labelLine ].filter(Boolean).forEach((item => item.applyAnimationState([ "enter" ], [ {
|
|
394
|
-
name: "enter",
|
|
395
|
-
animation: Object.assign(Object.assign({}, enter), {
|
|
396
|
-
type: "labelEnter",
|
|
397
|
-
selfOnly: !0,
|
|
398
|
-
customParameters: {
|
|
399
|
-
relatedGraphic: relatedGraphic,
|
|
400
|
-
relatedGraphics: this._idToGraphic,
|
|
401
|
-
config: Object.assign(Object.assign({}, enter), {
|
|
402
|
-
type: item === text ? enter.type : "fadeIn"
|
|
403
|
-
})
|
|
404
|
-
}
|
|
405
|
-
})
|
|
406
|
-
} ])));
|
|
407
|
-
}
|
|
408
|
-
_runUpdateAnimation(prevLabel, currentLabel) {
|
|
409
|
-
const {text: prevText, labelLine: prevLabelLine} = prevLabel, {text: curText, labelLine: curLabelLine} = currentLabel;
|
|
410
|
-
prevText.applyAnimationState([ "update" ], [ {
|
|
411
|
-
name: "update",
|
|
412
|
-
animation: Object.assign(Object.assign({
|
|
413
|
-
type: "labelUpdate"
|
|
414
|
-
}, this._animationConfig.update), {
|
|
415
|
-
customParameters: {
|
|
416
|
-
prevText: prevText,
|
|
417
|
-
curText: curText,
|
|
418
|
-
prevLabelLine: prevLabelLine,
|
|
419
|
-
curLabelLine: curLabelLine
|
|
420
|
-
}
|
|
421
|
-
})
|
|
422
|
-
} ]);
|
|
423
|
-
}
|
|
424
|
-
_syncStateWithRelatedGraphic(relatedGraphic) {
|
|
425
|
-
this.attribute.syncState && relatedGraphic && relatedGraphic.on("afterStateUpdate", this._handleRelatedGraphicSetState);
|
|
426
|
-
}
|
|
427
396
|
_addLabel(label, texts, labelLines, index) {
|
|
428
397
|
const {text: text, labelLine: labelLine} = label, relatedGraphic = this.getRelatedGraphic(text.attribute);
|
|
429
|
-
this._syncStateWithRelatedGraphic(relatedGraphic),
|
|
430
|
-
|
|
398
|
+
if (this._syncStateWithRelatedGraphic(relatedGraphic), !1 !== this._enableAnimation && !1 !== this._animationConfig.enter) {
|
|
399
|
+
if (relatedGraphic) {
|
|
400
|
+
const {from: from, to: to} = getAnimationAttributes(text.attribute, "fadeIn");
|
|
401
|
+
text && this.add(text), labelLine && (labelLines.push(labelLine), this.add(labelLine)),
|
|
402
|
+
this._animationConfig.enter.duration > 0 && relatedGraphic.once("animate-bind", (a => {
|
|
403
|
+
text.setAttributes(from), labelLine && labelLine.setAttributes(from);
|
|
404
|
+
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, labelLine, labelLines, index, relatedGraphic, to, this._animationConfig.enter);
|
|
405
|
+
relatedGraphic.on("afterAttributeUpdate", listener);
|
|
406
|
+
}));
|
|
407
|
+
}
|
|
408
|
+
} else text && this.add(text), labelLine && this.add(labelLine);
|
|
431
409
|
}
|
|
432
410
|
_updateLabel(prevLabel, currentLabel) {
|
|
433
411
|
const {text: prevText, labelLine: prevLabelLine} = prevLabel, {text: curText, labelLine: curLabelLine} = currentLabel;
|
|
434
|
-
!1
|
|
435
|
-
|
|
412
|
+
if (!1 !== this._enableAnimation && !1 !== this._animationConfig.update) {
|
|
413
|
+
const {duration: duration, easing: easing} = this._animationConfig.update;
|
|
414
|
+
updateAnimation(prevText, curText, this._animationConfig.update), prevLabelLine && curLabelLine && prevLabel.labelLine.animate().to(curLabelLine.attribute, duration, easing);
|
|
415
|
+
} else prevLabel.text.setAttributes(curText.attribute), prevLabelLine && curLabelLine && prevLabel.labelLine.setAttributes(curLabelLine.attribute);
|
|
436
416
|
}
|
|
437
417
|
_removeLabel(textMap) {
|
|
438
418
|
const removeLabelAndLine = label => {
|
|
439
419
|
this.removeChild(label.text), label.labelLine && this.removeChild(label.labelLine);
|
|
440
420
|
};
|
|
441
|
-
!1 !== this._enableAnimation && !1 !== this._animationConfig.exit
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
})
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
})), null === (_a = label.labelLine) || void 0 === _a || _a.applyAnimationState([ "exit" ], [ {
|
|
451
|
-
name: "exit",
|
|
452
|
-
animation: Object.assign(Object.assign({}, this._animationConfig.exit), {
|
|
453
|
-
type: "fadeOut"
|
|
454
|
-
})
|
|
455
|
-
} ], (() => {}));
|
|
456
|
-
})) : textMap.forEach((label => {
|
|
421
|
+
if (!1 !== this._enableAnimation && !1 !== this._animationConfig.exit) {
|
|
422
|
+
const {duration: duration, easing: easing} = this._animationConfig.exit;
|
|
423
|
+
textMap.forEach((label => {
|
|
424
|
+
var _a;
|
|
425
|
+
null === (_a = label.text) || void 0 === _a || _a.animate().to(getAnimationAttributes(label.text.attribute, "fadeOut").to, duration, easing).onEnd((() => {
|
|
426
|
+
removeLabelAndLine(label);
|
|
427
|
+
}));
|
|
428
|
+
}));
|
|
429
|
+
} else textMap.forEach((label => {
|
|
457
430
|
removeLabelAndLine(label);
|
|
458
431
|
}));
|
|
459
432
|
}
|
|
@@ -462,6 +435,51 @@ export class LabelBase extends AnimateComponent {
|
|
|
462
435
|
label && (label.text && label.text.useStates(currentStates), label.labelLine && label.labelLine.useStates(currentStates));
|
|
463
436
|
}));
|
|
464
437
|
}
|
|
438
|
+
_syncStateWithRelatedGraphic(relatedGraphic) {
|
|
439
|
+
this.attribute.syncState && relatedGraphic && relatedGraphic.on("afterAttributeUpdate", this._handleRelatedGraphicSetState);
|
|
440
|
+
}
|
|
441
|
+
_afterRelatedGraphicAttributeUpdate(text, texts, labelLine, labelLines, index, relatedGraphic, to, {mode: mode, duration: duration, easing: easing, delay: delay}) {
|
|
442
|
+
const listener = event => {
|
|
443
|
+
var _a, _b, _c;
|
|
444
|
+
const {detail: detail} = event;
|
|
445
|
+
if (!detail) return {};
|
|
446
|
+
const step = null === (_a = detail.animationState) || void 0 === _a ? void 0 : _a.step;
|
|
447
|
+
if (!(detail.type === AttributeUpdateType.ANIMATE_UPDATE && step && !("wait" === step.type && null == (null === (_b = step.prev) || void 0 === _b ? void 0 : _b.type)))) return {};
|
|
448
|
+
if (detail.type === AttributeUpdateType.ANIMATE_END) return text.setAttributes(to),
|
|
449
|
+
void (labelLine && labelLine.setAttributes(to));
|
|
450
|
+
const onStart = () => {
|
|
451
|
+
relatedGraphic && (relatedGraphic.onAnimateBind = void 0, relatedGraphic.removeEventListener("afterAttributeUpdate", listener));
|
|
452
|
+
};
|
|
453
|
+
switch (mode) {
|
|
454
|
+
case "after":
|
|
455
|
+
detail.animationState.end && (text.animate({
|
|
456
|
+
onStart: onStart
|
|
457
|
+
}).wait(delay).to(to, duration, easing), labelLine && labelLine.animate().wait(delay).to(to, duration, easing));
|
|
458
|
+
break;
|
|
459
|
+
|
|
460
|
+
case "after-all":
|
|
461
|
+
index === texts.length - 1 && detail.animationState.end && (texts.forEach((t => {
|
|
462
|
+
t.animate({
|
|
463
|
+
onStart: onStart
|
|
464
|
+
}).wait(delay).to(to, duration, easing);
|
|
465
|
+
})), labelLines.forEach((t => {
|
|
466
|
+
t.animate().wait(delay).to(to, duration, easing);
|
|
467
|
+
})));
|
|
468
|
+
break;
|
|
469
|
+
|
|
470
|
+
default:
|
|
471
|
+
if (this._isCollectionBase) {
|
|
472
|
+
const point = this._idToPoint.get(text.attribute.id);
|
|
473
|
+
!point || text.animates && text.animates.has("label-animate") || !relatedGraphic.containsPoint(point.x, point.y, IContainPointMode.LOCAL, null === (_c = this.stage) || void 0 === _c ? void 0 : _c.getPickerService()) || (text.animate({
|
|
474
|
+
onStart: onStart
|
|
475
|
+
}).wait(delay).to(to, duration, easing), labelLine && labelLine.animate().wait(delay).to(to, duration, easing));
|
|
476
|
+
} else detail.animationState.isFirstFrameOfStep && (text.animate({
|
|
477
|
+
onStart: onStart
|
|
478
|
+
}).wait(delay).to(to, duration, easing), labelLine && labelLine.animate().wait(delay).to(to, duration, easing));
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
return listener;
|
|
482
|
+
}
|
|
465
483
|
_smartInvert(labels) {
|
|
466
484
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
467
485
|
const option = isObject(this.attribute.smartInvert) ? this.attribute.smartInvert : {}, {textType: textType, contrastRatiosThreshold: contrastRatiosThreshold, alternativeColors: alternativeColors, mode: mode, interactInvertType: interactInvertType} = option, fillStrategy = null !== (_a = option.fillStrategy) && void 0 !== _a ? _a : "invertBase", strokeStrategy = null !== (_b = option.strokeStrategy) && void 0 !== _b ? _b : "base", brightColor = null !== (_c = option.brightColor) && void 0 !== _c ? _c : "#ffffff", darkColor = null !== (_d = option.darkColor) && void 0 !== _d ? _d : "#000000", outsideEnable = null !== (_e = option.outsideEnable) && void 0 !== _e && _e;
|
|
@@ -469,7 +487,7 @@ export class LabelBase extends AnimateComponent {
|
|
|
469
487
|
const label = labels[i];
|
|
470
488
|
if (!label) continue;
|
|
471
489
|
const baseMark = this.getRelatedGraphic(label.attribute);
|
|
472
|
-
let backgroundColor = baseMark.
|
|
490
|
+
let backgroundColor = baseMark.attribute.fill, foregroundColor = label.attribute.fill;
|
|
473
491
|
if (isObject(backgroundColor) && backgroundColor.gradient) {
|
|
474
492
|
const firstStopColor = null === (_g = null === (_f = backgroundColor.stops) || void 0 === _f ? void 0 : _f[0]) || void 0 === _g ? void 0 : _g.color;
|
|
475
493
|
firstStopColor && (backgroundColor = firstStopColor, foregroundColor = firstStopColor);
|