问题描述
这是参照My其他问题
如何可以为您检测和调度事件时,拖放操作结束prematurely?我需要知道用户不再拖动某一项。即使的DragDrop和dragComplete事件做无火灾。它几乎一样,如果我需要一个事件侦听器添加到DragManager的,但是这不是真的有可能......是什么呢?
How do can you detect and dispatch an event when a drag and drop operation ends prematurely?I need to know that the user is no longer dragging an item. Even if the dragDrop and dragComplete events do no fire. Its almost as if I need to add an event listener to the dragManager, but that's not really possible... is it?
推荐答案
看起来基本上你需要能够告诉如果DragManager的胡扯出来。即使是在拖/放系统的错误事件(没有,我已经看到,但也许我错过了一些明显的),你可能不能总是指望它。
It looks like basically you need to be able to tell if the DragManager craps out. Even if there was an ERROR event in the drag/drop system (there isn't that I've seen, but maybe I've missed something obvious), you probably couldn't always count on it.
有点像试图建立一个客户知道什么时候服务器已经死了之类的话,是吗?
Sort of like trying to set up a client to know when the server has died kind of thing, yeah?
我可能是遥远,但我想,当你开始你拖,你可以添加的mouseMove侦听器,并不断检查,看看是否你还在拖着。我相信你可以动态地设置多久的mouseMove事件触发。
I may be way off, but I'm thinking you could add a mouseMove listener when you begin your drag and constantly check to see if you are still dragging. I believe you can dynamically set how often that mouseMove event fires.
和,当然,一旦你完成了拖 - 无论成熟或prematurely - 删除鼠标移动监听器
And, of course, once you complete the drag - whether maturely or prematurely - remove the mouseMove listener.
我真的不是疯了做这样的事情。添加一个保姆的工作。但我认为它会做需要做的,我不认为它需要是混乱。
I'm really not crazy about doing something like this. Adding a babysitter to an operation. But I think it'd do what needs doing, and I don't think it needs to be messy.
这篇关于我如何检测拖放操作结束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!