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
32e7742d
Commit
32e7742d
authored
Jan 17, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minder.node把svg的维护分理出去
parent
bd842160
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
22 deletions
+21
-22
minder.js
src/core/minder.js
+0
-1
node.js
src/core/node.js
+21
-21
No files found.
src/core/minder.js
View file @
32e7742d
...
@@ -28,7 +28,6 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
...
@@ -28,7 +28,6 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this
.
_paper
.
addShape
(
this
.
_rc
);
this
.
_paper
.
addShape
(
this
.
_rc
);
this
.
_paper
.
getNode
().
setAttribute
(
'contenteditable'
,
true
);
this
.
_paper
.
getNode
().
setAttribute
(
'contenteditable'
,
true
);
this
.
_root
=
new
MinderNode
();
this
.
_root
=
new
MinderNode
();
this
.
_root
.
setNotifyHandler
(
this
);
this
.
_rc
.
addShape
(
this
.
_root
.
getRenderContainer
()
);
this
.
_rc
.
addShape
(
this
.
_root
.
getRenderContainer
()
);
if
(
this
.
_options
.
renderTo
)
{
if
(
this
.
_options
.
renderTo
)
{
...
...
src/core/node.js
View file @
32e7742d
...
@@ -10,12 +10,8 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
...
@@ -10,12 +10,8 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
}
}
this
.
rc
=
new
kity
.
Group
();
this
.
rc
=
new
kity
.
Group
();
this
.
rc
.
minderNode
=
this
;
this
.
rc
.
minderNode
=
this
;
this
.
root
=
null
;
},
//在创建root时给定handler
setNotifyHandler
:
function
(
treeNotifyHandler
){
this
.
tnh
=
treeNotifyHandler
;
},
},
getParent
:
function
()
{
getParent
:
function
()
{
return
this
.
parent
;
return
this
.
parent
;
},
},
...
@@ -31,7 +27,11 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
...
@@ -31,7 +27,11 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
},
},
getRoot
:
function
()
{
getRoot
:
function
()
{
return
this
.
root
;
var
root
=
this
;
while
(
root
.
parent
){
root
=
root
.
parent
;
}
return
root
;
},
},
preTraverse
:
function
(
fn
)
{
preTraverse
:
function
(
fn
)
{
...
@@ -73,16 +73,16 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
...
@@ -73,16 +73,16 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
node
.
root
=
parent
.
root
;
node
.
root
=
parent
.
root
;
this
.
children
.
splice
(
index
,
0
,
node
);
this
.
children
.
splice
(
index
,
0
,
node
);
this
.
handelInsert
(
node
);
// 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
)
{
appendChild
:
function
(
node
)
{
return
this
.
insertChild
(
node
);
return
this
.
insertChild
(
node
);
...
@@ -101,16 +101,16 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
...
@@ -101,16 +101,16 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
if
(
index
>=
0
)
{
if
(
index
>=
0
)
{
removed
=
this
.
children
.
splice
(
index
,
1
)[
0
];
removed
=
this
.
children
.
splice
(
index
,
1
)[
0
];
removed
.
parent
=
null
;
removed
.
parent
=
null
;
this
.
handelRemove
(
removed
);
//
this.handelRemove( removed );
}
}
},
},
handelRemove
:
function
(
node
)
{
//
handelRemove: function ( node ) {
var
root
=
this
.
getRoot
();
//
var root = this.getRoot();
if
(
root
.
tnh
)
{
//
if ( root.tnh ) {
root
.
tnh
.
handelNodeRemove
.
call
(
root
.
tnh
,
node
);
//
root.tnh.handelNodeRemove.call( root.tnh, node );
}
//
}
},
//
},
getChild
:
function
(
index
)
{
getChild
:
function
(
index
)
{
return
this
.
children
[
index
];
return
this
.
children
[
index
];
...
...
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