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

拖拽时触碰到目标tree之后不松开鼠标再移出目标tree,但node还是被拖入到了最后一个接触过的tree中 #81

Open
lt125327422 opened this issue Jun 26, 2019 · 5 comments

Comments

@lt125327422
Copy link

从某个tree把其中的一个节点拖拽到了另一个tree之后不松开鼠标,之后再把鼠标移入到tree外层,
但node还是被拖入到了最后一个被接触的tree.我想当鼠标松开的目的地在tree外面的话就取消掉这次拖拽

@phphe
Copy link
Owner

phphe commented Jun 26, 2019

在ondragend里判断是否在树外, 返回false阻止

@lt125327422
Copy link
Author

嗯,肯定是在这个钩子完成,但是可以用哪个参数来判断是否在树外,如果你能解决这个问题,我将非常感谢你,谢谢了!

@phphe
Copy link
Owner

phphe commented Jun 26, 2019

一个思路: ondragend的参数draggableHelperInfo draggableHelperInfo.event是事件, 可以获取鼠标位置, 然后用鼠标位置判断是否在树外

@lt125327422
Copy link
Author

你说的这种方案对于目标树只有一个的话确实很好办,但是我们的需求中目标树的数量是动态的,位置也不确定,不过我非常感谢你能回答我的问题

@phphe
Copy link
Owner

phphe commented Jun 27, 2019

占位节点所属树即为目标树 node._vm.store.dplh._vm.store

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants