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
d1bcc394
Commit
d1bcc394
authored
Jan 17, 2014
by
campaign
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
2622926a
7c7ac886
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
50 deletions
+36
-50
dev.html
demo/dev.html
+7
-6
layout.default.js
src/module/layout.default.js
+9
-19
layout.green.js
src/module/layout.green.js
+12
-18
layout.js
src/module/layout.js
+8
-7
No files found.
demo/dev.html
View file @
d1bcc394
...
@@ -17,11 +17,12 @@
...
@@ -17,11 +17,12 @@
<script>
<script>
minder
=
KM
.
createMinder
(
kityminder
);
minder
=
KM
.
createMinder
(
kityminder
);
// minder.execCommand("appendchildnode",new MinderNode('dsf'));
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
(
'dsf'
));
// minder.execCommand("appendsiblingnode",new MinderNode('sdf'));
minder
.
execCommand
(
"appendsiblingnode"
,
new
MinderNode
(
'sdf'
));
// minder.execCommand("appendchildnode",new MinderNode('sdf'));
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
(
'sdf'
));
// minder.execCommand("appendsiblingnode",new MinderNode('df'));
minder
.
execCommand
(
"appendsiblingnode"
,
new
MinderNode
(
'df'
));
// minder.execCommand("appendsiblingnode",new MinderNode('sdfsdf'));
var
del
=
new
MinderNode
(
'sdfsdf'
);
minder
.
execCommand
(
"appendsiblingnode"
,
del
);
minder
.
execCommand
(
"removenode"
,
del
);
</script>
</script>
</html>
</html>
\ No newline at end of file
src/module/layout.default.js
View file @
d1bcc394
...
@@ -378,24 +378,12 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -378,24 +378,12 @@ KityMinder.registerModule( "LayoutDefault", function () {
updateArrangement
(
_root
);
updateArrangement
(
_root
);
//如果是从其他style切过来的,需要重新布局
//如果是从其他style切过来的,需要重新布局
if
(
children
.
length
!==
0
)
{
var
_buffer
=
_root
.
getChildren
();
_root
.
setData
(
"leftList"
,
[]
);
while
(
_buffer
.
length
!==
0
)
{
_root
.
setData
(
"rightList"
,
[]
);
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
var
leftList
=
_root
.
getData
(
"leftList"
);
var
parent
=
_buffer
[
0
].
getParent
();
var
rightList
=
_root
.
getData
(
"rightList"
);
this
.
appendChildNode
(
parent
,
_buffer
[
0
]
);
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
_buffer
.
shift
();
if
(
i
%
2
===
0
)
{
rightList
.
push
(
children
[
i
]
);
children
[
i
].
setData
(
"appendside"
,
"right"
);
}
else
{
leftList
.
push
(
children
[
i
]
);
children
[
i
].
setData
(
"appendside"
,
"left"
);
}
children
[
i
].
getRenderContainer
().
clear
();
children
.
setData
(
"shape"
,
null
);
drawNode
(
children
[
i
]
);
updateArrangement
(
children
[
i
]
);
}
}
}
},
},
appendChildNode
:
function
(
parent
,
node
,
index
)
{
appendChildNode
:
function
(
parent
,
node
,
index
)
{
...
@@ -436,13 +424,15 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -436,13 +424,15 @@ KityMinder.registerModule( "LayoutDefault", function () {
},
},
removeNode
:
function
(
nodes
)
{
removeNode
:
function
(
nodes
)
{
var
root
=
this
.
getRoot
();
var
root
=
this
.
getRoot
();
var
minder
=
this
;
for
(
var
i
=
0
;
i
<
nodes
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
nodes
.
length
;
i
++
)
{
var
parent
=
nodes
[
i
].
getParent
();
var
parent
=
nodes
[
i
].
getParent
();
if
(
parent
)
{
if
(
parent
)
{
nodes
[
i
].
getRenderContainer
().
remove
();
updateConnect
(
minder
,
nodes
[
i
],
"remove"
);
parent
.
removeChild
(
nodes
[
i
]
);
parent
.
removeChild
(
nodes
[
i
]
);
}
}
}
}
this
.
setContentChanged
(
true
);
}
}
};
};
this
.
addLayoutStyle
(
"default"
,
_style
);
this
.
addLayoutStyle
(
"default"
,
_style
);
...
...
src/module/layout.green.js
View file @
d1bcc394
...
@@ -349,6 +349,7 @@ KityMinder.registerModule( "LayoutGreen", function () {
...
@@ -349,6 +349,7 @@ KityMinder.registerModule( "LayoutGreen", function () {
},
},
initStyle
:
function
()
{
initStyle
:
function
()
{
var
_root
=
this
.
getRoot
();
var
_root
=
this
.
getRoot
();
console
.
log
(
_root
);
var
minder
=
this
;
var
minder
=
this
;
_root
.
setData
(
"style"
,
{
_root
.
setData
(
"style"
,
{
radius
:
10
,
radius
:
10
,
...
@@ -366,7 +367,6 @@ KityMinder.registerModule( "LayoutGreen", function () {
...
@@ -366,7 +367,6 @@ KityMinder.registerModule( "LayoutGreen", function () {
_root
.
setData
(
"text"
,
"I am the root"
);
_root
.
setData
(
"text"
,
"I am the root"
);
_root
.
setData
(
"appendside"
,
"right"
);
_root
.
setData
(
"appendside"
,
"right"
);
var
children
=
_root
.
getChildren
();
_root
.
setData
(
"leftList"
,
[]
);
_root
.
setData
(
"leftList"
,
[]
);
_root
.
setData
(
"rightList"
,
[]
);
_root
.
setData
(
"rightList"
,
[]
);
...
@@ -378,25 +378,16 @@ KityMinder.registerModule( "LayoutGreen", function () {
...
@@ -378,25 +378,16 @@ KityMinder.registerModule( "LayoutGreen", function () {
updateArrangement
(
_root
);
updateArrangement
(
_root
);
//如果是从其他style切过来的,需要重新布局
//如果是从其他style切过来的,需要重新布局
if
(
children
.
length
!==
0
)
{
var
_buffer
=
_root
.
getChildren
();
_root
.
setData
(
"leftList"
,
[]
);
while
(
_buffer
.
length
!==
0
)
{
_root
.
setData
(
"rightList"
,
[]
);
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
var
leftList
=
_root
.
getData
(
"leftList"
);
var
parent
=
_buffer
[
0
].
getParent
();
var
rightList
=
_root
.
getData
(
"rightList"
);
this
.
appendChildNode
(
parent
,
_buffer
[
0
]
);
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
_buffer
.
shift
();
if
(
i
%
2
===
0
)
{
rightList
.
push
(
children
[
i
]
);
children
[
i
].
setData
(
"appendside"
,
"right"
);
}
else
{
leftList
.
push
(
children
[
i
]
);
children
[
i
].
setData
(
"appendside"
,
"left"
);
}
drawNode
(
children
[
i
]
);
updateArrangement
(
children
[
i
]
);
}
}
}
},
},
appendChildNode
:
function
(
parent
,
node
,
index
)
{
appendChildNode
:
function
(
parent
,
node
,
index
)
{
var
minder
=
this
;
var
appendside
=
parent
.
getData
(
"appendside"
);
var
appendside
=
parent
.
getData
(
"appendside"
);
if
(
parent
===
root
)
{
if
(
parent
===
root
)
{
var
leftList
=
parent
.
getData
(
"leftList"
);
var
leftList
=
parent
.
getData
(
"leftList"
);
...
@@ -417,7 +408,10 @@ KityMinder.registerModule( "LayoutGreen", function () {
...
@@ -417,7 +408,10 @@ KityMinder.registerModule( "LayoutGreen", function () {
}
else
{
}
else
{
node
.
setData
(
"align"
,
"left"
);
node
.
setData
(
"align"
,
"left"
);
}
}
if
(
parent
.
getChildren
().
indexOf
(
node
)
===
-
1
)
parent
.
appendChild
(
node
,
index
);
if
(
parent
.
getChildren
().
indexOf
(
node
)
===
-
1
)
{
parent
.
appendChild
(
node
,
index
);
minder
.
handelNodeInsert
(
node
);
}
drawNode
(
node
);
drawNode
(
node
);
updateArrangement
(
node
,
"append"
);
updateArrangement
(
node
,
"append"
);
},
},
...
...
src/module/layout.js
View file @
d1bcc394
...
@@ -40,11 +40,11 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -40,11 +40,11 @@ KityMinder.registerModule( "LayoutModule", function () {
execute
:
function
(
km
,
node
)
{
execute
:
function
(
km
,
node
)
{
//km.select( node );
//km.select( node );
var
selectedNode
=
km
.
getSelectedNode
();
var
selectedNode
=
km
.
getSelectedNode
();
if
(
selectedNode
.
isRoot
())
{
if
(
selectedNode
.
isRoot
()
)
{
km
.
appendChildNode
(
selectedNode
,
node
);
km
.
appendChildNode
(
selectedNode
,
node
);
}
else
{
}
else
{
km
.
appendSiblingNode
(
selectedNode
,
node
);
km
.
appendSiblingNode
(
selectedNode
,
node
);
}
}
km
.
select
(
node
);
km
.
select
(
node
);
return
node
;
return
node
;
}
}
...
@@ -53,8 +53,9 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -53,8 +53,9 @@ KityMinder.registerModule( "LayoutModule", function () {
var
RemoveNodeCommand
=
kity
.
createClass
(
"RemoveNodeCommand"
,
(
function
()
{
var
RemoveNodeCommand
=
kity
.
createClass
(
"RemoveNodeCommand"
,
(
function
()
{
return
{
return
{
base
:
Command
,
base
:
Command
,
execute
:
function
(
km
,
nodes
)
{
execute
:
function
(
km
)
{
km
.
removeNode
(
nodes
);
var
selectedNodes
=
km
.
getSelectedNodes
();
km
.
removeNode
(
selectedNodes
);
}
}
};
};
}
)()
);
}
)()
);
...
...
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