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
d3b81471
Commit
d3b81471
authored
Feb 12, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added node expand and contract
parent
49b9cafa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
9 deletions
+38
-9
layout.default.js
src/module/layout.default.js
+35
-6
layout.js
src/module/layout.js
+3
-3
No files found.
src/module/layout.default.js
View file @
d3b81471
...
@@ -501,7 +501,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -501,7 +501,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
this
.
appendChildNode
(
parent
,
node
,
sibling
);
this
.
appendChildNode
(
parent
,
node
,
sibling
);
},
},
removeNode
:
function
(
nodes
)
{
removeNode
:
function
(
nodes
)
{
console
.
log
(
nodes
);
while
(
nodes
.
length
!==
0
)
{
while
(
nodes
.
length
!==
0
)
{
var
parent
=
nodes
[
0
].
getParent
();
var
parent
=
nodes
[
0
].
getParent
();
var
nodeLayout
=
nodes
[
0
].
getData
(
"layout"
);
var
nodeLayout
=
nodes
[
0
].
getData
(
"layout"
);
...
@@ -519,10 +518,14 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -519,10 +518,14 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
_buffer
=
[
nodes
[
0
]
];
var
_buffer
=
[
nodes
[
0
]
];
while
(
_buffer
.
length
!==
0
)
{
while
(
_buffer
.
length
!==
0
)
{
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
try
{
_buffer
[
0
].
getRenderContainer
().
remove
();
_buffer
[
0
].
getRenderContainer
().
remove
();
var
Layout
=
_buffer
[
0
].
getData
(
"layout"
);
var
Layout
=
_buffer
[
0
].
getData
(
"layout"
);
Layout
.
connect
.
remove
();
Layout
.
connect
.
remove
();
Layout
.
shicon
.
remove
();
Layout
.
shicon
.
remove
();
}
catch
(
error
)
{
console
.
log
(
"isRemoved"
);
}
//检测当前节点是否在选中的数组中,如果在的话,从选中数组中去除
//检测当前节点是否在选中的数组中,如果在的话,从选中数组中去除
var
idx
=
nodes
.
indexOf
(
_buffer
[
0
]
);
var
idx
=
nodes
.
indexOf
(
_buffer
[
0
]
);
if
(
idx
!==
-
1
)
{
if
(
idx
!==
-
1
)
{
...
@@ -532,7 +535,33 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -532,7 +535,33 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
}
}
}
},
},
expandNode
:
function
(
node
)
{
expandNode
:
function
(
ico
)
{
var
isExpand
=
ico
.
icon
.
switchState
();
var
node
=
ico
.
icon
.
_node
;
var
_buffer
=
node
.
getChildren
();
while
(
_buffer
.
length
!==
0
)
{
var
Layout
=
_buffer
[
0
].
getData
(
"layout"
);
if
(
isExpand
)
{
var
parent
=
_buffer
[
0
].
getParent
();
minder
.
appendChildNode
(
parent
,
_buffer
[
0
]
);
Layout
.
connect
=
null
;
Layout
.
shicon
=
null
;
}
else
{
_buffer
[
0
].
getRenderContainer
().
remove
();
Layout
.
connect
.
remove
();
Layout
.
shicon
.
remove
();
}
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
.
shift
();
}
var
set
;
if
(
isExpand
)
set
=
updateLayoutVertical
(
node
,
node
.
getParent
(),
"expand"
);
else
set
=
updateLayoutVertical
(
node
,
node
.
getParent
(),
"contract"
);
for
(
var
i
=
0
;
i
<
set
.
length
;
i
++
)
{
translateNode
(
set
[
i
]
);
updateConnectAndshIcon
(
set
[
i
]
);
}
}
}
};
};
...
...
src/module/layout.js
View file @
d3b81471
...
@@ -44,9 +44,9 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -44,9 +44,9 @@ KityMinder.registerModule( "LayoutModule", function () {
var
curStyle
=
this
.
getCurrentStyle
();
var
curStyle
=
this
.
getCurrentStyle
();
this
.
getLayoutStyle
(
curStyle
).
updateLayout
.
call
(
this
,
node
);
this
.
getLayoutStyle
(
curStyle
).
updateLayout
.
call
(
this
,
node
);
},
},
expandNode
:
function
(
node
)
{
expandNode
:
function
(
ico
)
{
var
curStyle
=
this
.
getCurrentStyle
();
var
curStyle
=
this
.
getCurrentStyle
();
this
.
getLayoutStyle
(
curStyle
).
expandNode
.
call
(
this
,
node
);
this
.
getLayoutStyle
(
curStyle
).
expandNode
.
call
(
this
,
ico
);
}
}
}
);
}
);
kity
.
extendClass
(
MinderNode
,
{
kity
.
extendClass
(
MinderNode
,
{
...
@@ -162,7 +162,7 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -162,7 +162,7 @@ KityMinder.registerModule( "LayoutModule", function () {
"click"
:
function
(
e
)
{
"click"
:
function
(
e
)
{
var
ico
=
e
.
kityEvent
.
targetShape
.
container
;
var
ico
=
e
.
kityEvent
.
targetShape
.
container
;
if
(
ico
.
class
===
"shicon"
)
{
if
(
ico
.
class
===
"shicon"
)
{
this
.
expandNode
(
ico
.
icon
.
_node
);
this
.
expandNode
(
ico
);
}
}
}
}
},
},
...
...
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