Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
6f57d741
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,发现更多精彩内容 >>
提交
6f57d741
编写于
6月 04, 2020
作者:
P
pissang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(label): fix logic issues in setLabelLineStyle
上级
c344d13b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
16 deletion
+31
-16
src/label/labelGuideHelper.ts
src/label/labelGuideHelper.ts
+31
-16
未找到文件。
src/label/labelGuideHelper.ts
浏览文件 @
6f57d741
...
...
@@ -457,6 +457,28 @@ export function limitTurnAngle(linePoints: number[][], minTurnAngle: number) {
type
LabelLineModel
=
Model
<
LabelLineOption
>
;
function
setLabelLineState
(
labelLine
:
Polyline
,
ignore
:
boolean
,
stateName
:
string
,
stateModel
:
Model
)
{
const
isNormal
=
stateName
===
'
normal
'
;
const
stateObj
=
isNormal
?
labelLine
:
labelLine
.
ensureState
(
stateName
);
// Make sure display.
stateObj
.
ignore
=
ignore
;
// Set smooth
let
smooth
=
stateModel
.
get
(
'
smooth
'
);
if
(
smooth
&&
smooth
===
true
)
{
smooth
=
0.4
;
}
stateObj
.
shape
=
stateObj
.
shape
||
{};
(
stateObj
.
shape
as
Polyline
[
'
shape
'
]).
smooth
=
smooth
as
number
;
const
styleObj
=
stateModel
.
getModel
(
'
lineStyle
'
).
getLineStyle
();
isNormal
?
labelLine
.
useStyle
(
styleObj
)
:
stateObj
.
style
=
styleObj
;
}
/**
* Create a label line if necessary and set it's style.
*/
...
...
@@ -478,7 +500,7 @@ export function setLabelLineStyle(
const
normalModel
=
statesModels
.
normal
;
const
showNormal
=
normalModel
.
get
(
'
show
'
);
const
label
Show
Normal
=
label
.
ignore
;
const
label
Ignore
Normal
=
label
.
ignore
;
for
(
let
i
=
0
;
i
<
STATES
.
length
;
i
++
)
{
const
stateName
=
STATES
[
i
];
...
...
@@ -487,8 +509,8 @@ export function setLabelLineStyle(
if
(
stateModel
)
{
const
stateShow
=
stateModel
.
get
(
'
show
'
);
const
isLabelIgnored
=
isNormal
?
label
Show
Normal
:
retrieve2
(
label
.
states
&&
label
.
states
[
stateName
].
ignore
,
label
Show
Normal
);
?
label
Ignore
Normal
:
retrieve2
(
label
.
states
&&
label
.
states
[
stateName
].
ignore
,
label
Ignore
Normal
);
if
(
isLabelIgnored
// Not show when label is not shown in this state.
||
!
retrieve2
(
stateShow
,
showNormal
)
// Use normal state by default if not set.
)
{
...
...
@@ -502,21 +524,14 @@ export function setLabelLineStyle(
if
(
!
labelLine
)
{
labelLine
=
new
Polyline
();
targetEl
.
setTextGuideLine
(
labelLine
);
// Reset state of normal because it's new created.
// NOTE: NORMAL should always been the first!
if
(
!
isNormal
&&
(
labelIgnoreNormal
||
!
showNormal
))
{
setLabelLineState
(
labelLine
,
true
,
'
normal
'
,
statesModels
.
normal
);
}
}
const
stateObj
=
isNormal
?
labelLine
:
labelLine
.
ensureState
(
stateName
);
// Make sure display.
stateObj
.
ignore
=
false
;
// Set smooth
let
smooth
=
stateModel
.
get
(
'
smooth
'
);
if
(
smooth
&&
smooth
===
true
)
{
smooth
=
0.4
;
}
stateObj
.
shape
=
stateObj
.
shape
||
{};
(
stateObj
.
shape
as
Polyline
[
'
shape
'
]).
smooth
=
smooth
as
number
;
const
styleObj
=
stateModel
.
getModel
(
'
lineStyle
'
).
getLineStyle
();
isNormal
?
labelLine
.
useStyle
(
styleObj
)
:
stateObj
.
style
=
styleObj
;
setLabelLineState
(
labelLine
,
false
,
stateName
,
stateModel
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录