You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2020/12/15 13:46:39 UTC
[incubator-echarts] 01/01: fix: fix that label animation restart
when bar realtimeSort change bar orders.
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch fix/bar-race-20201215
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit 9846f04b1b8bcf7104ccc631843fedd0a9766f35
Author: 100pah <su...@gmail.com>
AuthorDate: Tue Dec 15 21:11:03 2020 +0800
fix: fix that label animation restart when bar realtimeSort change bar orders.
---
src/label/labelStyle.ts | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/label/labelStyle.ts b/src/label/labelStyle.ts
index 2a8caed..dd6252e 100644
--- a/src/label/labelStyle.ts
+++ b/src/label/labelStyle.ts
@@ -615,7 +615,7 @@ export function getFont(
export const labelInner = makeInner<{
/**
- * Previous value stored used for label.
+ * Previous target value stored used for label.
* It's mainly for text animation
*/
prevValue?: ParsedValue | ParsedValue[]
@@ -661,9 +661,7 @@ export function setLabelValueAnimation(
}
const obj = labelInner(label);
- // Consider the case that being animating, do not use the `obj.value`,
- // Otherwise it will jump to the `obj.value` when this new animation started.
- obj.prevValue = retrieve2(obj.interpolatedValue, obj.value);
+ obj.prevValue = obj.value;
obj.value = value;
const normalLabelModel = labelStatesModels.normal;
@@ -688,15 +686,17 @@ export function animateLabelValue(
return;
}
const defaultInterpolatedText = labelInnerStore.defaultInterpolatedText;
- const prevValue = labelInnerStore.prevValue;
- const currentValue = labelInnerStore.value;
+ // Consider the case that being animating, do not use the `obj.value`,
+ // Otherwise it will jump to the `obj.value` when this new animation started.
+ const currValue = retrieve2(labelInnerStore.interpolatedValue, labelInnerStore.prevValue);
+ const targetValue = labelInnerStore.value;
function during(percent: number) {
const interpolated = interpolateRawValues(
data,
labelInnerStore.precision,
- prevValue,
- currentValue,
+ currValue,
+ targetValue,
percent
);
labelInnerStore.interpolatedValue = percent === 1 ? null : interpolated;
@@ -712,7 +712,7 @@ export function animateLabelValue(
setLabelText(textEl, labelText);
}
- (prevValue == null
+ (currValue == null
? initProps
: updateProps
)(textEl, {}, seriesModel, dataIndex, null, during);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org