Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复脑图置入容器中,左侧有组件时,脑图拖拽边界计算错误(#980) #981

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/runtime/drag.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
});
Expand All @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ define(function(require, exports, module) {
var rootText = minder.getRoot().getText();
minder.fire('initChangeRoot', {text: rootText});
}

minder.layout(300);
}

function exitInputMode() {
Expand Down