右键单击鼠标事件错误
在最后一个小时里我试图修复一个错误,但我做不到。
该错误是:
如果您按左键单击并且不释放它,然后按右键单击(出现上下文菜单),然后再次左键单击,则第一个“拖动”操作永远不会释放。
就像,我需要让我的右键单击说:“嘿左键单击,你的工作完成了,你现在可以回家了”。
但我找不到办法。
I tried to fix a bug, for the last hour and I just couldnt.
The bug is:
If you press left click and dont release it, and then press right click (contextual menu appears) and then left click again, the first "drag" action is never released.
Its like, I need to make that my right click says: "hey left click, your job is done, you can go home now".
But I couldnt find a way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的解决方案是监听舞台的鼠标移动并检查
MouseEvent.buttonDown
。如果为 false,请停止拖动:重要的是监听舞台,而不是组件,一旦上下文菜单隐藏后,指针就会出现在组件外部,并且侦听器将不会执行。
My solution is to listen to stage's mouse move and check
MouseEvent.buttonDown
. If it's false, stop drag:It's important to listen to stage, not to your component, as soon as after context menu hides, the pointer can appear outside component and listeners won't execute.