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
86daaa49
Commit
86daaa49
authored
Jun 16, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added files
parent
4a5ccc85
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
1 deletion
+97
-1
kity
kity
+1
-1
filetree.js
src/layout/filetree.js
+62
-0
filetree.js
src/theme/filetree.js
+34
-0
No files found.
kity
@
437d9c16
Subproject commit
022e5cb489e65df8a38eedf8508478ee1d29c29c
Subproject commit
437d9c160a7961a3843cce3d9e2b01f64090f0df
src/layout/filetree.js
0 → 100644
View file @
86daaa49
/* global Layout:true */
window
.
layoutSwitch
=
true
;
KityMinder
.
registerLayout
(
'filetree'
,
kity
.
createClass
({
base
:
Layout
,
doLayout
:
function
(
node
)
{
var
layout
=
this
;
if
(
node
.
isLayoutRoot
())
{
this
.
doLayoutRoot
(
node
);
}
else
{
this
.
arrange
(
node
);
}
},
doLayoutRoot
:
function
(
root
)
{
this
.
arrange
(
root
);
},
arrange
:
function
(
node
)
{
var
children
=
node
.
getChildren
();
var
_this
=
this
;
if
(
!
children
.
length
)
{
return
false
;
}
else
{
var
totalTreeWidth
=
0
;
// 计算每个 child 的树所占的矩形区域
var
childTreeBoxes
=
children
.
map
(
function
(
node
,
index
,
children
)
{
var
box
=
_this
.
getTreeBox
([
node
]);
return
box
;
});
var
nodeContentBox
=
node
.
getContentBox
();
var
i
,
x
,
y
,
child
,
childTreeBox
,
childContentBox
;
var
transform
=
new
kity
.
Matrix
();
y
=
nodeContentBox
.
bottom
+
node
.
getStyle
(
'margin-bottom'
);
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
child
=
children
[
i
];
childTreeBox
=
childTreeBoxes
[
i
];
childContentBox
=
child
.
getContentBox
();
if
(
!
childContentBox
.
width
)
continue
;
x
=
10
;
y
+=
child
.
getStyle
(
'margin-top'
);
child
.
setLayoutTransform
(
new
kity
.
Matrix
().
translate
(
x
,
y
));
y
+=
childTreeBox
.
height
+
children
[
i
].
getStyle
(
'margin-bottom'
);
child
.
setLayoutVector
(
new
kity
.
Vector
(
childContentBox
.
left
+
5
,
childContentBox
.
cy
));
}
}
}
}));
KityMinder
.
registerConnectProvider
(
'filetree'
,
function
(
node
,
parent
)
{
var
box
=
node
.
getLayoutBox
(),
pBox
=
parent
.
getLayoutBox
();
var
abs
=
Math
.
abs
;
var
pathData
=
[];
var
side
=
box
.
cx
>
pBox
.
cx
?
'right'
:
'left'
;
var
left
=
pBox
.
left
+
5
;
pathData
.
push
(
'M'
,
new
kity
.
Point
(
left
,
pBox
.
bottom
));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
left
,
box
.
cy
));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
box
.
left
,
box
.
cy
));
return
pathData
;
});
\ No newline at end of file
src/theme/filetree.js
0 → 100644
View file @
86daaa49
KityMinder
.
registerTheme
(
'filetree'
,
{
'root-color'
:
'#430'
,
'root-background'
:
'#e9df98'
,
'root-stroke'
:
'none'
,
'root-font-size'
:
24
,
'root-padding'
:
[
15
,
25
],
'root-margin'
:
100
,
'root-radius'
:
30
,
'root-space'
:
10
,
'main-color'
:
'#333'
,
'main-background'
:
'#a4c5c0'
,
'main-stroke'
:
'none'
,
'main-font-size'
:
16
,
'main-padding'
:
[
6
,
20
],
'main-margin'
:
[
30
,
0
,
10
,
0
],
'main-radius'
:
10
,
'main-space'
:
5
,
'sub-color'
:
'black'
,
'sub-background'
:
'white'
,
'sub-stroke'
:
'none'
,
'sub-font-size'
:
12
,
'sub-padding'
:
[
5
,
10
],
'sub-margin'
:
[
5
,
15
,
10
,
5
],
'sub-radius'
:
5
,
'sub-space'
:
5
,
'connect-color'
:
'white'
,
'connect-width'
:
2
,
'connect-radius'
:
5
,
'selected-background'
:
'rgb(254, 219, 0)'
});
\ No newline at end of file
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