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
b463a316
Commit
b463a316
authored
Jan 06, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev
parent
06a3d4c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
layout.js
src/module/layout.js
+10
-4
No files found.
src/module/layout.js
View file @
b463a316
KityMinder
.
registerModule
(
"LayoutModule"
,
function
()
{
KityMinder
.
registerModule
(
"LayoutModule"
,
function
()
{
var
createChildNode
=
function
(
km
,
parent
)
{
var
createChildNode
=
function
(
km
,
parent
)
{
var
children
=
parent
.
getChildren
();
var
_node
=
new
MinderNode
();
var
_node
=
new
MinderNode
();
_node
.
setData
(
"y"
,
Math
.
random
()
*
300
+
10
0
);
_node
.
setData
(
"y"
,
Math
.
random
()
*
500
+
1
0
);
_node
.
setData
(
"text"
,
"New Node"
);
_node
.
setData
(
"text"
,
"New Node"
);
switch
(
parent
.
branchside
)
{
switch
(
parent
.
getData
(
"branchside"
)
)
{
case
"left"
:
case
"left"
:
_node
.
setData
(
"branchside"
,
"left"
);
break
;
break
;
case
"right"
:
case
"right"
:
_node
.
setData
(
"branchside"
,
"right"
);
break
;
break
;
default
:
default
:
(
function
()
{
(
function
()
{
var
children
=
parent
.
getChildren
();
if
(
children
.
length
<
5
)
{
if
(
children
.
length
<
5
)
{
_node
.
setData
(
"x"
,
parent
.
getData
(
"x"
)
+
200
);
_node
.
setData
(
"x"
,
parent
.
getData
(
"x"
)
+
200
);
_node
.
setData
(
"align"
,
"left"
);
_node
.
setData
(
"align"
,
"left"
);
_node
.
setData
(
"branchside"
,
"left"
);
}
else
{
}
else
{
_node
.
setData
(
"x"
,
parent
.
getData
(
"x"
)
-
200
);
_node
.
setData
(
"x"
,
parent
.
getData
(
"x"
)
-
200
);
_node
.
setData
(
"align"
,
"right"
);
_node
.
setData
(
"align"
,
"right"
);
_node
.
setData
(
"branchside"
,
"right"
);
}
}
}
)();
}
)();
break
;
break
;
...
@@ -40,7 +44,9 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -40,7 +44,9 @@ KityMinder.registerModule( "LayoutModule", function () {
console
.
log
(
sibling
);
console
.
log
(
sibling
);
var
parent
=
sibling
.
getParent
();
var
parent
=
sibling
.
getParent
();
if
(
parent
)
{
if
(
parent
)
{
createChildNode
(
km
,
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