Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
d6df31d6
I
incubator-echarts
项目概览
半栈学徒
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
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,发现更多精彩内容 >>
提交
d6df31d6
编写于
7月 18, 2020
作者:
P
pissang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(state): a better fix of issue in commit
d5e2375d
上级
d5e2375d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
31 deletion
+43
-31
src/echarts.ts
src/echarts.ts
+5
-0
src/util/states.ts
src/util/states.ts
+33
-31
src/util/types.ts
src/util/types.ts
+5
-0
未找到文件。
src/echarts.ts
浏览文件 @
d6df31d6
...
...
@@ -2073,6 +2073,11 @@ class ECharts extends Eventful {
return
;
}
if
(
el
instanceof
graphic
.
Path
)
{
(
el
as
ECElement
).
hasFillInNormal
=
el
.
hasFill
();
(
el
as
ECElement
).
hasStrokeInNormal
=
el
.
hasStroke
();
}
// Only updated on changed element. In case element is incremental and don't wan't to rerender.
// TODO, a more proper way?
if
(
el
.
__dirty
)
{
...
...
src/util/states.ts
浏览文件 @
d6df31d6
...
...
@@ -15,7 +15,7 @@ import List from '../data/List';
import
SeriesModel
from
'
../model/Series
'
;
import
{
CoordinateSystemMaster
,
CoordinateSystem
}
from
'
../coord/CoordinateSystem
'
;
import
{
queryDataIndex
}
from
'
./model
'
;
import
{
PathStyleProps
}
from
'
zrender/src/graphic/Path
'
;
import
Path
,
{
PathStyleProps
}
from
'
zrender/src/graphic/Path
'
;
// Reserve 0 as default.
let
_highlightNextDigit
=
1
;
...
...
@@ -178,42 +178,44 @@ function createEmphasisDefaultState(
)
{
const
hasEmphasis
=
indexOf
(
el
.
currentStates
,
stateName
)
>=
0
;
let
cloned
=
false
;
if
(
!
hasEmphasis
)
{
// Do nothing if there is emphasis state exists.
if
(
!
(
el
instanceof
ZRText
))
{
const
currentFill
=
el
.
style
.
fill
;
const
currentStroke
=
el
.
style
.
stroke
;
if
(
currentFill
||
currentStroke
)
{
const
fromState
=
getFromStateStyle
(
el
,
[
'
fill
'
,
'
stroke
'
],
stateName
);
state
=
state
||
{};
// Apply default color lift
let
emphasisStyle
=
state
.
style
||
{};
if
(
!
hasFillOrStroke
(
emphasisStyle
.
fill
)
&&
hasFillOrStroke
(
currentFill
))
{
cloned
=
true
;
// Not modify the original value.
if
(
el
instanceof
Path
)
{
const
hasFillInNormal
=
(
el
as
ECElement
).
hasFillInNormal
;
const
hasStrokeInNormal
=
(
el
as
ECElement
).
hasStrokeInNormal
;
if
(
hasFillInNormal
||
hasStrokeInNormal
)
{
const
fromState
:
PathStyleProps
=
!
hasEmphasis
?
getFromStateStyle
(
el
,
[
'
fill
'
,
'
stroke
'
],
stateName
)
:
null
;
state
=
state
||
{};
// Apply default color lift
let
emphasisStyle
=
state
.
style
||
{};
if
(
!
hasFillOrStroke
(
emphasisStyle
.
fill
)
&&
hasFillInNormal
)
{
cloned
=
true
;
// Not modify the original value.
state
=
extend
({},
state
);
emphasisStyle
=
extend
({},
emphasisStyle
);
// Already being applied 'emphasis'. DON'T lift color multiple times.
emphasisStyle
.
fill
=
hasEmphasis
?
el
.
style
.
fill
:
liftColor
(
fromState
.
fill
as
ColorString
);
}
if
(
!
hasFillOrStroke
(
emphasisStyle
.
stroke
)
&&
hasStrokeInNormal
)
{
if
(
!
cloned
)
{
state
=
extend
({},
state
);
emphasisStyle
=
extend
({},
emphasisStyle
);
// Already being applied 'emphasis'. DON'T lift color multiple times.
emphasisStyle
.
fill
=
liftColor
(
fromState
.
fill
as
ColorString
);
}
if
(
!
hasFillOrStroke
(
emphasisStyle
.
stroke
)
&&
hasFillOrStroke
(
currentStroke
))
{
if
(
!
cloned
)
{
state
=
extend
({},
state
);
emphasisStyle
=
extend
({},
emphasisStyle
);
}
emphasisStyle
.
stroke
=
liftColor
(
fromState
.
stroke
as
ColorString
);
}
state
.
style
=
emphasisStyle
;
emphasisStyle
.
stroke
=
hasEmphasis
?
el
.
style
.
stroke
:
liftColor
(
fromState
.
stroke
as
ColorString
);
}
state
.
style
=
emphasisStyle
;
}
if
(
state
)
{
// TODO Share with textContent?
if
(
state
.
z2
==
null
)
{
if
(
!
cloned
)
{
state
=
extend
({},
state
);
}
const
z2EmphasisLift
=
(
el
as
ECElement
).
z2EmphasisLift
;
state
.
z2
=
el
.
z2
+
(
z2EmphasisLift
!=
null
?
z2EmphasisLift
:
Z2_EMPHASIS_LIFT
);
}
if
(
state
)
{
// TODO Share with textContent?
if
(
state
.
z2
==
null
)
{
if
(
!
cloned
)
{
state
=
extend
({},
state
);
}
const
z2EmphasisLift
=
(
el
as
ECElement
).
z2EmphasisLift
;
state
.
z2
=
el
.
z2
+
(
z2EmphasisLift
!=
null
?
z2EmphasisLift
:
Z2_EMPHASIS_LIFT
);
}
}
return
state
;
...
...
src/util/types.ts
浏览文件 @
d6df31d6
...
...
@@ -116,6 +116,11 @@ export interface ECElement extends Element {
z2EmphasisLift
?:
number
;
z2SelectLift
?:
number
;
// If has fill and stroke in normal state.
// It's used when calculating highlighted color in stateProxy.
hasFillInNormal
?:
boolean
;
hasStrokeInNormal
?:
boolean
;
/**
* Force disable animation on any condition
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录