Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
97e15ec4
I
incubator-echarts
项目概览
x649585723
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
incubator-echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
97e15ec4
编写于
6月 24, 2020
作者:
P
pissang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(animation): force stop remove animation before init again.
上级
f6c5bef9
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
48 addition
and
24 deletion
+48
-24
src/chart/bar/BarView.ts
src/chart/bar/BarView.ts
+4
-3
src/chart/bar/PictorialBarView.ts
src/chart/bar/PictorialBarView.ts
+1
-1
src/chart/helper/Symbol.ts
src/chart/helper/Symbol.ts
+7
-9
src/chart/line/LineSeries.ts
src/chart/line/LineSeries.ts
+1
-0
src/chart/line/LineView.ts
src/chart/line/LineView.ts
+1
-1
src/component/timeline/SliderTimelineView.ts
src/component/timeline/SliderTimelineView.ts
+1
-1
src/echarts.ts
src/echarts.ts
+1
-1
src/util/graphic.ts
src/util/graphic.ts
+32
-8
未找到文件。
src/chart/bar/BarView.ts
浏览文件 @
97e15ec4
...
@@ -28,7 +28,8 @@ import {
...
@@ -28,7 +28,8 @@ import {
enableHoverEmphasis
,
enableHoverEmphasis
,
setLabelStyle
,
setLabelStyle
,
updateLabel
,
updateLabel
,
initLabel
initLabel
,
removeElement
}
from
'
../../util/graphic
'
;
}
from
'
../../util/graphic
'
;
import
Path
,
{
PathProps
}
from
'
zrender/src/graphic/Path
'
;
import
Path
,
{
PathProps
}
from
'
zrender/src/graphic/Path
'
;
import
Group
from
'
zrender/src/graphic/Group
'
;
import
Group
from
'
zrender/src/graphic/Group
'
;
...
@@ -703,7 +704,7 @@ function removeRect(
...
@@ -703,7 +704,7 @@ function removeRect(
)
{
)
{
// Not show text when animating
// Not show text when animating
el
.
removeTextContent
();
el
.
removeTextContent
();
updateProps
(
el
,
{
removeElement
(
el
,
{
style
:
{
style
:
{
opacity
:
0
opacity
:
0
}
}
...
@@ -719,7 +720,7 @@ function removeSector(
...
@@ -719,7 +720,7 @@ function removeSector(
)
{
)
{
// Not show text when animating
// Not show text when animating
el
.
removeTextContent
();
el
.
removeTextContent
();
updateProps
(
el
,
{
removeElement
(
el
,
{
style
:
{
style
:
{
opacity
:
0
opacity
:
0
}
}
...
...
src/chart/bar/PictorialBarView.ts
浏览文件 @
97e15ec4
...
@@ -869,7 +869,7 @@ function removeBar(
...
@@ -869,7 +869,7 @@ function removeBar(
bar
.
__pictorialClipPath
&&
(
animationModel
=
null
);
bar
.
__pictorialClipPath
&&
(
animationModel
=
null
);
zrUtil
.
each
(
pathes
,
function
(
path
)
{
zrUtil
.
each
(
pathes
,
function
(
path
)
{
graphic
.
updateProps
(
graphic
.
removeElement
(
path
,
{
scaleX
:
0
,
scaleY
:
0
},
animationModel
,
dataIndex
,
path
,
{
scaleX
:
0
,
scaleY
:
0
},
animationModel
,
dataIndex
,
function
()
{
function
()
{
bar
.
parent
&&
bar
.
parent
.
remove
(
bar
);
bar
.
parent
&&
bar
.
parent
.
remove
(
bar
);
...
...
src/chart/helper/Symbol.ts
浏览文件 @
97e15ec4
...
@@ -169,20 +169,18 @@ class Symbol extends graphic.Group {
...
@@ -169,20 +169,18 @@ class Symbol extends graphic.Group {
if
(
isInit
)
{
if
(
isInit
)
{
const
symbolPath
=
this
.
childAt
(
0
)
as
ECSymbol
;
const
symbolPath
=
this
.
childAt
(
0
)
as
ECSymbol
;
// Always fadeIn. Because it has fadeOut animation when symbol is removed..
// const fadeIn = seriesScope && seriesScope.fadeIn;
const
fadeIn
=
true
;
const
target
:
PathProps
=
{
const
target
:
PathProps
=
{
scaleX
:
this
.
_sizeX
,
scaleX
:
this
.
_sizeX
,
scaleY
:
this
.
_sizeY
scaleY
:
this
.
_sizeY
,
};
style
:
{
fadeIn
&&
(
target
.
style
=
{
// Always fadeIn. Because it has fadeOut animation when symbol is removed..
opacity
:
symbolPath
.
style
.
opacity
opacity
:
symbolPath
.
style
.
opacity
});
}
};
symbolPath
.
scaleX
=
symbolPath
.
scaleY
=
0
;
symbolPath
.
scaleX
=
symbolPath
.
scaleY
=
0
;
fadeIn
&&
(
symbolPath
.
style
.
opacity
=
0
)
;
symbolPath
.
style
.
opacity
=
0
;
graphic
.
initProps
(
symbolPath
,
target
,
seriesModel
,
idx
);
graphic
.
initProps
(
symbolPath
,
target
,
seriesModel
,
idx
);
}
}
...
@@ -311,7 +309,7 @@ class Symbol extends graphic.Group {
...
@@ -311,7 +309,7 @@ class Symbol extends graphic.Group {
// Not show text when animating
// Not show text when animating
!
(
opt
&&
opt
.
keepLabel
)
&&
(
symbolPath
.
removeTextContent
());
!
(
opt
&&
opt
.
keepLabel
)
&&
(
symbolPath
.
removeTextContent
());
graphic
.
updateProps
(
graphic
.
removeElement
(
symbolPath
,
symbolPath
,
{
{
style
:
{
style
:
{
...
...
src/chart/line/LineSeries.ts
浏览文件 @
97e15ec4
...
@@ -53,6 +53,7 @@ export interface LineDataItemOption extends SymbolOptionMixin {
...
@@ -53,6 +53,7 @@ export interface LineDataItemOption extends SymbolOptionMixin {
}
}
}
}
export
interface
LineSeriesOption
extends
SeriesOption
,
export
interface
LineSeriesOption
extends
SeriesOption
,
SeriesOnCartesianOptionMixin
,
SeriesOnCartesianOptionMixin
,
SeriesOnPolarOptionMixin
,
SeriesOnPolarOptionMixin
,
...
...
src/chart/line/LineView.ts
浏览文件 @
97e15ec4
...
@@ -501,7 +501,7 @@ class LineView extends ChartView {
...
@@ -501,7 +501,7 @@ class LineView extends ChartView {
// Stop symbol animation and sync with line points
// Stop symbol animation and sync with line points
// FIXME performance?
// FIXME performance?
data
.
eachItemGraphicEl
(
function
(
el
)
{
data
.
eachItemGraphicEl
(
function
(
el
)
{
el
.
stopAnimation
(
true
);
el
.
stopAnimation
(
''
,
true
);
});
});
// In the case data zoom triggerred refreshing frequently
// In the case data zoom triggerred refreshing frequently
...
...
src/component/timeline/SliderTimelineView.ts
浏览文件 @
97e15ec4
...
@@ -795,7 +795,7 @@ function pointerMoveTo(
...
@@ -795,7 +795,7 @@ function pointerMoveTo(
pointer
.
y
=
0
;
pointer
.
y
=
0
;
}
}
else
{
else
{
pointer
.
stopAnimation
(
true
);
pointer
.
stopAnimation
(
''
,
true
);
pointer
.
animateTo
({
pointer
.
animateTo
({
x
:
toCoord
,
x
:
toCoord
,
y
:
0
y
:
0
...
...
src/echarts.ts
浏览文件 @
97e15ec4
...
@@ -554,7 +554,7 @@ class ECharts extends Eventful {
...
@@ -554,7 +554,7 @@ class ECharts extends Eventful {
const
list
=
zr
.
storage
.
getDisplayList
();
const
list
=
zr
.
storage
.
getDisplayList
();
// Stop animations
// Stop animations
zrUtil
.
each
(
list
,
function
(
el
:
Element
)
{
zrUtil
.
each
(
list
,
function
(
el
:
Element
)
{
el
.
stopAnimation
(
true
);
el
.
stopAnimation
(
''
,
true
);
});
});
return
(
zr
.
painter
as
SVGPainter
).
toDataURL
();
return
(
zr
.
painter
as
SVGPainter
).
toDataURL
();
...
...
src/util/graphic.ts
浏览文件 @
97e15ec4
...
@@ -688,7 +688,7 @@ type LabelModelForText = Model<Omit<
...
@@ -688,7 +688,7 @@ type LabelModelForText = Model<Omit<
}
>
;
}
>
;
function
getLabelText
<
LDI
>
(
function
getLabelText
<
LDI
>
(
opt
?
:
SetLabelStyleOpt
<
LDI
>
,
opt
:
SetLabelStyleOpt
<
LDI
>
,
normalModel
:
LabelModel
,
normalModel
:
LabelModel
,
emphasisModel
:
LabelModel
,
emphasisModel
:
LabelModel
,
interpolateValues
?:
ParsedValue
|
ParsedValue
[]
interpolateValues
?:
ParsedValue
|
ParsedValue
[]
...
@@ -1136,7 +1136,7 @@ type AnimateOrSetPropsOption = {
...
@@ -1136,7 +1136,7 @@ type AnimateOrSetPropsOption = {
};
};
function
animateOrSetProps
<
Props
>
(
function
animateOrSetProps
<
Props
>
(
isUpdate
:
boolean
,
animationType
:
'
init
'
|
'
update
'
|
'
remove
'
,
el
:
Element
<
Props
>
,
el
:
Element
<
Props
>
,
props
:
Props
,
props
:
Props
,
animatableModel
?:
Model
<
AnimationOptionMixin
>
&
{
animatableModel
?:
Model
<
AnimationOptionMixin
>
&
{
...
@@ -1158,19 +1158,22 @@ function animateOrSetProps<Props>(
...
@@ -1158,19 +1158,22 @@ function animateOrSetProps<Props>(
isFrom
=
dataIndex
.
isFrom
;
isFrom
=
dataIndex
.
isFrom
;
dataIndex
=
dataIndex
.
dataIndex
;
dataIndex
=
dataIndex
.
dataIndex
;
}
}
const
isUpdate
=
animationType
===
'
update
'
;
const
isRemove
=
animationType
===
'
remove
'
;
// Do not check 'animation' property directly here. Consider this case:
// Do not check 'animation' property directly here. Consider this case:
// animation model is an `itemModel`, whose does not have `isAnimationEnabled`
// animation model is an `itemModel`, whose does not have `isAnimationEnabled`
// but its parent model (`seriesModel`) does.
// but its parent model (`seriesModel`) does.
const
animationEnabled
=
animatableModel
&&
animatableModel
.
isAnimationEnabled
();
const
animationEnabled
=
animatableModel
&&
animatableModel
.
isAnimationEnabled
();
if
(
animationEnabled
)
{
if
(
animationEnabled
)
{
let
duration
=
animatableModel
.
getShallow
(
// TODO Configurable
let
duration
=
isRemove
?
200
:
animatableModel
.
getShallow
(
isUpdate
?
'
animationDurationUpdate
'
:
'
animationDuration
'
isUpdate
?
'
animationDurationUpdate
'
:
'
animationDuration
'
);
);
const
animationEasing
=
animatableModel
.
getShallow
(
const
animationEasing
=
isRemove
?
'
cubicOut
'
:
animatableModel
.
getShallow
(
isUpdate
?
'
animationEasingUpdate
'
:
'
animationEasing
'
isUpdate
?
'
animationEasingUpdate
'
:
'
animationEasing
'
);
);
let
animationDelay
=
animatableModel
.
getShallow
(
let
animationDelay
=
isRemove
?
0
:
animatableModel
.
getShallow
(
isUpdate
?
'
animationDelayUpdate
'
:
'
animationDelay
'
isUpdate
?
'
animationDelayUpdate
'
:
'
animationDelay
'
);
);
if
(
typeof
animationDelay
===
'
function
'
)
{
if
(
typeof
animationDelay
===
'
function
'
)
{
...
@@ -1185,6 +1188,11 @@ function animateOrSetProps<Props>(
...
@@ -1185,6 +1188,11 @@ function animateOrSetProps<Props>(
duration
=
duration
(
dataIndex
as
number
);
duration
=
duration
(
dataIndex
as
number
);
}
}
if
(
!
isRemove
)
{
// Must stop the remove animation.
el
.
stopAnimation
(
'
remove
'
);
}
duration
>
0
duration
>
0
?
(
?
(
isFrom
isFrom
...
@@ -1194,6 +1202,7 @@ function animateOrSetProps<Props>(
...
@@ -1194,6 +1202,7 @@ function animateOrSetProps<Props>(
easing
:
animationEasing
,
easing
:
animationEasing
,
done
:
cb
,
done
:
cb
,
force
:
!!
cb
||
!!
during
,
force
:
!!
cb
||
!!
during
,
scope
:
animationType
,
during
:
during
during
:
during
})
})
:
el
.
animateTo
(
props
,
{
:
el
.
animateTo
(
props
,
{
...
@@ -1203,6 +1212,7 @@ function animateOrSetProps<Props>(
...
@@ -1203,6 +1212,7 @@ function animateOrSetProps<Props>(
done
:
cb
,
done
:
cb
,
force
:
!!
cb
||
!!
during
,
force
:
!!
cb
||
!!
during
,
setToFinal
:
true
,
setToFinal
:
true
,
scope
:
animationType
,
during
:
during
during
:
during
})
})
)
)
...
@@ -1240,7 +1250,7 @@ function updateProps<Props>(
...
@@ -1240,7 +1250,7 @@ function updateProps<Props>(
cb
?:
AnimateOrSetPropsOption
[
'
cb
'
]
|
AnimateOrSetPropsOption
[
'
during
'
],
cb
?:
AnimateOrSetPropsOption
[
'
cb
'
]
|
AnimateOrSetPropsOption
[
'
during
'
],
during
?:
AnimateOrSetPropsOption
[
'
during
'
]
during
?:
AnimateOrSetPropsOption
[
'
during
'
]
)
{
)
{
animateOrSetProps
(
true
,
el
,
props
,
animatableModel
,
dataIndex
,
cb
,
during
);
animateOrSetProps
(
'
update
'
,
el
,
props
,
animatableModel
,
dataIndex
,
cb
,
during
);
}
}
export
{
updateProps
};
export
{
updateProps
};
...
@@ -1261,7 +1271,21 @@ export function initProps<Props>(
...
@@ -1261,7 +1271,21 @@ export function initProps<Props>(
cb
?:
AnimateOrSetPropsOption
[
'
cb
'
]
|
AnimateOrSetPropsOption
[
'
during
'
],
cb
?:
AnimateOrSetPropsOption
[
'
cb
'
]
|
AnimateOrSetPropsOption
[
'
during
'
],
during
?:
AnimateOrSetPropsOption
[
'
during
'
]
during
?:
AnimateOrSetPropsOption
[
'
during
'
]
)
{
)
{
animateOrSetProps
(
false
,
el
,
props
,
animatableModel
,
dataIndex
,
cb
,
during
);
animateOrSetProps
(
'
init
'
,
el
,
props
,
animatableModel
,
dataIndex
,
cb
,
during
);
}
/**
* Remove graphic element
*/
export
function
removeElement
<
Props
>
(
el
:
Element
<
Props
>
,
props
:
Props
,
animatableModel
?:
Model
<
AnimationOptionMixin
>
,
dataIndex
?:
AnimateOrSetPropsOption
[
'
dataIndex
'
]
|
AnimateOrSetPropsOption
[
'
cb
'
]
|
AnimateOrSetPropsOption
,
cb
?:
AnimateOrSetPropsOption
[
'
cb
'
]
|
AnimateOrSetPropsOption
[
'
during
'
],
during
?:
AnimateOrSetPropsOption
[
'
during
'
]
)
{
animateOrSetProps
(
'
remove
'
,
el
,
props
,
animatableModel
,
dataIndex
,
cb
,
during
);
}
}
function
animateOrSetLabel
<
Props
extends
PathProps
>
(
function
animateOrSetLabel
<
Props
extends
PathProps
>
(
...
@@ -1278,7 +1302,7 @@ function animateOrSetLabel<Props extends PathProps>(
...
@@ -1278,7 +1302,7 @@ function animateOrSetLabel<Props extends PathProps>(
const
valueAnimationEnabled
=
labelModel
&&
labelModel
.
get
(
'
valueAnimation
'
);
const
valueAnimationEnabled
=
labelModel
&&
labelModel
.
get
(
'
valueAnimation
'
);
if
(
valueAnimationEnabled
)
{
if
(
valueAnimationEnabled
)
{
const
precisionOption
=
labelModel
.
get
(
'
precision
'
);
const
precisionOption
=
labelModel
.
get
(
'
precision
'
);
le
t
precision
:
number
=
precisionOption
===
'
auto
'
?
0
:
precisionOption
;
cons
t
precision
:
number
=
precisionOption
===
'
auto
'
?
0
:
precisionOption
;
let
interpolateValues
:
(
number
|
string
)[]
|
(
number
|
string
);
let
interpolateValues
:
(
number
|
string
)[]
|
(
number
|
string
);
const
rawValues
=
seriesModel
.
getRawValue
(
dataIndex
);
const
rawValues
=
seriesModel
.
getRawValue
(
dataIndex
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录