Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
33a2e4b8
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,发现更多精彩内容 >>
未验证
提交
33a2e4b8
编写于
6月 27, 2019
作者:
S
sushuang
提交者:
GitHub
6月 27, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix group layout
上级
f83c355f
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
38 addition
and
23 deletion
+38
-23
src/component/graphic.js
src/component/graphic.js
+38
-23
未找到文件。
src/component/graphic.js
浏览文件 @
33a2e4b8
...
@@ -267,7 +267,7 @@ echarts.extendComponentView({
...
@@ -267,7 +267,7 @@ echarts.extendComponentView({
}
}
this
.
_lastGraphicModel
=
graphicModel
;
this
.
_lastGraphicModel
=
graphicModel
;
this
.
_updateElements
(
graphicModel
,
api
);
this
.
_updateElements
(
graphicModel
);
this
.
_relocate
(
graphicModel
,
api
);
this
.
_relocate
(
graphicModel
,
api
);
},
},
...
@@ -277,7 +277,7 @@ echarts.extendComponentView({
...
@@ -277,7 +277,7 @@ echarts.extendComponentView({
* @private
* @private
* @param {Object} graphicModel graphic model
* @param {Object} graphicModel graphic model
*/
*/
_updateElements
:
function
(
graphicModel
,
api
)
{
_updateElements
:
function
(
graphicModel
)
{
var
elOptionsToUpdate
=
graphicModel
.
useElOptionsToUpdate
();
var
elOptionsToUpdate
=
graphicModel
.
useElOptionsToUpdate
();
if
(
!
elOptionsToUpdate
)
{
if
(
!
elOptionsToUpdate
)
{
...
@@ -339,23 +339,8 @@ echarts.extendComponentView({
...
@@ -339,23 +339,8 @@ echarts.extendComponentView({
var
el
=
elMap
.
get
(
id
);
var
el
=
elMap
.
get
(
id
);
if
(
el
)
{
if
(
el
)
{
var
isParentRoot
=
targetElParent
===
rootGroup
;
el
.
__ecGraphicWidthOption
=
elOption
.
width
;
var
parentWidth
=
isParentRoot
el
.
__ecGraphicHeightOption
=
elOption
.
height
;
?
api
.
getWidth
()
// Like 'position:absolute' in css, default 0.
:
(
targetElParent
.
__ecGraphicWidth
||
0
);
var
parentHeight
=
isParentRoot
?
api
.
getHeight
()
:
(
targetElParent
.
__ecGraphicHeight
||
0
);
var
isGroup
=
el
.
type
===
'
group
'
;
el
.
__ecGraphicWidth
=
isGroup
?
parsePercent
(
elOption
.
width
,
parentWidth
)
:
parentWidth
;
el
.
__ecGraphicHeight
=
isGroup
?
parsePercent
(
elOption
.
height
,
parentHeight
)
:
parentHeight
;
setEventData
(
el
,
graphicModel
,
elOption
);
setEventData
(
el
,
graphicModel
,
elOption
);
}
}
});
});
...
@@ -370,7 +355,31 @@ echarts.extendComponentView({
...
@@ -370,7 +355,31 @@ echarts.extendComponentView({
*/
*/
_relocate
:
function
(
graphicModel
,
api
)
{
_relocate
:
function
(
graphicModel
,
api
)
{
var
elOptions
=
graphicModel
.
option
.
elements
;
var
elOptions
=
graphicModel
.
option
.
elements
;
var
rootGroup
=
this
.
group
;
var
elMap
=
this
.
_elMap
;
var
elMap
=
this
.
_elMap
;
var
apiWidth
=
api
.
getWidth
();
var
apiHeight
=
api
.
getHeight
();
// Top-down to calculate percentage width/height of group
for
(
var
i
=
0
;
i
<
elOptions
.
length
;
i
++
)
{
var
elOption
=
elOptions
[
i
];
var
el
=
elMap
.
get
(
elOption
.
id
);
if
(
!
el
||
!
el
.
isGroup
)
{
continue
;
}
var
parentEl
=
el
.
parent
;
var
isParentRoot
=
parentEl
===
rootGroup
;
// Like 'position:absolut' in css, default 0.
el
.
__ecGraphicWidth
=
parsePercent
(
el
.
__ecGraphicWidthOption
,
isParentRoot
?
apiWidth
:
parentEl
.
__ecGraphicWidth
)
||
0
;
el
.
__ecGraphicHeight
=
parsePercent
(
el
.
__ecGraphicHeightOption
,
isParentRoot
?
apiHeight
:
parentEl
.
__ecGraphicHeight
)
||
0
;
}
// Bottom-up tranvese all elements (consider ec resize) to locate elements.
// Bottom-up tranvese all elements (consider ec resize) to locate elements.
for
(
var
i
=
elOptions
.
length
-
1
;
i
>=
0
;
i
--
)
{
for
(
var
i
=
elOptions
.
length
-
1
;
i
>=
0
;
i
--
)
{
...
@@ -381,9 +390,15 @@ echarts.extendComponentView({
...
@@ -381,9 +390,15 @@ echarts.extendComponentView({
continue
;
continue
;
}
}
var
containerInfo
=
{
var
parentEl
=
el
.
parent
;
width
:
el
.
__ecGraphicWidth
,
var
containerInfo
=
parentEl
===
rootGroup
height
:
el
.
__ecGraphicHeight
?
{
width
:
apiWidth
,
height
:
apiHeight
}
:
{
width
:
parentEl
.
__ecGraphicWidth
,
height
:
parentEl
.
__ecGraphicHeight
};
};
layoutUtil
.
positionElement
(
layoutUtil
.
positionElement
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录