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
1cc974e2
Commit
1cc974e2
authored
Jan 06, 2014
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/kitygraph/kityminder
into dev
Conflicts: src/module/keyboard.js
parents
a93ab56d
99d733da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
layout.js
src/module/layout.js
+13
-5
No files found.
src/module/layout.js
View file @
1cc974e2
KityMinder
.
registerModule
(
"LayoutModule"
,
function
()
{
var
createChildNode
=
function
(
km
,
parent
)
{
var
children
=
parent
.
getChildren
();
var
_node
=
new
MinderNode
();
_node
.
setData
(
"y"
,
Math
.
random
()
*
300
+
100
);
_node
.
setData
(
"y"
,
parent
.
getData
(
"y"
)
+
Math
.
random
()
*
100
-
100
);
_node
.
setData
(
"text"
,
"New Node"
);
switch
(
parent
.
branchside
)
{
switch
(
parent
.
getData
(
"branchside"
)
)
{
case
"left"
:
_node
.
setData
(
"branchside"
,
"left"
);
_node
.
setData
(
"x"
,
parent
.
getData
(
"x"
)
-
200
);
break
;
case
"right"
:
_node
.
setData
(
"x"
,
parent
.
getData
(
"x"
)
+
200
);
_node
.
setData
(
"branchside"
,
"right"
);
break
;
default
:
(
function
()
{
var
children
=
parent
.
getChildren
();
if
(
children
.
length
<
5
)
{
_node
.
setData
(
"x"
,
parent
.
getData
(
"x"
)
+
200
);
_node
.
setData
(
"align"
,
"left"
);
_node
.
setData
(
"align"
,
"right"
);
_node
.
setData
(
"branchside"
,
"right"
);
}
else
{
_node
.
setData
(
"x"
,
parent
.
getData
(
"x"
)
-
200
);
_node
.
setData
(
"align"
,
"right"
);
_node
.
setData
(
"align"
,
"left"
);
_node
.
setData
(
"branchside"
,
"left"
);
}
}
)();
break
;
...
...
@@ -41,6 +47,8 @@ KityMinder.registerModule( "LayoutModule", function () {
var
parent
=
sibling
.
getParent
();
if
(
parent
)
{
return
createChildNode
(
km
,
parent
);
}
else
{
return
false
;
}
}
};
...
...
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