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
f4ec4b92
Commit
f4ec4b92
authored
Dec 24, 2013
by
Akikonata
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/kitygraph/kityminder
into dev
parents
ef57be43
19fbe3dc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
22 deletions
+32
-22
minder.command.js
src/core/minder.command.js
+18
-14
minder.event.js
src/core/minder.event.js
+4
-0
minder.js
src/core/minder.js
+10
-8
No files found.
src/core/minder.command.js
View file @
f4ec4b92
...
...
@@ -20,13 +20,13 @@ kity.extendClass( Minder, {
}
},
execCommand
:
function
(
name
)
{
var
TargetCommand
,
command
,
cmdArgs
,
eventParams
,
stoped
;
var
TargetCommand
,
command
,
cmdArgs
,
eventParams
,
stoped
,
isTopCommand
;
TargetCommand
=
this
.
_getCommand
(
name
);
console
.
log
(
TargetCommand
);
if
(
!
TargetCommand
)
{
return
false
;
}
command
=
new
TargetCommand
();
cmdArgs
=
Array
.
prototype
.
slice
.
call
(
arguments
,
1
);
...
...
@@ -37,20 +37,23 @@ kity.extendClass( Minder, {
commandArgs
:
cmdArgs
};
this
.
_executingCommand
=
this
.
_executingCommand
||
command
;
if
(
this
.
_executingCommand
==
command
)
{
stoped
=
this
.
_fire
(
new
MinderEvent
(
'beforecommand'
,
eventParams
,
true
)
);
if
(
!
stoped
)
{
if
(
!
this
.
_executingCommand
)
{
this
.
_executingCommand
=
command
;
isTopCommand
=
true
;
}
else
{
isTopCommand
=
false
;
}
this
.
_fire
(
new
MinderEvent
(
"precommand"
,
eventParams
,
fals
e
)
);
stoped
=
this
.
_fire
(
new
MinderEvent
(
'beforecommand'
,
eventParams
,
tru
e
)
);
command
.
execute
.
apply
(
command
,
[
this
].
concat
(
cmdArgs
)
);
if
(
!
stoped
)
{
this
.
_fire
(
new
MinderEvent
(
"command"
,
eventParams
,
false
)
);
this
.
_fire
(
new
MinderEvent
(
"precommand"
,
eventParams
,
false
)
);
command
.
execute
.
apply
(
command
,
[
this
].
concat
(
cmdArgs
)
);
this
.
_fire
(
new
MinderEvent
(
"command"
,
eventParams
,
false
)
);
// 顶级命令才触发事件
if
(
isTopCommand
)
{
if
(
command
.
isContentChanged
()
)
{
this
.
_firePharse
(
new
MinderEvent
(
'contentchange'
)
);
}
...
...
@@ -59,10 +62,11 @@ kity.extendClass( Minder, {
}
this
.
_firePharse
(
new
MinderEvent
(
'interactchange'
)
);
}
}
// 顶级事件执行完毕才能清楚顶级事件的执行标记
if
(
isTopCommand
)
{
this
.
_executingCommand
=
null
;
}
else
{
command
.
execute
.
apply
(
command
,
[
this
].
concat
(
cmdArgs
)
);
}
},
...
...
src/core/minder.event.js
View file @
f4ec4b92
...
...
@@ -7,6 +7,10 @@ kity.extendClass( Minder, {
this
.
_bindPaperEvents
();
this
.
_bindKeyboardEvents
();
},
_resetEvents
:
function
()
{
this
.
_initEvents
();
this
.
_bindEvents
();
},
// TODO: mousemove lazy bind
_bindPaperEvents
:
function
()
{
var
minder
=
this
;
...
...
src/core/minder.js
View file @
f4ec4b92
...
...
@@ -12,15 +12,17 @@
var
MinderDefaultOptions
=
{};
var
Minder
=
KityMinder
.
Minder
=
kity
.
createClass
(
"KityMinder"
,
{
constructor
:
function
(
options
)
{
this
.
_options
=
options
||
{};
options
=
Utils
.
extend
(
window
.
KITYMINDER_CONFIG
||
{},
MinderDefaultOptions
,
options
||
{}
);
constructor
:
function
(
arg0
,
arg1
)
{
var
options
=
typeof
(
arg0
)
===
'string'
?
Utils
.
extend
(
arg1
||
{},
{
renderTo
:
arg0
}
)
:
(
arg0
||
{}
);
this
.
_options
=
Utils
.
extend
(
window
.
KITYMINDER_CONFIG
||
{},
MinderDefaultOptions
,
options
);
this
.
_initEvents
();
this
.
_initMinder
(
options
);
this
.
_initModules
(
options
);
this
.
_initMinder
();
this
.
_initModules
();
},
_initMinder
:
function
(
option
)
{
_initMinder
:
function
()
{
this
.
_rc
=
new
kity
.
Group
();
this
.
_paper
=
new
kity
.
Paper
();
...
...
@@ -29,8 +31,8 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this
.
_root
=
new
MinderNode
(
this
);
this
.
_rc
.
addShape
(
this
.
_root
.
getRenderContainer
()
);
if
(
option
.
renderTo
)
{
this
.
renderTo
(
option
.
renderTo
);
if
(
this
.
_options
.
renderTo
)
{
this
.
renderTo
(
this
.
_options
.
renderTo
);
}
},
...
...
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