[英]How to discern between a drag start and a selection start HTML5-Canvas
Is there a trivial way to discern between the start of a drag operation, and the start of a select operation on a HTML5-canvas? 是否有一种简单的方法来区分拖动操作的开始和HTML5画布上的选择操作的开始?
I've produced code for both, but both involved setting a boolean with a onmousedown event, processing information when the onmousemove event is fired(if the boolean was set), and then setting the boolean back to false and performing final processing with a onmouseup event. 我已为两者生成代码,但都涉及使用onmousedown事件设置布尔值,触发onmousemove事件时处理信息(如果设置了布尔值),然后将布尔值设置为false并使用onmouseup执行最终处理事件。 Is there a better way to do either of these? 有没有更好的方法来做其中任何一个?
Thank you for your time, hoping that I was just using the wrong word combinations when trying to Google(as well as looking on stack-overflow) the topic, and sincerely apologize if I missed a post/forum when searching. 感谢您的时间,希望我在尝试Google时使用错误的单词组合(以及查看堆栈溢出)这个主题,如果我在搜索时错过了帖子/论坛,我真诚地道歉。
When working with mouse primitives, there is no way to know if a mouse-down is part of a click, a double-click, or a drag until a subsequent event is fired. 使用鼠标基元时,无法知道鼠标按下是否是单击,双击或拖动的一部分,直到触发后续事件。
The difference between a drag and a rect-select is based (usually) on whether or not an object is present under the mouse position when the down is fired. 拖动和矩形选择之间的差异(通常)基于当向下发射时对象是否存在于鼠标位置下方。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.