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
fdd070dd
Commit
fdd070dd
authored
Jun 24, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix layout bug
parent
b9015627
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
layout.js
src/core/layout.js
+2
-1
node.js
src/core/node.js
+8
-9
No files found.
src/core/layout.js
View file @
fdd070dd
...
@@ -144,9 +144,10 @@ kity.extendClass(Minder, {
...
@@ -144,9 +144,10 @@ kity.extendClass(Minder, {
root
=
root
||
this
.
getRoot
();
root
=
root
||
this
.
getRoot
();
// traverse without root
root
.
traverse
(
function
(
node
)
{
root
.
traverse
(
function
(
node
)
{
node
.
setLayoutTransform
(
null
);
node
.
setLayoutTransform
(
null
);
});
}
,
true
);
function
layoutNode
(
node
)
{
function
layoutNode
(
node
)
{
...
...
src/core/node.js
View file @
fdd070dd
...
@@ -113,11 +113,11 @@ var MinderNode = KityMinder.MinderNode = kity.createClass('MinderNode', {
...
@@ -113,11 +113,11 @@ var MinderNode = KityMinder.MinderNode = kity.createClass('MinderNode', {
* 先序遍历当前节点树
* 先序遍历当前节点树
* @param {Function} fn 遍历函数
* @param {Function} fn 遍历函数
*/
*/
preTraverse
:
function
(
fn
)
{
preTraverse
:
function
(
fn
,
excludeThis
)
{
var
children
=
this
.
getChildren
();
var
children
=
this
.
getChildren
();
var
value
=
fn
(
this
);
if
(
!
excludeThis
)
fn
(
this
);
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
value
=
children
[
i
].
preTraverse
(
fn
,
value
);
children
[
i
].
preTraverse
(
fn
);
}
}
},
},
...
@@ -125,17 +125,16 @@ var MinderNode = KityMinder.MinderNode = kity.createClass('MinderNode', {
...
@@ -125,17 +125,16 @@ var MinderNode = KityMinder.MinderNode = kity.createClass('MinderNode', {
* 后序遍历当前节点树
* 后序遍历当前节点树
* @param {Function} fn 遍历函数
* @param {Function} fn 遍历函数
*/
*/
postTraverse
:
function
(
fn
)
{
postTraverse
:
function
(
fn
,
excludeThis
)
{
var
children
=
this
.
getChildren
();
var
children
=
this
.
getChildren
();
var
value
;
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
value
=
children
[
i
].
postTraverse
(
fn
,
value
);
children
[
i
].
postTraverse
(
fn
);
}
}
fn
(
this
,
value
);
if
(
!
excludeThis
)
fn
(
this
);
},
},
traverse
:
function
(
fn
)
{
traverse
:
function
(
fn
,
excludeThis
)
{
return
this
.
postTraverse
(
fn
);
return
this
.
postTraverse
(
fn
,
excludeThis
);
},
},
getChildren
:
function
()
{
getChildren
:
function
()
{
...
...
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