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
Show 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, {
...
@@ -20,13 +20,13 @@ kity.extendClass( Minder, {
}
}
},
},
execCommand
:
function
(
name
)
{
execCommand
:
function
(
name
)
{
var
TargetCommand
,
command
,
cmdArgs
,
eventParams
,
stoped
;
var
TargetCommand
,
command
,
cmdArgs
,
eventParams
,
stoped
,
isTopCommand
;
TargetCommand
=
this
.
_getCommand
(
name
);
TargetCommand
=
this
.
_getCommand
(
name
);
console
.
log
(
TargetCommand
);
if
(
!
TargetCommand
)
{
if
(
!
TargetCommand
)
{
return
false
;
return
false
;
}
}
command
=
new
TargetCommand
();
command
=
new
TargetCommand
();
cmdArgs
=
Array
.
prototype
.
slice
.
call
(
arguments
,
1
);
cmdArgs
=
Array
.
prototype
.
slice
.
call
(
arguments
,
1
);
...
@@ -37,20 +37,23 @@ kity.extendClass( Minder, {
...
@@ -37,20 +37,23 @@ kity.extendClass( Minder, {
commandArgs
:
cmdArgs
commandArgs
:
cmdArgs
};
};
this
.
_executingCommand
=
this
.
_executingCommand
||
command
;
if
(
!
this
.
_executingCommand
)
{
this
.
_executingCommand
=
command
;
if
(
this
.
_executingCommand
==
command
)
{
isTopCommand
=
true
;
}
else
{
isTopCommand
=
false
;
}
stoped
=
this
.
_fire
(
new
MinderEvent
(
'beforecommand'
,
eventParams
,
true
)
);
stoped
=
this
.
_fire
(
new
MinderEvent
(
'beforecommand'
,
eventParams
,
true
)
);
if
(
!
stoped
)
{
if
(
!
stoped
)
{
this
.
_fire
(
new
MinderEvent
(
"precommand"
,
eventParams
,
false
)
);
this
.
_fire
(
new
MinderEvent
(
"precommand"
,
eventParams
,
false
)
);
command
.
execute
.
apply
(
command
,
[
this
].
concat
(
cmdArgs
)
);
command
.
execute
.
apply
(
command
,
[
this
].
concat
(
cmdArgs
)
);
this
.
_fire
(
new
MinderEvent
(
"command"
,
eventParams
,
false
)
);
this
.
_fire
(
new
MinderEvent
(
"command"
,
eventParams
,
false
)
);
// 顶级命令才触发事件
if
(
isTopCommand
)
{
if
(
command
.
isContentChanged
()
)
{
if
(
command
.
isContentChanged
()
)
{
this
.
_firePharse
(
new
MinderEvent
(
'contentchange'
)
);
this
.
_firePharse
(
new
MinderEvent
(
'contentchange'
)
);
}
}
...
@@ -59,10 +62,11 @@ kity.extendClass( Minder, {
...
@@ -59,10 +62,11 @@ kity.extendClass( Minder, {
}
}
this
.
_firePharse
(
new
MinderEvent
(
'interactchange'
)
);
this
.
_firePharse
(
new
MinderEvent
(
'interactchange'
)
);
}
}
}
// 顶级事件执行完毕才能清楚顶级事件的执行标记
if
(
isTopCommand
)
{
this
.
_executingCommand
=
null
;
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, {
...
@@ -7,6 +7,10 @@ kity.extendClass( Minder, {
this
.
_bindPaperEvents
();
this
.
_bindPaperEvents
();
this
.
_bindKeyboardEvents
();
this
.
_bindKeyboardEvents
();
},
},
_resetEvents
:
function
()
{
this
.
_initEvents
();
this
.
_bindEvents
();
},
// TODO: mousemove lazy bind
// TODO: mousemove lazy bind
_bindPaperEvents
:
function
()
{
_bindPaperEvents
:
function
()
{
var
minder
=
this
;
var
minder
=
this
;
...
...
src/core/minder.js
View file @
f4ec4b92
...
@@ -12,15 +12,17 @@
...
@@ -12,15 +12,17 @@
var
MinderDefaultOptions
=
{};
var
MinderDefaultOptions
=
{};
var
Minder
=
KityMinder
.
Minder
=
kity
.
createClass
(
"KityMinder"
,
{
var
Minder
=
KityMinder
.
Minder
=
kity
.
createClass
(
"KityMinder"
,
{
constructor
:
function
(
options
)
{
constructor
:
function
(
arg0
,
arg1
)
{
this
.
_options
=
options
||
{};
var
options
=
typeof
(
arg0
)
===
'string'
?
Utils
.
extend
(
arg1
||
{},
{
options
=
Utils
.
extend
(
window
.
KITYMINDER_CONFIG
||
{},
MinderDefaultOptions
,
options
||
{}
);
renderTo
:
arg0
}
)
:
(
arg0
||
{}
);
this
.
_options
=
Utils
.
extend
(
window
.
KITYMINDER_CONFIG
||
{},
MinderDefaultOptions
,
options
);
this
.
_initEvents
();
this
.
_initEvents
();
this
.
_initMinder
(
options
);
this
.
_initMinder
();
this
.
_initModules
(
options
);
this
.
_initModules
();
},
},
_initMinder
:
function
(
option
)
{
_initMinder
:
function
()
{
this
.
_rc
=
new
kity
.
Group
();
this
.
_rc
=
new
kity
.
Group
();
this
.
_paper
=
new
kity
.
Paper
();
this
.
_paper
=
new
kity
.
Paper
();
...
@@ -29,8 +31,8 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
...
@@ -29,8 +31,8 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this
.
_root
=
new
MinderNode
(
this
);
this
.
_root
=
new
MinderNode
(
this
);
this
.
_rc
.
addShape
(
this
.
_root
.
getRenderContainer
()
);
this
.
_rc
.
addShape
(
this
.
_root
.
getRenderContainer
()
);
if
(
option
.
renderTo
)
{
if
(
this
.
_options
.
renderTo
)
{
this
.
renderTo
(
option
.
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