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
890bdcdc
Commit
890bdcdc
authored
Jul 07, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加右键拖动的功能
parent
4d023087
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
contextmenu.js
src/adapter/contextmenu.js
+6
-3
view.js
src/module/view.js
+13
-10
No files found.
src/adapter/contextmenu.js
View file @
890bdcdc
...
...
@@ -27,7 +27,11 @@ KM.registerUI( 'contextmenu', function () {
}
});
me
.
$container
.
append
(
$menu
);
me
.
on
(
'contextmenu'
,
function
(
e
){
me
.
on
(
'contextmenu'
,
function
(
e
)
{
e
.
preventDefault
();
if
(
me
.
getStatus
()
==
'hand'
)
return
;
var
node
=
e
.
getTargetNode
();
if
(
node
){
this
.
removeAllSelectedNodes
();
...
...
@@ -59,7 +63,6 @@ KM.registerUI( 'contextmenu', function () {
data
:
data
}).
position
(
e
.
getPosition
()).
show
();
}
e
.
preventDefault
()
});
me
.
on
(
'click'
,
function
(){
...
...
@@ -67,7 +70,7 @@ KM.registerUI( 'contextmenu', function () {
});
me
.
on
(
'beforemousedown'
,
function
(
e
){
if
(
e
.
isRightMB
()){
e
.
stopPropagationImmediately
();
//
e.stopPropagationImmediately();
}
})
}
);
...
...
src/module/view.js
View file @
890bdcdc
...
...
@@ -24,20 +24,21 @@ var ViewDragger = kity.createClass("ViewDragger", {
_bind
:
function
()
{
var
dragger
=
this
,
is
Root
Drag
=
false
,
is
Temp
Drag
=
false
,
lastPosition
=
null
,
currentPosition
=
null
;
this
.
_minder
.
on
(
'normal.mousedown readonly.mousedown readonly.touchstart'
,
function
(
e
)
{
this
.
_minder
.
on
(
'normal.beforemousedown readonly.mousedown readonly.touchstart'
,
function
(
e
)
{
e
.
originEvent
.
preventDefault
();
// 阻止中键拉动
// 点击未选中的根节点临时开启
if
(
e
.
getTargetNode
()
==
this
.
getRoot
())
{
if
(
e
.
getTargetNode
()
==
this
.
getRoot
()
||
e
.
originEvent
.
button
==
2
)
{
lastPosition
=
e
.
getPosition
();
is
Root
Drag
=
true
;
is
Temp
Drag
=
true
;
}
})
.
on
(
'normal.mousemove normal.touchmove'
,
function
(
e
)
{
if
(
!
is
Root
Drag
)
return
;
if
(
!
is
Temp
Drag
)
return
;
var
offset
=
kity
.
Vector
.
fromPoints
(
lastPosition
,
e
.
getPosition
());
if
(
offset
.
length
()
>
3
)
this
.
setStatus
(
'hand'
);
})
...
...
@@ -68,10 +69,13 @@ var ViewDragger = kity.createClass("ViewDragger", {
lastPosition
=
null
;
// 临时拖动需要还原状态
if
(
is
Root
Drag
)
{
if
(
is
Temp
Drag
)
{
dragger
.
setEnabled
(
false
);
isRootDrag
=
false
;
this
.
rollbackStatus
();
isTempDrag
=
false
;
var
me
=
this
;
setTimeout
(
function
()
{
me
.
rollbackStatus
();
});
}
});
}
...
...
@@ -155,11 +159,10 @@ KityMinder.registerModule('View', function() {
e
.
preventDefault
();
}
},
mousewheel
:
function
(
e
)
{
mousewheel
:
function
(
e
)
{
var
dx
,
dy
;
e
=
e
.
originEvent
;
if
(
e
.
ctrlKey
||
e
.
shiftKey
)
return
;
if
(
'wheelDeltaX'
in
e
)
{
dx
=
e
.
wheelDeltaX
||
0
;
...
...
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