diff --git a/src/runtime/drag.js b/src/runtime/drag.js index 3fc185f7..a3b270b7 100644 --- a/src/runtime/drag.js +++ b/src/runtime/drag.js @@ -42,7 +42,7 @@ define(function(require, exports, module) { var MOUSE_HAS_UP = 1; var BOUND_CHECK = 20; var flag = MOUSE_HAS_UP; - var maxX, maxY, osx, osy, containerY; + var maxX, maxY, osx, osy, containerY, containerX; var freeHorizen = false, freeVirtical = false; var frame; @@ -84,6 +84,7 @@ define(function(require, exports, module) { downX = e.originEvent.clientX; downY = e.originEvent.clientY; containerY = rect.top; + containerX = rect.left; maxX = rect.width; maxY = rect.height; }); @@ -92,7 +93,7 @@ define(function(require, exports, module) { if (fsm.state() === 'drag' && flag == MOUSE_HAS_DOWN && minder.getSelectedNode() && (Math.abs(downX - e.originEvent.clientX) > BOUND_CHECK || Math.abs(downY - e.originEvent.clientY) > BOUND_CHECK)) { - osx = e.originEvent.clientX; + osx = e.originEvent.clientX - containerX; osy = e.originEvent.clientY - containerY; if (osx < BOUND_CHECK) { diff --git a/src/runtime/input.js b/src/runtime/input.js index 2b4e1245..a328a66a 100644 --- a/src/runtime/input.js +++ b/src/runtime/input.js @@ -366,6 +366,8 @@ define(function(require, exports, module) { var rootText = minder.getRoot().getText(); minder.fire('initChangeRoot', {text: rootText}); } + + minder.layout(300); } function exitInputMode() {