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
424e8b4b
Commit
424e8b4b
authored
Jan 17, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added select
parent
ba2e8cfd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
18 deletions
+22
-18
dev.html
demo/dev.html
+0
-5
layout.default.js
src/module/layout.default.js
+15
-11
layout.js
src/module/layout.js
+7
-2
No files found.
demo/dev.html
View file @
424e8b4b
...
...
@@ -17,10 +17,5 @@
minder
=
KM
.
createMinder
(
kityminder
);
minder
.
execCommand
(
"switchlayout"
,
"default"
);
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
());
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
());
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
());
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
());
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
());
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
());
</script>
</html>
\ No newline at end of file
src/module/layout.default.js
View file @
424e8b4b
...
...
@@ -329,17 +329,19 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
);
return
effectSet
;
};
var
updateArrangement
=
function
(
node
,
action
)
{
var
set1
=
updateLayoutHorizon
(
node
);
var
set2
=
updateLayoutVertical
(
node
,
node
.
getParent
(),
action
);
//获取水平方向和垂直方向受影响的点的并集然后进行统一translate
var
set
=
uSet
(
set1
,
set2
);
for
(
var
i
=
0
;
i
<
set
.
length
;
i
++
)
{
translateNode
(
set
[
i
]
);
}
};
var
_style
=
{
renderNode
:
function
(
node
)
{
drawNode
(
node
);
var
set1
=
updateLayoutHorizon
(
node
);
var
set2
=
updateLayoutVertical
(
node
,
node
.
getParent
(),
"append"
);
//获取水平方向和垂直方向受影响的点的并集然后进行统一translate
var
set
=
uSet
(
set1
,
set2
);
console
.
log
(
set
);
for
(
var
i
=
0
;
i
<
set
.
length
;
i
++
)
{
translateNode
(
set
[
i
]
);
}
},
initStyle
:
function
()
{
var
_root
=
this
.
getRoot
();
...
...
@@ -369,6 +371,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
_rootRenderContainer
=
_root
.
getRenderContainer
();
_root
.
setData
(
"leftHeight"
,
_rootRenderContainer
.
getHeight
()
);
_root
.
setData
(
"rightHeight"
,
_rootRenderContainer
.
getHeight
()
);
updateArrangement
(
_root
);
//如果是从其他style切过来的,需要重新布局
if
(
children
.
length
!==
0
)
{
...
...
@@ -406,14 +409,15 @@ KityMinder.registerModule( "LayoutDefault", function () {
node
.
setData
(
"align"
,
"left"
);
}
if
(
parent
.
getChildren
().
indexOf
(
node
)
===
-
1
)
parent
.
appendChild
(
node
);
this
.
render
Node
(
node
);
//this.select( node
);
draw
Node
(
node
);
updateArrangement
(
node
,
"append"
);
},
appendSiblingNode
:
function
(
sibling
,
node
)
{
var
parent
=
sibling
.
getParent
();
var
index
=
sibling
.
getIndex
()
+
1
;
parent
.
appendChild
(
node
,
index
);
this
.
renderNode
(
node
);
drawNode
(
node
);
updateArrangement
(
node
,
"append"
);
},
removeNode
:
function
(
nodes
)
{
var
root
=
this
.
getRoot
();
...
...
src/module/layout.js
View file @
424e8b4b
...
...
@@ -26,7 +26,9 @@ KityMinder.registerModule( "LayoutModule", function () {
base
:
Command
,
execute
:
function
(
km
,
node
)
{
var
parent
=
km
.
getSelectedNode
();
return
km
.
appendChildNode
(
parent
,
node
);
km
.
appendChildNode
(
parent
,
node
);
km
.
select
(
node
);
return
node
;
}
};
}
)()
);
...
...
@@ -34,8 +36,11 @@ KityMinder.registerModule( "LayoutModule", function () {
return
{
base
:
Command
,
execute
:
function
(
km
,
node
)
{
//km.select( node );
var
sibling
=
km
.
getSelectedNode
();
return
km
.
appendSiblingNode
(
sibling
.
getParent
(),
node
);
km
.
appendSiblingNode
(
sibling
,
node
);
km
.
select
(
node
);
return
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