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
7bb40a8f
Commit
7bb40a8f
authored
Jan 17, 2014
by
campaign
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
e4c96c31
d8902d2c
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
256 additions
and
303 deletions
+256
-303
dev.html
demo/dev.html
+4
-0
layout.default.js
src/module/layout.default.js
+14
-5
layout.green.js
src/module/layout.green.js
+238
-298
No files found.
demo/dev.html
View file @
7bb40a8f
...
...
@@ -17,5 +17,9 @@
minder
=
KM
.
createMinder
(
kityminder
);
minder
.
execCommand
(
"switchlayout"
,
"default"
);
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
());
minder
.
execCommand
(
"appendsiblingnode"
,
new
MinderNode
());
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
());
minder
.
execCommand
(
"appendsiblingnode"
,
new
MinderNode
());
minder
.
execCommand
(
"appendsiblingnode"
,
new
MinderNode
());
</script>
</html>
\ No newline at end of file
src/module/layout.default.js
View file @
7bb40a8f
...
...
@@ -140,6 +140,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
radius
:
10
,
fill
:
"skyblue"
,
stroke
:
"orange"
,
strokeWidth
:
1
,
color
:
"black"
,
padding
:
[
5
,
10
,
5
,
10
],
fontSize
:
20
,
...
...
@@ -174,6 +175,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
rect
.
fill
(
_style
.
fill
).
stroke
(
_style
.
stroke
).
setRadius
(
_style
.
radius
).
setWidth
(
_rectWidth
).
setHeight
(
_rectHeight
);
if
(
node
.
getData
(
"highlight"
)
)
{
rect
.
stroke
(
new
kity
.
Pen
(
"white"
,
3
)
);
}
else
{
rect
.
stroke
(
new
kity
.
Pen
(
_style
.
stroke
,
_style
.
strokeWidth
)
);
}
}
};
...
...
@@ -216,6 +219,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
else
shape
.
update
();
updateConnect
(
minder
,
node
);
};
//调整node的位置
var
translateNode
=
function
(
node
)
{
var
_style
=
node
.
_style
;
...
...
@@ -375,6 +379,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
//如果是从其他style切过来的,需要重新布局
if
(
children
.
length
!==
0
)
{
_root
.
setData
(
"leftList"
,
[]
);
_root
.
setData
(
"rightList"
,
[]
);
var
leftList
=
_root
.
getData
(
"leftList"
);
var
rightList
=
_root
.
getData
(
"rightList"
);
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
...
...
@@ -385,10 +391,12 @@ KityMinder.registerModule( "LayoutDefault", function () {
leftList
.
push
(
children
[
i
]
);
children
[
i
].
setData
(
"appendside"
,
"left"
);
}
drawNode
(
children
[
i
]
);
updateArrangement
(
children
[
i
]
);
}
}
},
appendChildNode
:
function
(
parent
,
node
)
{
appendChildNode
:
function
(
parent
,
node
,
index
)
{
var
appendside
=
parent
.
getData
(
"appendside"
);
if
(
parent
===
root
)
{
var
leftList
=
parent
.
getData
(
"leftList"
);
...
...
@@ -403,21 +411,22 @@ KityMinder.registerModule( "LayoutDefault", function () {
node
.
setData
(
"appendside"
,
appendside
);
parent
.
getData
(
appendside
+
"List"
).
push
(
node
);
}
node
.
setData
(
"appendside"
,
appendside
);
if
(
appendside
===
"left"
)
{
node
.
setData
(
"align"
,
"right"
);
}
else
{
node
.
setData
(
"align"
,
"left"
);
}
if
(
parent
.
getChildren
().
indexOf
(
node
)
===
-
1
)
parent
.
appendChild
(
node
);
if
(
parent
.
getChildren
().
indexOf
(
node
)
===
-
1
)
parent
.
appendChild
(
node
,
index
);
drawNode
(
node
);
updateArrangement
(
node
,
"append"
);
},
appendSiblingNode
:
function
(
sibling
,
node
)
{
var
parent
=
sibling
.
getParent
();
var
index
=
sibling
.
getIndex
()
+
1
;
parent
.
appendChild
(
node
,
index
);
drawNode
(
no
de
);
updateArrangement
(
node
,
"append"
);
var
appendside
=
sibling
.
getData
(
"appendside"
);
node
.
setData
(
"appendside"
,
appendsi
de
);
this
.
appendChildNode
(
parent
,
node
,
index
);
},
removeNode
:
function
(
nodes
)
{
var
root
=
this
.
getRoot
();
...
...
src/module/layout.green.js
View file @
7bb40a8f
This diff is collapsed.
Click to expand it.
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