Commit ccac8146 authored by techird's avatar techird

fix drag issue

parent 09e6a67a
...@@ -152,7 +152,7 @@ kity.extendClass(Minder, { ...@@ -152,7 +152,7 @@ kity.extendClass(Minder, {
callbacks[i].call(this, e); callbacks[i].call(this, e);
if (this.getStatus() != lastStatus || e.shouldStopPropagationImmediately()) { if (e.shouldStopPropagationImmediately()) {
break; break;
} }
} }
......
...@@ -18,6 +18,8 @@ KityMinder.registerUI('contextmenu', function(minder) { ...@@ -18,6 +18,8 @@ KityMinder.registerUI('contextmenu', function(minder) {
.addClass('km-context-menu fui-popup-menu') .addClass('km-context-menu fui-popup-menu')
.appendTo('#content-wrapper'); .appendTo('#content-wrapper');
var downPosition;
$menu.delegate('li', 'mousedown', function(e, info) { $menu.delegate('li', 'mousedown', function(e, info) {
var item = $(e.target).closest('li').data('menu'); var item = $(e.target).closest('li').data('menu');
if (item.command) { if (item.command) {
...@@ -31,15 +33,22 @@ KityMinder.registerUI('contextmenu', function(minder) { ...@@ -31,15 +33,22 @@ KityMinder.registerUI('contextmenu', function(minder) {
$('#content-wrapper').on('mousedown', function(e) { $('#content-wrapper').on('mousedown', function(e) {
$menu.hide(); $menu.hide();
if (e.button == 2) {
downPosition = [e.pageX, e.pageY].join(',');
} else {
downPosition = null;
}
}); });
minder.on('mouseup', function(e) { minder.on('mouseup', function(e) {
//e.preventDefault(); //e.preventDefault();
if (minder.getStatus() == 'hand' || !e.isRightMB()) return; if (!e.isRightMB()) return;
e = e.originEvent; e = e.originEvent;
if (downPosition != [e.pageX, e.pageY].join(',')) return;
$menu.empty(); $menu.empty();
var ctxmenu = minder.getContextMenu(); var ctxmenu = minder.getContextMenu();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment