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
ad872831
Commit
ad872831
authored
Dec 20, 2013
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Format Files
parent
65b73774
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
50 deletions
+51
-50
minderevent.js
src/core/minderevent.js
+13
-13
mindernode.js
src/core/mindernode.js
+38
-37
No files found.
src/core/minderevent.js
View file @
ad872831
var
MinderEvent
=
kity
.
createClass
(
'MindEvent'
,
{
constructor
:
function
(
type
,
params
,
cancelable
)
{
var
MinderEvent
=
kity
.
createClass
(
'MindEvent'
,
{
constructor
:
function
(
type
,
params
,
cancelable
)
{
params
=
params
||
{};
if
(
params
.
getType
&&
params
.
getType
()
==
'ShapeEvent'
)
{
if
(
params
.
getType
&&
params
.
getType
()
==
'ShapeEvent'
)
{
this
.
kityEvent
=
params
;
this
.
getPosition
=
params
.
getPosition
.
bind
(
params
);
this
.
getPosition
=
params
.
getPosition
.
bind
(
params
);
}
else
{
kity
.
Utils
.
extend
(
this
,
params
);
kity
.
Utils
.
extend
(
this
,
params
);
}
this
.
type
=
type
;
this
.
_cancelable
=
cancelable
||
false
;
if
(
params
.
targetShape
)
{
this
.
getTargetNode
=
function
()
{
if
(
params
.
targetShape
)
{
this
.
getTargetNode
=
function
()
{
var
findShape
=
params
.
targetShape
;
while
(
!
findShape
.
minderNode
&&
findShape
.
container
)
{
while
(
!
findShape
.
minderNode
&&
findShape
.
container
)
{
findShape
=
findShape
.
container
;
}
return
findShape
.
minderNode
||
null
;
...
...
@@ -20,20 +20,20 @@ var MinderEvent = kity.createClass('MindEvent', {
}
},
cancel
:
function
()
{
cancel
:
function
()
{
this
.
_canceled
=
true
;
},
cancelImmediately
:
function
()
{
cancelImmediately
:
function
()
{
this
.
_immediatelyCanceld
=
true
;
this
.
_canceled
=
true
;
},
shouldCancel
:
function
()
{
shouldCancel
:
function
()
{
return
this
.
_cancelable
&&
this
.
_canceled
;
},
shouldCancelImmediately
:
function
()
{
shouldCancelImmediately
:
function
()
{
return
this
.
_cancelable
&&
this
.
_immediatelyCanceld
;
}
});
\ No newline at end of file
}
);
\ No newline at end of file
src/core/mindernode.js
View file @
ad872831
var
MinderNode
=
km
.
MinderNode
=
kity
.
createClass
(
"MinderNode"
,
{
var
MinderNode
=
km
.
MinderNode
=
kity
.
createClass
(
"MinderNode"
,
{
constructor
:
function
(
treeNotifyHandler
)
{
this
.
parent
=
null
;
this
.
children
=
[];
...
...
@@ -8,88 +8,89 @@ var MinderNode = km.MinderNode = kity.createClass("MinderNode", {
this
.
rc
.
minderNode
=
this
;
},
getParent
:
function
()
{
getParent
:
function
()
{
return
this
.
parent
;
},
getRoot
:
function
()
{
getRoot
:
function
()
{
var
root
=
this
;
while
(
root
.
parent
)
{
while
(
root
.
parent
)
{
root
=
root
.
parent
;
}
return
root
;
},
getChildren
:
function
()
{
getChildren
:
function
()
{
return
this
.
children
;
},
getIndex
:
function
()
{
return
this
.
parent
?
this
.
parent
.
indexOf
(
this
)
:
-
1
;
getIndex
:
function
()
{
return
this
.
parent
?
this
.
parent
.
indexOf
(
this
)
:
-
1
;
},
insertChild
:
function
(
node
,
index
)
{
if
(
index
===
undefined
)
{
insertChild
:
function
(
node
,
index
)
{
if
(
index
===
undefined
)
{
index
=
this
.
children
.
length
;
}
if
(
node
.
parent
)
{
node
.
parent
.
removeChild
(
node
);
if
(
node
.
parent
)
{
node
.
parent
.
removeChild
(
node
);
}
node
.
parent
=
this
;
this
.
children
.
splice
(
index
,
0
,
node
);
this
.
handelInsert
(
node
);
this
.
children
.
splice
(
index
,
0
,
node
);
this
.
handelInsert
(
node
);
},
handelInsert
:
function
(
node
)
{
handelInsert
:
function
(
node
)
{
var
root
=
this
.
getRoot
();
if
(
root
.
tnh
)
{
if
(
root
.
tnh
)
{
root
.
tnh
.
handelNodeInsert
.
call
(
root
.
tnh
,
node
);
}
},
appendChild
:
function
(
node
)
{
return
this
.
insertChild
(
node
);
appendChild
:
function
(
node
)
{
return
this
.
insertChild
(
node
);
},
prependChild
:
function
(
node
)
{
return
this
.
insertChild
(
node
,
0
);
prependChild
:
function
(
node
)
{
return
this
.
insertChild
(
node
,
0
);
},
removeChild
:
function
(
elem
)
{
var
index
=
elem
,
removed
;
if
(
elem
instanceof
MinderNode
)
{
index
=
this
.
children
.
indexOf
(
elem
);
removeChild
:
function
(
elem
)
{
var
index
=
elem
,
removed
;
if
(
elem
instanceof
MinderNode
)
{
index
=
this
.
children
.
indexOf
(
elem
);
}
if
(
index
>=
0
)
{
removed
=
this
.
children
.
splice
(
index
,
1
)[
0
];
if
(
index
>=
0
)
{
removed
=
this
.
children
.
splice
(
index
,
1
)[
0
];
removed
.
parent
=
null
;
this
.
handelRemove
(
removed
);
this
.
handelRemove
(
removed
);
}
},
handelRemove
:
function
(
node
)
{
handelRemove
:
function
(
node
)
{
var
root
=
this
.
getRoot
();
if
(
root
.
tnh
)
{
if
(
root
.
tnh
)
{
root
.
tnh
.
handelNodeRemove
.
call
(
root
.
tnh
,
node
);
}
},
getChild
:
function
(
index
)
{
return
this
.
children
[
index
];
getChild
:
function
(
index
)
{
return
this
.
children
[
index
];
},
getData
:
function
(
name
)
{
if
(
name
===
undefined
)
{
getData
:
function
(
name
)
{
if
(
name
===
undefined
)
{
return
this
.
data
;
}
return
this
.
data
[
name
];
return
this
.
data
[
name
];
},
setData
:
function
(
name
,
value
)
{
this
.
data
[
name
]
=
value
;
setData
:
function
(
name
,
value
)
{
this
.
data
[
name
]
=
value
;
},
getRenderContainer
:
function
()
{
getRenderContainer
:
function
()
{
return
this
.
rc
;
}
});
\ No newline at end of file
}
);
\ No newline at end of file
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