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
9ad9e96b
Commit
9ad9e96b
authored
Feb 13, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed getData(layout) into getLayout()
parent
edb81a8e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
34 deletions
+34
-34
kity
kity
+1
-1
layout.default.js
src/module/layout.default.js
+33
-33
No files found.
kity
@
1bfcdd71
Subproject commit 1
c5434e295dae9cad0f39248c9071ed99227cb33
Subproject commit 1
bfcdd712725d25d54bfe88d0ee0fac6ee33830a
src/module/layout.default.js
View file @
9ad9e96b
...
...
@@ -44,7 +44,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
},
update
:
function
()
{
var
node
=
this
.
_node
;
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
var
nodeShape
=
node
.
getRenderContainer
();
var
nodeX
,
nodeY
=
(
node
.
getType
()
===
"main"
?
Layout
.
y
:
(
Layout
.
y
+
nodeShape
.
getHeight
()
/
2
-
5
)
);
if
(
Layout
.
appendside
===
"left"
)
{
...
...
@@ -102,7 +102,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
updateBg
=
function
(
node
)
{
var
nodeType
=
node
.
getType
();
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
switch
(
node
.
getType
()
)
{
case
"root"
:
case
"main"
:
...
...
@@ -120,7 +120,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
};
//初始化样式
var
initLayout
=
function
(
node
)
{
var
Layout
=
node
.
get
Data
(
"layout"
)
||
{}
;
var
Layout
=
node
.
get
Layout
()
;
var
nodeType
=
node
.
getType
();
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
txtShape
=
node
.
getTextShape
();
...
...
@@ -140,7 +140,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
_contRCWidth
=
contRc
.
getWidth
();
var
_contRCHeight
=
contRc
.
getHeight
();
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
switch
(
nodeType
)
{
case
"root"
:
case
"main"
:
...
...
@@ -171,7 +171,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
if
(
action
===
"remove"
)
{
effectSet
=
[];
}
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
var
nodeShape
=
node
.
getRenderContainer
();
var
nodeType
=
node
.
getType
();
var
nodeStyle
=
nodeStyles
[
nodeType
];
...
...
@@ -185,10 +185,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
if
(
!
side
)
{
children
=
node
.
getChildren
();
}
else
{
children
=
node
.
get
Data
(
"layout"
)[
side
+
"List"
];
children
=
node
.
get
Layout
(
)[
side
+
"List"
];
}
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
)
sum
+=
childLayout
.
branchheight
;
}
...
...
@@ -209,12 +209,12 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
else
if
(
action
===
"change"
)
{
//展开
Layout
.
branchheight
=
countBranchHeight
(
node
);
}
var
parentLayout
=
parent
.
get
Data
(
"layout"
);
var
parentLayout
=
parent
.
get
Layout
(
);
var
parentShape
=
parent
.
getRenderContainer
();
var
prt
=
node
.
getParent
()
||
parent
;
//自底向上更新祖先元素的branchheight值
while
(
prt
)
{
var
prtLayout
=
prt
.
get
Data
(
"layout"
);
var
prtLayout
=
prt
.
get
Layout
(
);
if
(
prt
.
getType
()
===
"root"
)
{
prtLayout
[
appendside
+
"Height"
]
=
countBranchHeight
(
prt
,
appendside
);
}
else
{
...
...
@@ -223,15 +223,15 @@ KityMinder.registerModule( "LayoutDefault", function () {
prt
=
prt
.
getParent
();
}
//自顶向下更新受影响一侧的y值
var
sideList
=
root
.
get
Data
(
"layout"
)[
appendside
+
"List"
];
var
sideList
=
root
.
get
Layout
(
)[
appendside
+
"List"
];
var
_buffer
=
[
root
];
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
();
_buffer
=
_buffer
.
concat
(
children
);
var
sY
=
_buffer0Layout
.
y
-
(
_buffer0Layout
[
appendside
+
"Height"
]
||
_buffer0Layout
.
branchheight
)
/
2
;
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
;
sY
+=
childLayout
.
branchheight
;
}
...
...
@@ -246,7 +246,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
nodeType
=
node
.
getType
();
var
parent
=
node
.
getParent
();
var
effectSet
=
[
node
];
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
var
_buffer
=
[
node
];
while
(
_buffer
.
length
!==
0
)
{
var
prt
=
_buffer
[
0
].
getParent
();
...
...
@@ -256,10 +256,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
_buffer
.
shift
();
continue
;
}
var
parentLayout
=
prt
.
get
Data
(
"layout"
);
var
parentLayout
=
prt
.
get
Layout
(
);
var
parentWidth
=
prt
.
getRenderContainer
().
getWidth
();
var
parentStyle
=
nodeStyles
[
prt
.
getType
()
];
var
childLayout
=
_buffer
[
0
].
get
Data
(
"layout"
);
var
childLayout
=
_buffer
[
0
].
get
Layout
(
);
var
childStyle
=
nodeStyles
[
_buffer
[
0
].
getType
()
];
if
(
parentLayout
.
align
===
"center"
)
{
parentWidth
=
parentWidth
/
2
;
...
...
@@ -275,7 +275,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
return
effectSet
;
};
var
translateNode
=
function
(
node
)
{
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
var
nodeShape
=
node
.
getRenderContainer
();
var
align
=
Layout
.
align
;
var
_rectHeight
=
nodeShape
.
getHeight
();
...
...
@@ -295,7 +295,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
};
var
updateConnectAndshIcon
=
function
(
node
)
{
var
nodeType
=
node
.
getType
();
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
var
connect
;
//更新连线
if
(
nodeType
===
"main"
)
{
...
...
@@ -307,8 +307,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
minder
.
getRenderContainer
().
addShape
(
connect
).
bringTop
(
minder
.
getRoot
().
getRenderContainer
()
);
}
var
parent
=
minder
.
getRoot
();
var
rootX
=
parent
.
get
Data
(
"layout"
).
x
;
var
rootY
=
parent
.
get
Data
(
"layout"
).
y
;
var
rootX
=
parent
.
get
Layout
(
).
x
;
var
rootY
=
parent
.
get
Layout
(
).
y
;
connect
=
Layout
.
connect
;
var
nodeShape
=
node
.
getRenderContainer
();
var
nodeClosurePoints
=
nodeShape
.
getRenderBox
().
closurePoints
;
...
...
@@ -334,7 +334,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
connect
=
Layout
.
connect
;
var
parentShape
=
node
.
getParent
().
getRenderContainer
();
var
parentBox
=
parentShape
.
getRenderBox
();
var
parentLayout
=
node
.
getParent
().
get
Data
(
"layout"
);
var
parentLayout
=
node
.
getParent
().
get
Layout
(
);
var
nodeStyle
=
nodeStyles
[
node
.
getType
()
];
var
parentStyle
=
nodeStyles
[
node
.
getParent
().
getType
()
];
var
Shape
=
node
.
getRenderContainer
();
...
...
@@ -375,7 +375,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
highlight
=
node
.
getData
(
"highlight"
);
var
nodeType
=
node
.
getType
();
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
Layout
=
node
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
switch
(
nodeType
)
{
case
"root"
:
case
"main"
:
...
...
@@ -417,7 +417,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
_root
=
minder
.
getRoot
();
minder
.
handelNodeInsert
(
_root
);
//设置root的align
_root
.
get
Data
(
"layout"
).
align
=
"center"
;
_root
.
get
Layout
(
).
align
=
"center"
;
updateBg
(
_root
);
initLayout
(
_root
);
this
.
_fire
(
new
MinderEvent
(
"beforeRenderNode"
,
{
...
...
@@ -437,7 +437,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
children
=
_buffer
[
0
].
getChildren
();
_buffer
=
_buffer
.
concat
(
children
);
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
();
if
(
_buffer
[
0
]
!==
_root
)
_cleanbuffer
.
push
(
_buffer
[
0
]
);
...
...
@@ -445,15 +445,15 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
//重组结构
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
)
{
minder
.
handelNodeInsert
(
node
);
var
Layout
=
node
.
get
Data
(
"layout"
);
var
parentLayout
=
parent
.
get
Data
(
"layout"
);
var
Layout
=
node
.
get
Layout
(
);
var
parentLayout
=
parent
.
get
Layout
(
);
if
(
sibling
)
{
var
siblingLayout
=
sibling
.
get
Data
(
"layout"
);
var
siblingLayout
=
sibling
.
get
Layout
(
);
Layout
.
appendside
=
siblingLayout
.
appendside
;
Layout
.
align
=
siblingLayout
.
align
;
parent
.
insertChild
(
node
,
sibling
.
getIndex
()
+
1
);
...
...
@@ -464,7 +464,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
}
else
{
if
(
parent
.
getType
()
!==
"root"
)
{
var
prtLayout
=
parent
.
get
Data
(
"layout"
);
var
prtLayout
=
parent
.
get
Layout
(
);
Layout
.
appendside
=
prtLayout
.
appendside
;
Layout
.
align
=
prtLayout
.
align
;
parent
.
appendChild
(
node
);
...
...
@@ -529,9 +529,9 @@ KityMinder.registerModule( "LayoutDefault", function () {
removeNode
:
function
(
nodes
)
{
while
(
nodes
.
length
!==
0
)
{
var
parent
=
nodes
[
0
].
getParent
();
var
nodeLayout
=
nodes
[
0
].
get
Data
(
"layout"
);
var
nodeLayout
=
nodes
[
0
].
get
Layout
(
);
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
]
);
sideList
.
splice
(
index
,
1
);
}
...
...
@@ -546,7 +546,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
try
{
_buffer
[
0
].
getRenderContainer
().
remove
();
var
Layout
=
_buffer
[
0
].
get
Data
(
"layout"
);
var
Layout
=
_buffer
[
0
].
get
Layout
(
);
Layout
.
connect
.
remove
();
Layout
.
shicon
.
remove
();
}
catch
(
error
)
{
...
...
@@ -568,7 +568,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
_cleanbuffer
=
[];
while
(
_buffer
.
length
!==
0
)
{
var
Layout
=
_buffer
[
0
].
get
Data
(
"layout"
);
var
Layout
=
_buffer
[
0
].
get
Layout
(
);
if
(
isExpand
)
{
var
parent
=
_buffer
[
0
].
getParent
();
Layout
.
parent
=
parent
;
...
...
@@ -588,7 +588,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
node
.
clearChildren
();
for
(
var
j
=
0
;
j
<
_cleanbuffer
.
length
;
j
++
)
{
_cleanbuffer
[
j
].
clearChildren
();
minder
.
appendChildNode
(
_cleanbuffer
[
j
].
get
Data
(
"layout"
).
parent
,
_cleanbuffer
[
j
]
);
minder
.
appendChildNode
(
_cleanbuffer
[
j
].
get
Layout
(
).
parent
,
_cleanbuffer
[
j
]
);
}
}
var
set
=
[];
...
...
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