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
14fba533
Commit
14fba533
authored
Jan 20, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added delete and a new style
parent
7c798280
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
289 additions
and
326 deletions
+289
-326
dev.html
demo/dev.html
+2
-2
node.js
src/core/node.js
+41
-41
keyboard.js
src/module/keyboard.js
+31
-30
layout.default.js
src/module/layout.default.js
+134
-108
layout.green.js
src/module/layout.green.js
+79
-144
layout.js
src/module/layout.js
+2
-1
No files found.
demo/dev.html
View file @
14fba533
...
...
@@ -16,7 +16,7 @@
</body>
<script>
minder
=
KM
.
createMinder
(
kityminder
);
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
(
'dsf'
)
);
minder
.
execCommand
(
"append
siblingnode"
,
new
MinderNode
(
'sdf'
));
//minder.execCommand("switchlayout","green"
);
minder
.
execCommand
(
"append
childnode"
,
new
MinderNode
(
"test"
));
</script>
</html>
\ No newline at end of file
src/core/node.js
View file @
14fba533
...
...
@@ -3,21 +3,21 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
this
.
parent
=
null
;
this
.
children
=
[];
this
.
data
=
{};
if
(
utils
.
isString
(
options
))
{
this
.
setData
(
'text'
,
options
)
}
else
{
this
.
setData
(
options
);
if
(
utils
.
isString
(
options
)
)
{
this
.
setData
(
'text'
,
options
)
}
else
{
this
.
setData
(
options
);
}
this
.
rc
=
new
kity
.
Group
();
this
.
rc
.
minderNode
=
this
;
},
setText
:
function
(
text
)
{
this
.
setData
(
'text'
,
text
)
setText
:
function
(
text
)
{
this
.
setData
(
'text'
,
text
)
},
getText
:
function
()
{
return
this
.
getData
(
'text'
)
getText
:
function
()
{
return
this
.
getData
(
'text'
)
},
isRoot
:
function
()
{
isRoot
:
function
()
{
return
this
.
getParent
()
==
null
?
true
:
false
;
},
getParent
:
function
()
{
...
...
@@ -36,8 +36,8 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
getRoot
:
function
()
{
var
root
=
this
;
while
(
root
.
parent
)
{
root
=
root
.
parent
;
while
(
root
.
parent
)
{
root
=
root
.
parent
;
}
return
root
;
},
...
...
@@ -84,13 +84,13 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
// this.handelInsert( node );
},
//
// handelInsert: function ( node ) {
// var root = this.getRoot();
// if ( root.tnh ) {
// root.tnh.handelNodeInsert.call( root.tnh, node );
// }
// },
//
// handelInsert: function ( node ) {
// var root = this.getRoot();
// if ( root.tnh ) {
// root.tnh.handelNodeInsert.call( root.tnh, node );
// }
// },
appendChild
:
function
(
node
)
{
return
this
.
insertChild
(
node
);
...
...
@@ -109,25 +109,25 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
if
(
index
>=
0
)
{
removed
=
this
.
children
.
splice
(
index
,
1
)[
0
];
removed
.
parent
=
null
;
// this.handelRemove( removed );
// this.handelRemove( removed );
}
},
// handelRemove: function ( node ) {
// var root = this.getRoot();
// if ( root.tnh ) {
// root.tnh.handelNodeRemove.call( root.tnh, node );
// }
// },
// handelRemove: function ( node ) {
// var root = this.getRoot();
// if ( root.tnh ) {
// root.tnh.handelNodeRemove.call( root.tnh, node );
// }
// },
getChild
:
function
(
index
)
{
return
this
.
children
[
index
];
},
getFirstChild
:
function
()
{
return
this
.
children
[
0
]
getFirstChild
:
function
()
{
return
this
.
children
[
0
]
},
getLastChild
:
function
()
{
return
this
.
children
[
this
.
children
.
length
-
1
]
getLastChild
:
function
()
{
return
this
.
children
[
this
.
children
.
length
-
1
]
},
getData
:
function
(
name
)
{
if
(
name
===
undefined
)
{
...
...
@@ -148,36 +148,36 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
getRenderContainer
:
function
()
{
return
this
.
rc
;
},
getCommonAncestor
:
function
(
node
)
{
if
(
this
===
node
)
{
getCommonAncestor
:
function
(
node
)
{
if
(
this
===
node
)
{
return
this
.
parent
}
if
(
this
.
contains
(
node
))
{
if
(
this
.
contains
(
node
)
)
{
return
this
}
if
(
node
.
contains
(
this
))
{
if
(
node
.
contains
(
this
)
)
{
return
node
}
var
parent
=
node
.
parent
;
while
(
!
parent
.
contains
(
node
))
{
while
(
!
parent
.
contains
(
node
)
)
{
parent
=
parent
.
parentNode
;
}
return
parent
;
},
contains
:
function
(
node
)
{
if
(
this
===
node
)
{
contains
:
function
(
node
)
{
if
(
this
===
node
)
{
return
true
;
}
if
(
this
===
node
.
parent
)
{
if
(
this
===
node
.
parent
)
{
return
true
;
}
var
isContain
=
false
;
utils
.
each
(
this
.
getChildren
(),
function
(
i
,
n
)
{
isContain
=
n
.
contains
(
node
);
if
(
isContain
===
true
)
{
utils
.
each
(
this
.
getChildren
(),
function
(
i
,
n
)
{
isContain
=
n
.
contains
(
node
);
if
(
isContain
===
true
)
{
return
false
}
});
}
);
return
isContain
;
}
...
...
src/module/keyboard.js
View file @
14fba533
...
...
@@ -47,10 +47,10 @@ KityMinder.registerModule( "KeyboardModule", function () {
}
function
KBNavigate
(
km
,
direction
)
{
function
KBNavigate
(
km
,
direction
)
{
var
nextNode
=
km
.
getSelectedNode
().
_nearestNodes
[
direction
];
if
(
nextNode
)
{
km
.
select
(
nextNode
);
km
.
select
(
nextNode
);
}
}
return
{
...
...
@@ -63,34 +63,35 @@ KityMinder.registerModule( "KeyboardModule", function () {
switch
(
e
.
originEvent
.
keyCode
)
{
case
13
:
// Enter
this
.
execCommand
(
'appendSiblingNode'
,
new
MinderNode
(
'Topic'
));
e
.
preventDefault
();
break
;
case
9
:
// Tab
this
.
execCommand
(
'appendChildNode'
,
new
MinderNode
(
'Topic'
));
e
.
preventDefault
();
break
;
case
8
:
case
46
:
this
.
execCommand
(
'removenode'
);
break
;
case
37
:
case
38
:
case
39
:
case
40
:
if
(
this
.
isSingleSelect
()
)
{
KBNavigate
(
this
,{
37
:
'left'
,
38
:
'top'
,
39
:
'right'
,
40
:
'down'
}[
e
.
originEvent
.
keyCode
]);
}
e
.
preventDefault
();
break
;
case
13
:
// Enter
this
.
execCommand
(
'appendSiblingNode'
,
new
MinderNode
(
'Topic'
)
);
e
.
preventDefault
();
break
;
case
9
:
// Tab
this
.
execCommand
(
'appendChildNode'
,
new
MinderNode
(
'Topic'
)
);
e
.
preventDefault
();
break
;
case
8
:
case
46
:
this
.
execCommand
(
'removenode'
);
e
.
preventDefault
();
break
;
case
37
:
case
38
:
case
39
:
case
40
:
if
(
this
.
isSingleSelect
()
)
{
KBNavigate
(
this
,
{
37
:
'left'
,
38
:
'top'
,
39
:
'right'
,
40
:
'down'
}[
e
.
originEvent
.
keyCode
]
);
}
e
.
preventDefault
();
break
;
}
...
...
src/module/layout.default.js
View file @
14fba533
This diff is collapsed.
Click to expand it.
src/module/layout.green.js
View file @
14fba533
This diff is collapsed.
Click to expand it.
src/module/layout.js
View file @
14fba533
...
...
@@ -11,7 +11,8 @@ KityMinder.registerModule( "LayoutModule", function () {
var
_root
=
km
.
getRoot
();
_root
.
preTraverse
(
function
(
node
)
{
node
.
clearData
();
node
.
setData
(
"style"
,
{}
);
node
.
setData
(
"shape"
,
null
);
node
.
getRenderContainer
().
clear
();
}
);
km
.
initStyle
();
...
...
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