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
2da7edb5
Commit
2da7edb5
authored
May 07, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recover history
parent
6810fcd8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
60 deletions
+42
-60
layout.default.js
src/module/layout.default.js
+42
-60
No files found.
src/module/layout.default.js
View file @
2da7edb5
...
@@ -510,7 +510,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -510,7 +510,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
},
},
initStyle
:
function
(
expandall
)
{
initStyle
:
function
(
expandall
)
{
var
_root
=
minder
.
getRoot
();
var
_root
=
minder
.
getRoot
();
console
.
log
(
_root
.
getLayout
()
);
var
historyPoint
=
_root
.
getPoint
();
var
historyPoint
=
_root
.
getPoint
();
if
(
historyPoint
)
historyPoint
=
JSON
.
parse
(
JSON
.
stringify
(
historyPoint
)
);
if
(
historyPoint
)
historyPoint
=
JSON
.
parse
(
JSON
.
stringify
(
historyPoint
)
);
minder
.
handelNodeInsert
(
_root
);
minder
.
handelNodeInsert
(
_root
);
...
@@ -542,74 +541,58 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -542,74 +541,58 @@ KityMinder.registerModule( "LayoutDefault", function () {
updateLayoutVertical
(
_root
);
updateLayoutVertical
(
_root
);
translateNode
(
_root
);
translateNode
(
_root
);
if
(
historyPoint
)
_root
.
setPoint
(
historyPoint
.
x
,
historyPoint
.
y
);
if
(
historyPoint
)
_root
.
setPoint
(
historyPoint
.
x
,
historyPoint
.
y
);
var
_buffer
=
[
_root
];
var
expandoptions
=
minder
.
getOptions
(
'defaultExpand'
);
var
cur_layer
=
0
;
var
expand_layer
=
expandoptions
.
defaultLayer
;
var
mains
=
_root
.
getChildren
();
for
(
var
i
=
0
;
i
<
mains
.
length
;
i
++
)
{
this
.
appendChildNode
(
_root
,
mains
[
i
]
);
}
cur_layer
++
;
var
clonelayer0
=
function
()
{
var
items
=
[];
for
(
var
i
=
0
;
i
<
mains
.
length
;
i
++
)
{
items
.
push
(
mains
[
i
]
);
}
return
items
;
};
//创建一级节点的副本
var
_buffer
=
clonelayer0
();
next
=
[];
var
layer_nolimit
=
expandall
||
(
expand_layer
<
1
)
||
false
;
var
sub_nolimit
=
expandall
||
(
expandoptions
.
defaultSubShow
<
1
)
||
false
;
while
(
_buffer
.
length
!==
0
)
{
while
(
_buffer
.
length
!==
0
)
{
var
parent
=
_buffer
[
0
].
getParent
();
cur_layer
++
;
var
c
=
_buffer
[
0
].
getChildren
();
var
layer_len
=
_buffer
.
length
;
if
(
parent
)
{
for
(
var
j
=
0
;
j
<
layer_len
;
j
++
)
{
for
(
var
i
=
0
;
i
<
c
.
length
;
i
++
)
{
var
c
=
_buffer
[
j
].
getChildren
();
this
.
appendChildNode
(
parent
,
c
[
i
]
);
if
(
(
(
(
sub_nolimit
||
(
c
.
length
<=
expandoptions
.
defaultSubShow
)
)
&&
(
layer_nolimit
||
(
cur_layer
<=
expand_layer
)
)
)
||
_buffer
[
j
].
getLayout
().
expand
)
&&
c
.
length
!==
0
)
{
this
.
expandNode
(
_buffer
[
j
]
);
_buffer
=
_buffer
.
concat
(
_buffer
[
j
].
getChildren
()
);
}
}
}
}
_buffer
=
_buffer
.
concat
(
c
);
_buffer
.
splice
(
0
,
layer_len
);
_buffer
.
shift
();
}
}
// var expandoptions = minder.getOptions( 'defaultExpand' );
// var cur_layer = 0;
// var expand_layer = expandoptions.defaultLayer;
// var mains = _root.getChildren();
// for ( var i = 0; i < mains.length; i++ ) {
// this.appendChildNode( _root, mains[ i ] );
// }
// cur_layer++;
// var clonelayer0 = function () {
// var items = [];
// for ( var i = 0; i < mains.length; i++ ) {
// items.push( mains[ i ] );
// }
// return items;
// };
//创建一级节点的副本
// var _buffer = clonelayer0();
// while ( _buffer.length !== 0 ) {
// var layer_len = _buffer.length;
// for ( var j = 0; j < layer_len; j++ ) {
// var c = _buffer[ j ].getChildren();
// if ( c.length !== 0 ) {
// this.expandNode( _buffer[ j ] );
// _buffer = _buffer.concat( _buffer[ j ].getChildren() );
// }
// }
// _buffer.splice( 0, layer_len );
// }
// var layer_nolimit = expandall || ( expand_layer < 1 ) || false;
// var sub_nolimit = expandall || ( expandoptions.defaultSubShow < 1 ) || false;
// while ( _buffer.length !== 0 ) {
// cur_layer++;
// var layer_len = _buffer.length;
// for ( var j = 0; j < layer_len; j++ ) {
// var c = _buffer[ j ].getChildren();
// // if (
// // (
// // ( ( sub_nolimit || ( c.length <= expandoptions.defaultSubShow ) ) && ( layer_nolimit || ( cur_layer <= expand_layer ) ) ) ||
// // _buffer[ j ].getLayout().expand
// // ) && c.length !== 0 ) {
// if ( c.length !== 0 ) this.expandNode( _buffer[ j ] );
// _buffer = _buffer.concat( _buffer[ j ].getChildren() );
// //}
// }
// _buffer.splice( 0, layer_len );
// }
_root
.
setPoint
(
_root
.
getLayout
().
x
,
_root
.
getLayout
().
y
);
_root
.
setPoint
(
_root
.
getLayout
().
x
,
_root
.
getLayout
().
y
);
},
},
appendChildNode
:
function
(
parent
,
node
,
focus
,
sibling
)
{
appendChildNode
:
function
(
parent
,
node
,
focus
,
sibling
)
{
if
(
parent
.
getType
()
!==
"root"
&&
parent
.
getChildren
().
length
!==
0
&&
parent
.
getLayout
().
expand
===
false
)
{
minder
.
expandNode
(
parent
);
}
minder
.
handelNodeInsert
(
node
);
minder
.
handelNodeInsert
(
node
);
var
oldLayout
=
node
.
getLayout
();
var
Layout
=
node
.
getLayout
();
var
oldExpand
;
if
(
Layout
)
{
oldExpand
=
Layout
.
expand
;
}
node
.
clearLayout
();
node
.
clearLayout
();
node
.
getContRc
().
clear
();
node
.
getContRc
().
clear
();
var
Layout
=
node
.
getLayout
();
Layout
=
node
.
getLayout
();
Layout
.
expand
=
false
;
Layout
.
expand
=
oldExpand
||
false
;
if
(
oldLayout
)
Layout
.
expand
=
oldLayout
;
if
(
parent
.
getType
()
!==
'root'
)
{
if
(
parent
.
getType
()
!==
'root'
)
{
parent
.
getLayout
().
expand
=
true
;
parent
.
getLayout
().
expand
=
true
;
}
}
...
@@ -766,7 +749,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -766,7 +749,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
isExpand
,
node
;
var
isExpand
,
node
;
if
(
ico
instanceof
MinderNode
)
{
if
(
ico
instanceof
MinderNode
)
{
node
=
ico
;
node
=
ico
;
debugger
;
isExpand
=
node
.
getLayout
().
shicon
.
switchState
();
isExpand
=
node
.
getLayout
().
shicon
.
switchState
();
}
else
{
}
else
{
isExpand
=
ico
.
icon
.
switchState
();
isExpand
=
ico
.
icon
.
switchState
();
...
...
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