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
41be9143
Commit
41be9143
authored
Jan 06, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev
parent
de89ff45
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
18 deletions
+38
-18
dev.php
dist/dev.php
+3
-3
event.js
src/core/event.js
+8
-8
minder.js
src/core/minder.js
+1
-0
minder.select.js
src/core/minder.select.js
+10
-7
mouse.js
src/module/mouse.js
+16
-0
No files found.
dist/dev.php
View file @
41be9143
...
...
@@ -17,11 +17,11 @@ $dependency = Array(
'src/module/connect.js'
,
'src/module/history.js'
,
'src/module/icon.js'
,
'src/module/keyboard.js'
,
'src/module/layout.js'
,
'src/module/render.js'
,
'src/module/textedit.js'
,
'src/module/_example.js'
'src/module/mouse.js'
,
'src/module/keyboard.js'
,
'src/module/textedit.js'
);
$content
=
""
;
...
...
src/core/event.js
View file @
41be9143
...
...
@@ -12,15 +12,15 @@ var MinderEvent = kity.createClass( 'MindEvent', {
}
this
.
type
=
type
;
this
.
_canstop
=
canstop
||
false
;
if
(
params
.
targetShape
)
{
this
.
getTargetNode
=
function
()
{
var
findShape
=
params
.
targetShape
;
while
(
!
findShape
.
minderNode
&&
findShape
.
container
)
{
findShape
=
findShape
.
container
;
}
return
findShape
.
minderNode
||
null
;
};
},
getTargetNode
:
function
()
{
var
findShape
=
this
.
kityEvent
&&
this
.
kityEvent
.
targetShape
;
if
(
!
findShape
)
return
null
;
while
(
!
findShape
.
minderNode
&&
findShape
.
container
)
{
findShape
=
findShape
.
container
;
}
return
findShape
.
minderNode
||
null
;
},
stopPropagation
:
function
()
{
...
...
src/core/minder.js
View file @
41be9143
...
...
@@ -17,6 +17,7 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this
.
_initEvents
();
this
.
_initMinder
();
this
.
_initCommandStack
();
this
.
_initSelection
();
this
.
_initModules
();
},
...
...
src/core/minder.select.js
View file @
41be9143
// 选区管理
kity
.
extendClass
(
Minder
,
{
_initSelection
:
function
()
{
this
.
_selectedNodes
=
[];
},
getSelectedNodes
:
function
()
{
return
this
.
_selectedNodes
||
(
this
.
_selectedNodes
=
[]
);
return
this
.
_selectedNodes
.
slice
(
0
);
},
select
:
function
(
nodes
)
{
var
selection
=
this
.
getSelectedNodes
()
;
var
selection
=
this
.
_selectedNodes
;
if
(
false
===
nodes
instanceof
Array
)
nodes
=
[
nodes
];
for
(
var
i
=
0
;
i
<
nodes
.
length
;
i
++
)
{
if
(
selection
.
indexOf
(
nodes
[
i
]
)
===
-
1
)
{
...
...
@@ -16,7 +20,7 @@ kity.extendClass( Minder, {
},
isNodeSelected
:
function
(
node
)
{
return
!!~
this
.
getSelectedNodes
()
.
indexOf
(
node
);
return
!!~
this
.
_selectedNodes
.
indexOf
(
node
);
},
selectSingle
:
function
(
node
)
{
...
...
@@ -24,7 +28,7 @@ kity.extendClass( Minder, {
},
toggleSelect
:
function
(
nodes
)
{
var
selection
=
this
.
getSelectedNodes
()
;
var
selection
=
this
.
_selectedNodes
;
var
needAdd
=
[],
needRemove
=
[];
if
(
false
===
nodes
instanceof
Array
)
nodes
=
[
nodes
];
...
...
@@ -35,8 +39,7 @@ kity.extendClass( Minder, {
needRemove
.
push
(
nodes
[
i
]
);
}
}
this
.
clearSelect
(
needRemove
);
this
.
select
(
needAdd
);
return
this
.
clearSelect
(
needRemove
).
select
(
needAdd
);
},
clearSelect
:
function
(
nodes
)
{
...
...
@@ -45,7 +48,7 @@ kity.extendClass( Minder, {
return
this
;
}
if
(
false
===
nodes
instanceof
Array
)
nodes
=
[
nodes
];
var
originSelection
=
this
.
getSelectedNodes
()
;
var
originSelection
=
this
.
_selectedNodes
;
var
newSelection
=
[];
for
(
var
i
=
0
;
i
<
originSelection
.
length
;
i
++
)
{
if
(
nodes
.
indexOf
(
originSelection
[
i
]
)
===
-
1
)
{
...
...
src/module/mouse.js
0 → 100644
View file @
41be9143
KityMinder
.
registerModule
(
"MouseModule"
,
function
()
{
return
{
"events"
:
{
mousedown
:
function
(
e
)
{
var
clickNode
=
e
.
getTargetNode
();
var
deltaNodes
=
this
.
getSelectedNodes
();
this
.
selectSingle
(
clickNode
);
if
(
clickNode
)
{
deltaNodes
.
push
(
clickNode
);
}
this
.
execCommand
(
'rendernode'
,
deltaNodes
);
}
}
};
}
);
\ 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