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
866f4d76
Commit
866f4d76
authored
Jan 20, 2014
by
campaign
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
53e8d6ab
e72b2f30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
dev.html
demo/dev.html
+1
-1
layout.default.js
src/module/layout.default.js
+12
-12
No files found.
demo/dev.html
View file @
866f4d76
...
@@ -17,6 +17,6 @@
...
@@ -17,6 +17,6 @@
<script>
<script>
minder
=
KM
.
createMinder
(
kityminder
);
minder
=
KM
.
createMinder
(
kityminder
);
//minder.execCommand("switchlayout","green");
//minder.execCommand("switchlayout","green");
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
(
"test"
));
//
minder.execCommand("appendchildnode",new MinderNode("test"));
</script>
</script>
</html>
</html>
\ No newline at end of file
src/module/layout.default.js
View file @
866f4d76
...
@@ -286,8 +286,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -286,8 +286,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
prt
=
prt
.
getParent
();
prt
=
prt
.
getParent
();
}
while
(
prt
);
}
while
(
prt
);
//遍历
//遍历
var
effectRange
=
[
root
];
var
_buffer
=
[
root
];
var
_buffer
=
effectRange
;
while
(
_buffer
.
length
!==
0
)
{
while
(
_buffer
.
length
!==
0
)
{
_buffer
=
_buffer
.
concat
(
countY
(
_buffer
[
0
],
appendside
)
);
_buffer
=
_buffer
.
concat
(
countY
(
_buffer
[
0
],
appendside
)
);
effectSet
.
push
(
_buffer
[
0
]
);
effectSet
.
push
(
_buffer
[
0
]
);
...
@@ -299,9 +298,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -299,9 +298,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
//以某个节点为seed对水平方向进行调整(包括调整子树)
//以某个节点为seed对水平方向进行调整(包括调整子树)
var
updateLayoutHorizon
=
function
(
node
)
{
var
updateLayoutHorizon
=
function
(
node
)
{
var
nodeLayout
=
node
.
getData
(
"layout"
);
var
effectSet
=
[
node
];
//返回受影响(即需要进行下一步translate的节点)
var
effectSet
=
[
node
];
//返回受影响(即需要进行下一步translate的节点)
var
parent
=
node
.
getParent
();
var
parent
=
node
.
getParent
();
var
appendside
=
node
.
getData
(
"appendside"
)
;
var
appendside
=
node
Layout
.
appendside
;
var
selfWidth
=
node
.
getRenderContainer
().
getWidth
();
var
selfWidth
=
node
.
getRenderContainer
().
getWidth
();
var
countX
=
function
(
n
)
{
var
countX
=
function
(
n
)
{
...
@@ -333,13 +333,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -333,13 +333,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
countX
(
node
);
countX
(
node
);
}
}
//判断是否存在已绘制的孩子并对孩子位置进行调整(用于外部调用renderNode,如文本编时)
//判断是否存在已绘制的孩子并对孩子位置进行调整(用于外部调用renderNode,如文本编时)
var
_buffer
=
node
.
getChildren
();
//
var _buffer = node.getChildren();
while
(
_buffer
.
length
!==
0
)
{
//
while ( _buffer.length !== 0 ) {
countX
(
_buffer
[
0
]
);
//
countX( _buffer[ 0 ] );
effectSet
.
push
(
_buffer
[
0
]
);
//
effectSet.push( _buffer[ 0 ] );
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
//
_buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
_buffer
.
shift
();
//
_buffer.shift();
}
//
}
return
effectSet
;
return
effectSet
;
};
};
...
@@ -361,7 +361,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -361,7 +361,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
nodeShape
.
setTransform
(
new
kity
.
Matrix
().
translate
(
Layout
.
x
,
Layout
.
y
-
_rectHeight
/
2
)
);
nodeShape
.
setTransform
(
new
kity
.
Matrix
().
translate
(
Layout
.
x
,
Layout
.
y
-
_rectHeight
/
2
)
);
break
;
break
;
}
}
updateConnect
(
minder
,
node
);
};
};
var
_style
=
{
var
_style
=
{
renderNode
:
function
(
node
)
{
renderNode
:
function
(
node
)
{
...
@@ -411,8 +410,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -411,8 +410,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
if
(
parent
.
getChildren
().
indexOf
(
node
)
===
-
1
)
{
if
(
parent
.
getChildren
().
indexOf
(
node
)
===
-
1
)
{
if
(
!
index
)
parent
.
appendChild
(
node
);
if
(
!
index
)
parent
.
appendChild
(
node
);
else
parent
.
insertChild
(
node
,
index
);
else
parent
.
insertChild
(
node
,
index
);
minder
.
handelNodeInsert
(
node
);
}
}
minder
.
handelNodeInsert
(
node
);
if
(
parent
===
root
)
{
if
(
parent
===
root
)
{
var
leftList
=
parentLayout
.
leftList
;
var
leftList
=
parentLayout
.
leftList
;
var
rightList
=
parentLayout
.
rightList
;
var
rightList
=
parentLayout
.
rightList
;
...
@@ -437,6 +436,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -437,6 +436,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
else
{
}
else
{
Layout
.
align
=
"left"
;
Layout
.
align
=
"left"
;
}
}
drawNode
(
node
);
drawNode
(
node
);
var
set1
=
updateLayoutVertical
(
node
,
parent
,
"append"
);
var
set1
=
updateLayoutVertical
(
node
,
parent
,
"append"
);
var
set2
=
updateLayoutHorizon
(
node
);
var
set2
=
updateLayoutHorizon
(
node
);
...
...
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