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
fd1779cc
Commit
fd1779cc
authored
Feb 13, 2014
by
campaign
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
342ffba9
22e0fbeb
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
66 deletions
+69
-66
dev.html
demo/dev.html
+10
-2
kity
kity
+1
-1
layout.default.js
src/module/layout.default.js
+42
-39
layout.js
src/module/layout.js
+6
-13
kityminder.css
themes/default/_css/kityminder.css
+10
-11
No files found.
demo/dev.html
View file @
fd1779cc
...
@@ -10,15 +10,23 @@
...
@@ -10,15 +10,23 @@
<link
href=
"../themes/default/_css/import.css"
type=
"text/css"
rel=
"stylesheet"
>
<link
href=
"../themes/default/_css/import.css"
type=
"text/css"
rel=
"stylesheet"
>
<style>
<style>
.km_receiver
{
.km_receiver
{
width
:
300px
;
height
:
300px
;
width
:
0
;
height
:
0
;
}
}
.km-minderNode
{
.km-minderNode
{
cursor
:
default
;
cursor
:
default
;
}
}
.kmui-container
{
height
:
100%
;
}
html
,
body
,
div
{
margin
:
0
;
padding
:
0
;
}
</style>
</style>
</head>
</head>
<body
>
<body
>
<div
id=
"kityminder"
style=
"height:100
0px
;width:100%"
onselectstart=
"return false"
>
<div
id=
"kityminder"
style=
"height:100
%
;width:100%"
onselectstart=
"return false"
>
</div>
</div>
</body>
</body>
<script>
<script>
...
...
kity
@
1140e977
Subproject commit 1
c5434e295dae9cad0f39248c9071ed99227cb33
Subproject commit 1
140e977283ecc038ea444dd1186eb77c59510fb
src/module/layout.default.js
View file @
fd1779cc
...
@@ -44,7 +44,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -44,7 +44,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
},
},
update
:
function
()
{
update
:
function
()
{
var
node
=
this
.
_node
;
var
node
=
this
.
_node
;
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
var
nodeShape
=
node
.
getRenderContainer
();
var
nodeShape
=
node
.
getRenderContainer
();
var
nodeX
,
nodeY
=
(
node
.
getType
()
===
"main"
?
Layout
.
y
:
(
Layout
.
y
+
nodeShape
.
getHeight
()
/
2
-
5
)
);
var
nodeX
,
nodeY
=
(
node
.
getType
()
===
"main"
?
Layout
.
y
:
(
Layout
.
y
+
nodeShape
.
getHeight
()
/
2
-
5
)
);
if
(
Layout
.
appendside
===
"left"
)
{
if
(
Layout
.
appendside
===
"left"
)
{
...
@@ -81,6 +81,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -81,6 +81,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
highlight
:
"chocolate"
highlight
:
"chocolate"
},
},
"main"
:
{
"main"
:
{
stroke
:
new
kity
.
Pen
(
"white"
,
2
).
setLineCap
(
"round"
).
setLineJoin
(
"round"
),
fill
:
"white"
,
fill
:
"white"
,
color
:
"#333"
,
color
:
"#333"
,
padding
:
[
5.5
,
20
,
5.5
,
20
],
padding
:
[
5.5
,
20
,
5.5
,
20
],
...
@@ -90,10 +91,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -90,10 +91,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
highlight
:
"chocolate"
highlight
:
"chocolate"
},
},
"sub"
:
{
"sub"
:
{
stroke
:
new
kity
.
Pen
(
"white"
,
1
).
setLineCap
(
"round"
).
setLineJoin
(
"round"
),
stroke
:
new
kity
.
Pen
(
"white"
,
2
).
setLineCap
(
"round"
).
setLineJoin
(
"round"
),
color
:
"white"
,
color
:
"white"
,
fontSize
:
12
,
fontSize
:
12
,
margin
:
[
0
,
10
,
20
,
5
],
margin
:
[
0
,
10
,
20
,
6
],
padding
:
[
5
,
10
,
5.5
,
10
],
padding
:
[
5
,
10
,
5.5
,
10
],
highlight
:
"chocolate"
highlight
:
"chocolate"
}
}
...
@@ -102,7 +103,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -102,7 +103,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
updateBg
=
function
(
node
)
{
var
updateBg
=
function
(
node
)
{
var
nodeType
=
node
.
getType
();
var
nodeType
=
node
.
getType
();
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
switch
(
node
.
getType
()
)
{
switch
(
node
.
getType
()
)
{
case
"root"
:
case
"root"
:
case
"main"
:
case
"main"
:
...
@@ -120,7 +121,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -120,7 +121,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
};
};
//初始化样式
//初始化样式
var
initLayout
=
function
(
node
)
{
var
initLayout
=
function
(
node
)
{
var
Layout
=
node
.
get
Data
(
"layout"
)
||
{}
;
var
Layout
=
node
.
get
Layout
()
;
var
nodeType
=
node
.
getType
();
var
nodeType
=
node
.
getType
();
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
txtShape
=
node
.
getTextShape
();
var
txtShape
=
node
.
getTextShape
();
...
@@ -131,7 +132,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -131,7 +132,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
Layout
.
leftHeight
=
0
;
Layout
.
leftHeight
=
0
;
Layout
.
rightHeight
=
0
;
Layout
.
rightHeight
=
0
;
}
}
minder
.
highlightNode
(
node
);
};
};
//根据内容调整节点尺寸
//根据内容调整节点尺寸
var
updateShapeByCont
=
function
(
node
)
{
var
updateShapeByCont
=
function
(
node
)
{
...
@@ -140,7 +140,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -140,7 +140,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
_contRCWidth
=
contRc
.
getWidth
();
var
_contRCWidth
=
contRc
.
getWidth
();
var
_contRCHeight
=
contRc
.
getHeight
();
var
_contRCHeight
=
contRc
.
getHeight
();
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
switch
(
nodeType
)
{
switch
(
nodeType
)
{
case
"root"
:
case
"root"
:
case
"main"
:
case
"main"
:
...
@@ -151,6 +151,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -151,6 +151,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
_contWidth
=
contRc
.
getWidth
();
var
_contWidth
=
contRc
.
getWidth
();
var
_contHeight
=
contRc
.
getHeight
();
var
_contHeight
=
contRc
.
getHeight
();
Layout
.
underline
.
getDrawer
()
Layout
.
underline
.
getDrawer
()
.
clear
()
.
moveTo
(
0
,
_contHeight
+
nodeStyle
.
padding
[
2
]
+
nodeStyle
.
padding
[
0
]
)
.
moveTo
(
0
,
_contHeight
+
nodeStyle
.
padding
[
2
]
+
nodeStyle
.
padding
[
0
]
)
.
lineTo
(
_contWidth
+
nodeStyle
.
padding
[
1
]
+
nodeStyle
.
padding
[
3
],
_contHeight
+
nodeStyle
.
padding
[
2
]
+
nodeStyle
.
padding
[
0
]
);
.
lineTo
(
_contWidth
+
nodeStyle
.
padding
[
1
]
+
nodeStyle
.
padding
[
3
],
_contHeight
+
nodeStyle
.
padding
[
2
]
+
nodeStyle
.
padding
[
0
]
);
Layout
.
underline
.
stroke
(
nodeStyle
.
stroke
);
Layout
.
underline
.
stroke
(
nodeStyle
.
stroke
);
...
@@ -170,7 +171,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -170,7 +171,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
if
(
action
===
"remove"
)
{
if
(
action
===
"remove"
)
{
effectSet
=
[];
effectSet
=
[];
}
}
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
var
nodeShape
=
node
.
getRenderContainer
();
var
nodeShape
=
node
.
getRenderContainer
();
var
nodeType
=
node
.
getType
();
var
nodeType
=
node
.
getType
();
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
nodeStyle
=
nodeStyles
[
nodeType
];
...
@@ -184,10 +185,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -184,10 +185,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
if
(
!
side
)
{
if
(
!
side
)
{
children
=
node
.
getChildren
();
children
=
node
.
getChildren
();
}
else
{
}
else
{
children
=
node
.
get
Data
(
"layout"
)[
side
+
"List"
];
children
=
node
.
get
Layout
(
)[
side
+
"List"
];
}
}
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
var
childLayout
=
children
[
i
].
get
Data
(
"layout"
);
var
childLayout
=
children
[
i
].
get
Layout
(
);
if
(
children
[
i
].
getRenderContainer
().
getHeight
()
!==
0
)
if
(
children
[
i
].
getRenderContainer
().
getHeight
()
!==
0
)
sum
+=
childLayout
.
branchheight
;
sum
+=
childLayout
.
branchheight
;
}
}
...
@@ -208,12 +209,12 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -208,12 +209,12 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
else
if
(
action
===
"change"
)
{
//展开
}
else
if
(
action
===
"change"
)
{
//展开
Layout
.
branchheight
=
countBranchHeight
(
node
);
Layout
.
branchheight
=
countBranchHeight
(
node
);
}
}
var
parentLayout
=
parent
.
get
Data
(
"layout"
);
var
parentLayout
=
parent
.
get
Layout
(
);
var
parentShape
=
parent
.
getRenderContainer
();
var
parentShape
=
parent
.
getRenderContainer
();
var
prt
=
node
.
getParent
()
||
parent
;
var
prt
=
node
.
getParent
()
||
parent
;
//自底向上更新祖先元素的branchheight值
//自底向上更新祖先元素的branchheight值
while
(
prt
)
{
while
(
prt
)
{
var
prtLayout
=
prt
.
get
Data
(
"layout"
);
var
prtLayout
=
prt
.
get
Layout
(
);
if
(
prt
.
getType
()
===
"root"
)
{
if
(
prt
.
getType
()
===
"root"
)
{
prtLayout
[
appendside
+
"Height"
]
=
countBranchHeight
(
prt
,
appendside
);
prtLayout
[
appendside
+
"Height"
]
=
countBranchHeight
(
prt
,
appendside
);
}
else
{
}
else
{
...
@@ -222,15 +223,15 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -222,15 +223,15 @@ KityMinder.registerModule( "LayoutDefault", function () {
prt
=
prt
.
getParent
();
prt
=
prt
.
getParent
();
}
}
//自顶向下更新受影响一侧的y值
//自顶向下更新受影响一侧的y值
var
sideList
=
root
.
get
Data
(
"layout"
)[
appendside
+
"List"
];
var
sideList
=
root
.
get
Layout
(
)[
appendside
+
"List"
];
var
_buffer
=
[
root
];
var
_buffer
=
[
root
];
while
(
_buffer
.
length
>
0
)
{
while
(
_buffer
.
length
>
0
)
{
var
_buffer0Layout
=
_buffer
[
0
].
get
Data
(
"layout"
);
var
_buffer0Layout
=
_buffer
[
0
].
get
Layout
(
);
var
children
=
_buffer0Layout
[
appendside
+
"List"
]
||
_buffer
[
0
].
getChildren
();
var
children
=
_buffer0Layout
[
appendside
+
"List"
]
||
_buffer
[
0
].
getChildren
();
_buffer
=
_buffer
.
concat
(
children
);
_buffer
=
_buffer
.
concat
(
children
);
var
sY
=
_buffer0Layout
.
y
-
(
_buffer0Layout
[
appendside
+
"Height"
]
||
_buffer0Layout
.
branchheight
)
/
2
;
var
sY
=
_buffer0Layout
.
y
-
(
_buffer0Layout
[
appendside
+
"Height"
]
||
_buffer0Layout
.
branchheight
)
/
2
;
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
var
childLayout
=
children
[
i
].
get
Data
(
"layout"
);
var
childLayout
=
children
[
i
].
get
Layout
(
);
childLayout
.
y
=
sY
+
childLayout
.
branchheight
/
2
;
childLayout
.
y
=
sY
+
childLayout
.
branchheight
/
2
;
sY
+=
childLayout
.
branchheight
;
sY
+=
childLayout
.
branchheight
;
}
}
...
@@ -245,7 +246,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -245,7 +246,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
nodeType
=
node
.
getType
();
var
nodeType
=
node
.
getType
();
var
parent
=
node
.
getParent
();
var
parent
=
node
.
getParent
();
var
effectSet
=
[
node
];
var
effectSet
=
[
node
];
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
var
_buffer
=
[
node
];
var
_buffer
=
[
node
];
while
(
_buffer
.
length
!==
0
)
{
while
(
_buffer
.
length
!==
0
)
{
var
prt
=
_buffer
[
0
].
getParent
();
var
prt
=
_buffer
[
0
].
getParent
();
...
@@ -255,10 +256,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -255,10 +256,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
_buffer
.
shift
();
_buffer
.
shift
();
continue
;
continue
;
}
}
var
parentLayout
=
prt
.
get
Data
(
"layout"
);
var
parentLayout
=
prt
.
get
Layout
(
);
var
parentWidth
=
prt
.
getRenderContainer
().
getWidth
();
var
parentWidth
=
prt
.
getRenderContainer
().
getWidth
();
var
parentStyle
=
nodeStyles
[
prt
.
getType
()
];
var
parentStyle
=
nodeStyles
[
prt
.
getType
()
];
var
childLayout
=
_buffer
[
0
].
get
Data
(
"layout"
);
var
childLayout
=
_buffer
[
0
].
get
Layout
(
);
var
childStyle
=
nodeStyles
[
_buffer
[
0
].
getType
()
];
var
childStyle
=
nodeStyles
[
_buffer
[
0
].
getType
()
];
if
(
parentLayout
.
align
===
"center"
)
{
if
(
parentLayout
.
align
===
"center"
)
{
parentWidth
=
parentWidth
/
2
;
parentWidth
=
parentWidth
/
2
;
...
@@ -274,7 +275,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -274,7 +275,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
return
effectSet
;
return
effectSet
;
};
};
var
translateNode
=
function
(
node
)
{
var
translateNode
=
function
(
node
)
{
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
var
nodeShape
=
node
.
getRenderContainer
();
var
nodeShape
=
node
.
getRenderContainer
();
var
align
=
Layout
.
align
;
var
align
=
Layout
.
align
;
var
_rectHeight
=
nodeShape
.
getHeight
();
var
_rectHeight
=
nodeShape
.
getHeight
();
...
@@ -294,7 +295,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -294,7 +295,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
};
};
var
updateConnectAndshIcon
=
function
(
node
)
{
var
updateConnectAndshIcon
=
function
(
node
)
{
var
nodeType
=
node
.
getType
();
var
nodeType
=
node
.
getType
();
var
Layout
=
node
.
getData
(
"layout"
);
var
Layout
=
node
.
getLayout
();
var
nodeStyle
=
nodeStyles
[
node
.
getType
()
];
var
connect
;
var
connect
;
//更新连线
//更新连线
if
(
nodeType
===
"main"
)
{
if
(
nodeType
===
"main"
)
{
...
@@ -306,8 +308,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -306,8 +308,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
minder
.
getRenderContainer
().
addShape
(
connect
).
bringTop
(
minder
.
getRoot
().
getRenderContainer
()
);
minder
.
getRenderContainer
().
addShape
(
connect
).
bringTop
(
minder
.
getRoot
().
getRenderContainer
()
);
}
}
var
parent
=
minder
.
getRoot
();
var
parent
=
minder
.
getRoot
();
var
rootX
=
parent
.
get
Data
(
"layout"
).
x
;
var
rootX
=
parent
.
get
Layout
(
).
x
;
var
rootY
=
parent
.
get
Data
(
"layout"
).
y
;
var
rootY
=
parent
.
get
Layout
(
).
y
;
connect
=
Layout
.
connect
;
connect
=
Layout
.
connect
;
var
nodeShape
=
node
.
getRenderContainer
();
var
nodeShape
=
node
.
getRenderContainer
();
var
nodeClosurePoints
=
nodeShape
.
getRenderBox
().
closurePoints
;
var
nodeClosurePoints
=
nodeShape
.
getRenderBox
().
closurePoints
;
...
@@ -323,8 +325,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -323,8 +325,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
sPosV
=
sPos
.
getVertex
();
var
sPosV
=
sPos
.
getVertex
();
var
endPosV
=
endPos
.
getVertex
();
var
endPosV
=
endPos
.
getVertex
();
sPos
.
setVertex
(
rootX
,
rootY
);
sPos
.
setVertex
(
rootX
,
rootY
);
connect
.
bezier
.
setPoints
(
[
sPos
,
endPos
]
).
stroke
(
"white"
);
connect
.
bezier
.
setPoints
(
[
sPos
,
endPos
]
).
stroke
(
nodeStyle
.
stroke
);
connect
.
circle
.
setCenter
(
endPosV
.
x
+
(
Layout
.
appendside
===
"left"
?
3
:
-
3
),
endPosV
.
y
).
fill
(
"white"
).
stroke
(
"gray"
).
setRadius
(
2
);
connect
.
circle
.
setCenter
(
endPosV
.
x
+
(
Layout
.
appendside
===
"left"
?
3
:
-
3
),
endPosV
.
y
).
fill
(
"white"
).
stroke
(
"gray"
).
setRadius
(
3
);
}
else
if
(
nodeType
===
"sub"
)
{
}
else
if
(
nodeType
===
"sub"
)
{
if
(
!
Layout
.
connect
)
{
if
(
!
Layout
.
connect
)
{
connect
=
Layout
.
connect
=
new
kity
.
Path
();
connect
=
Layout
.
connect
=
new
kity
.
Path
();
...
@@ -333,8 +335,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -333,8 +335,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
connect
=
Layout
.
connect
;
connect
=
Layout
.
connect
;
var
parentShape
=
node
.
getParent
().
getRenderContainer
();
var
parentShape
=
node
.
getParent
().
getRenderContainer
();
var
parentBox
=
parentShape
.
getRenderBox
();
var
parentBox
=
parentShape
.
getRenderBox
();
var
parentLayout
=
node
.
getParent
().
getData
(
"layout"
);
var
parentLayout
=
node
.
getParent
().
getLayout
();
var
nodeStyle
=
nodeStyles
[
node
.
getType
()
];
var
parentStyle
=
nodeStyles
[
node
.
getParent
().
getType
()
];
var
parentStyle
=
nodeStyles
[
node
.
getParent
().
getType
()
];
var
Shape
=
node
.
getRenderContainer
();
var
Shape
=
node
.
getRenderContainer
();
var
sX
,
sY
=
parentLayout
.
y
;
var
sX
,
sY
=
parentLayout
.
y
;
...
@@ -374,7 +375,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -374,7 +375,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
highlight
=
node
.
getData
(
"highlight"
);
var
highlight
=
node
.
getData
(
"highlight"
);
var
nodeType
=
node
.
getType
();
var
nodeType
=
node
.
getType
();
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
switch
(
nodeType
)
{
switch
(
nodeType
)
{
case
"root"
:
case
"root"
:
case
"main"
:
case
"main"
:
...
@@ -402,6 +403,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -402,6 +403,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
this
.
_fire
(
new
MinderEvent
(
"RenderNode"
,
{
this
.
_fire
(
new
MinderEvent
(
"RenderNode"
,
{
node
:
node
node
:
node
},
false
)
);
},
false
)
);
updateShapeByCont
(
node
);
updateShapeByCont
(
node
);
var
set1
=
updateLayoutHorizon
(
node
);
var
set1
=
updateLayoutHorizon
(
node
);
var
set2
=
updateLayoutVertical
(
node
,
node
.
getParent
(),
"change"
);
var
set2
=
updateLayoutVertical
(
node
,
node
.
getParent
(),
"change"
);
...
@@ -415,7 +417,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -415,7 +417,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
_root
=
minder
.
getRoot
();
var
_root
=
minder
.
getRoot
();
minder
.
handelNodeInsert
(
_root
);
minder
.
handelNodeInsert
(
_root
);
//设置root的align
//设置root的align
_root
.
get
Data
(
"layout"
).
align
=
"center"
;
_root
.
get
Layout
(
).
align
=
"center"
;
updateBg
(
_root
);
updateBg
(
_root
);
initLayout
(
_root
);
initLayout
(
_root
);
this
.
_fire
(
new
MinderEvent
(
"beforeRenderNode"
,
{
this
.
_fire
(
new
MinderEvent
(
"beforeRenderNode"
,
{
...
@@ -435,7 +437,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -435,7 +437,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
children
=
_buffer
[
0
].
getChildren
();
var
children
=
_buffer
[
0
].
getChildren
();
_buffer
=
_buffer
.
concat
(
children
);
_buffer
=
_buffer
.
concat
(
children
);
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
children
[
i
].
get
Data
(
"layout"
).
parent
=
_buffer
[
0
];
children
[
i
].
get
Layout
(
).
parent
=
_buffer
[
0
];
}
}
_buffer
[
0
].
clearChildren
();
_buffer
[
0
].
clearChildren
();
if
(
_buffer
[
0
]
!==
_root
)
_cleanbuffer
.
push
(
_buffer
[
0
]
);
if
(
_buffer
[
0
]
!==
_root
)
_cleanbuffer
.
push
(
_buffer
[
0
]
);
...
@@ -443,15 +445,16 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -443,15 +445,16 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
}
//重组结构
//重组结构
for
(
var
j
=
0
;
j
<
_cleanbuffer
.
length
;
j
++
)
{
for
(
var
j
=
0
;
j
<
_cleanbuffer
.
length
;
j
++
)
{
this
.
appendChildNode
(
_cleanbuffer
[
j
].
get
Data
(
"layout"
).
parent
,
_cleanbuffer
[
j
]
);
this
.
appendChildNode
(
_cleanbuffer
[
j
].
get
Layout
(
).
parent
,
_cleanbuffer
[
j
]
);
}
}
},
},
appendChildNode
:
function
(
parent
,
node
,
sibling
)
{
appendChildNode
:
function
(
parent
,
node
,
sibling
)
{
minder
.
handelNodeInsert
(
node
);
minder
.
handelNodeInsert
(
node
);
var
Layout
=
node
.
getData
(
"layout"
);
node
.
clearLayout
();
var
parentLayout
=
parent
.
getData
(
"layout"
);
var
Layout
=
node
.
getLayout
();
var
parentLayout
=
parent
.
getLayout
();
if
(
sibling
)
{
if
(
sibling
)
{
var
siblingLayout
=
sibling
.
get
Data
(
"layout"
);
var
siblingLayout
=
sibling
.
get
Layout
(
);
Layout
.
appendside
=
siblingLayout
.
appendside
;
Layout
.
appendside
=
siblingLayout
.
appendside
;
Layout
.
align
=
siblingLayout
.
align
;
Layout
.
align
=
siblingLayout
.
align
;
parent
.
insertChild
(
node
,
sibling
.
getIndex
()
+
1
);
parent
.
insertChild
(
node
,
sibling
.
getIndex
()
+
1
);
...
@@ -462,7 +465,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -462,7 +465,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
}
}
else
{
}
else
{
if
(
parent
.
getType
()
!==
"root"
)
{
if
(
parent
.
getType
()
!==
"root"
)
{
var
prtLayout
=
parent
.
get
Data
(
"layout"
);
var
prtLayout
=
parent
.
get
Layout
(
);
Layout
.
appendside
=
prtLayout
.
appendside
;
Layout
.
appendside
=
prtLayout
.
appendside
;
Layout
.
align
=
prtLayout
.
align
;
Layout
.
align
=
prtLayout
.
align
;
parent
.
appendChild
(
node
);
parent
.
appendChild
(
node
);
...
@@ -527,9 +530,9 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -527,9 +530,9 @@ KityMinder.registerModule( "LayoutDefault", function () {
removeNode
:
function
(
nodes
)
{
removeNode
:
function
(
nodes
)
{
while
(
nodes
.
length
!==
0
)
{
while
(
nodes
.
length
!==
0
)
{
var
parent
=
nodes
[
0
].
getParent
();
var
parent
=
nodes
[
0
].
getParent
();
var
nodeLayout
=
nodes
[
0
].
get
Data
(
"layout"
);
var
nodeLayout
=
nodes
[
0
].
get
Layout
(
);
if
(
parent
.
getType
()
===
"root"
)
{
if
(
parent
.
getType
()
===
"root"
)
{
var
sideList
=
parent
.
get
Data
(
"layout"
)[
nodeLayout
.
appendside
+
"List"
];
var
sideList
=
parent
.
get
Layout
(
)[
nodeLayout
.
appendside
+
"List"
];
var
index
=
sideList
.
indexOf
(
nodes
[
0
]
);
var
index
=
sideList
.
indexOf
(
nodes
[
0
]
);
sideList
.
splice
(
index
,
1
);
sideList
.
splice
(
index
,
1
);
}
}
...
@@ -544,7 +547,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -544,7 +547,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
try
{
try
{
_buffer
[
0
].
getRenderContainer
().
remove
();
_buffer
[
0
].
getRenderContainer
().
remove
();
var
Layout
=
_buffer
[
0
].
get
Data
(
"layout"
);
var
Layout
=
_buffer
[
0
].
get
Layout
(
);
Layout
.
connect
.
remove
();
Layout
.
connect
.
remove
();
Layout
.
shicon
.
remove
();
Layout
.
shicon
.
remove
();
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -566,7 +569,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -566,7 +569,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
_cleanbuffer
=
[];
var
_cleanbuffer
=
[];
while
(
_buffer
.
length
!==
0
)
{
while
(
_buffer
.
length
!==
0
)
{
var
Layout
=
_buffer
[
0
].
get
Data
(
"layout"
);
var
Layout
=
_buffer
[
0
].
get
Layout
(
);
if
(
isExpand
)
{
if
(
isExpand
)
{
var
parent
=
_buffer
[
0
].
getParent
();
var
parent
=
_buffer
[
0
].
getParent
();
Layout
.
parent
=
parent
;
Layout
.
parent
=
parent
;
...
@@ -586,7 +589,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -586,7 +589,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
node
.
clearChildren
();
node
.
clearChildren
();
for
(
var
j
=
0
;
j
<
_cleanbuffer
.
length
;
j
++
)
{
for
(
var
j
=
0
;
j
<
_cleanbuffer
.
length
;
j
++
)
{
_cleanbuffer
[
j
].
clearChildren
();
_cleanbuffer
[
j
].
clearChildren
();
minder
.
appendChildNode
(
_cleanbuffer
[
j
].
get
Data
(
"layout"
).
parent
,
_cleanbuffer
[
j
]
);
minder
.
appendChildNode
(
_cleanbuffer
[
j
].
get
Layout
(
).
parent
,
_cleanbuffer
[
j
]
);
}
}
}
}
var
set
=
[];
var
set
=
[];
...
...
src/module/layout.js
View file @
fd1779cc
...
@@ -58,35 +58,28 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -58,35 +58,28 @@ KityMinder.registerModule( "LayoutModule", function () {
}
);
}
);
kity
.
extendClass
(
MinderNode
,
{
kity
.
extendClass
(
MinderNode
,
{
setLayout
:
function
(
k
,
v
)
{
setLayout
:
function
(
k
,
v
)
{
if
(
this
.
setData
(
'layout'
)
===
undefined
)
{
if
(
this
.
_layout
===
undefined
)
{
this
.
setData
(
'layout'
,
{}
)
;
this
.
_layout
=
{}
;
}
}
var
_pros
=
this
.
getLayout
();
var
_pros
=
this
.
getLayout
();
Utils
.
extend
(
_pros
,
{
Utils
.
extend
(
_pros
,
{
k
:
v
k
:
v
}
);
}
);
this
.
setData
(
'layout'
,
_pros
)
;
this
.
_layout
=
_pros
;
},
},
getLayout
:
function
(
k
)
{
getLayout
:
function
(
k
)
{
if
(
k
===
undefined
)
{
if
(
k
===
undefined
)
{
return
this
.
getData
(
'layout'
)
;
return
this
.
_layout
;
}
}
return
this
.
getData
(
'layout'
)
[
k
];
return
this
.
_layout
[
k
];
},
},
clearLayout
:
function
()
{
clearLayout
:
function
()
{
this
.
setData
(
'layout'
,
{}
);
this
.
_layout
=
{};
},
setHide
:
function
(
isHide
)
{
this
.
setData
(
"hide"
,
isHide
);
},
isHide
:
function
()
{
return
this
.
getData
(
"hide"
);
}
}
}
);
}
);
var
switchLayout
=
function
(
km
,
style
)
{
var
switchLayout
=
function
(
km
,
style
)
{
var
_root
=
km
.
getRoot
();
var
_root
=
km
.
getRoot
();
_root
.
preTraverse
(
function
(
n
)
{
_root
.
preTraverse
(
function
(
n
)
{
//n.clearLayout();
n
.
setPoint
();
n
.
setPoint
();
n
.
getBgRc
().
clear
();
n
.
getBgRc
().
clear
();
}
);
}
);
...
...
themes/default/_css/kityminder.css
View file @
fd1779cc
.kmui-container
{
.kmui-container
{
position
:
relative
;
border
:
1px
solid
#d4d4d4
;
box-shadow
:
2px
2px
5px
#d3d6da
;
background-color
:
#fff
;
}
}
.kmui-container
.kmui-toolbar
{
.kmui-container
.kmui-toolbar
{
position
:
relative
;
width
:
auto
;
border-bottom
:
1px
solid
#e1e1e1
;
box-shadow
:
2px
2px
5px
#d3d6da
;
background-color
:
#fafafa
;
background-color
:
#fafafa
;
z-index
:
99999
;
z-index
:
99999
;
}
}
.kmui-toolbar
.kmui-btn-toolbar
{
.kmui-toolbar
.kmui-btn-toolbar
{
position
:
relative
;
padding
:
5px
;
padding
:
5px
;
}
}
.kmui-toolbar
{
position
:
absolute
;
left
:
10px
;
top
:
10px
;
border-radius
:
4px
;
}
.kmui-container
.kmui-editor-body
{
.kmui-container
.kmui-editor-body
{
background-color
:
#000000
;
background-color
:
#333
;
line-height
:
0
;
overflow
:
hidden
;
}
}
\ 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