Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
0751ed0a
Commit
0751ed0a
authored
Jan 08, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
direct
parent
44acd200
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
dev.html
demo/dev.html
+0
-1
layout.js
src/module/layout.js
+19
-5
No files found.
demo/dev.html
View file @
0751ed0a
...
...
@@ -38,7 +38,6 @@
//标记根节点以及添加子树的方向
_root
.
setData
(
"appendside"
,
"right"
);
_root
.
setData
(
"sidecount"
,
0
);
minder
.
select
(
_root
);
minder
.
execCommand
(
"rendernode"
,
_root
);
...
...
src/module/layout.js
View file @
0751ed0a
KityMinder
.
registerModule
(
"LayoutModule"
,
function
()
{
var
defaultHeight
=
25
;
var
isOdd
=
function
(
num
)
{
return
num
%
2
!==
0
;
};
//更新分支的高度信息
var
updateBranchHeight
=
function
(
node
,
appendSide
,
root
,
isAdd
,
oldParent
)
{
var
siblings
=
(
function
()
{
...
...
@@ -71,15 +75,17 @@ KityMinder.registerModule( "LayoutModule", function () {
parent
.
insertChild
(
_node
,
index
);
_node
.
setData
(
"appendside"
,
appendSide
);
if
(
parent
===
root
)
{
var
sidecount
=
root
.
getData
(
"sidecount"
)
;
if
(
sidecount
+
1
===
5
)
{
root
.
setData
(
"sidecount"
,
0
);
root
.
setData
(
"appendside"
,
(
"leftright"
).
replace
(
appendSide
,
""
)
);
var
childCount
=
parent
.
getChildren
().
length
;
console
.
log
(
childCount
);
if
(
isOdd
(
parseInt
(
childCount
/
5
)
)
)
{
root
.
setData
(
"appendside"
,
"left"
);
}
else
{
root
.
setData
(
"
sidecount"
,
sidecount
+
1
);
root
.
setData
(
"
appendside"
,
"right"
);
}
}
var
parentX
=
parent
.
getData
(
"x"
);
var
parentWidth
=
parent
.
getRenderContainer
().
getWidth
();
...
...
@@ -198,6 +204,14 @@ KityMinder.registerModule( "LayoutModule", function () {
if
(
reAnal
)
{
reAnalyze
(
km
,
layerArray
,
appendSide
);
}
if
(
parent
===
root
)
{
var
childCount
=
parent
.
getChildren
().
length
;
if
(
isOdd
(
parseInt
(
childCount
/
5
)
)
)
{
root
.
setData
(
"appendside"
,
"left"
);
}
else
{
root
.
setData
(
"appendside"
,
"right"
);
}
}
}
}
this
.
setContentChanged
(
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment