我有旋转的圆形菜单。简单点击后,我想点击点击事件,但在旋转过程中 - mousemove我想忽略点击。现在我有 -在鼠标移动过程中如何防止点击
<g id="bottomMenuRotate" onMouseDown={this.selectElement.bind(this)}>
然后我选择功能看起来 -
selectElement(e){
let groupRotate = document.getElementById('bottomMenuRotate');
groupRotate.onmousemove = function(e) {....}
groupRotate.onmouseup = function(e){
groupRotate.onmousemove = null;
}
}
因此,如何我无法阻止点击?我想是这样
groupRotate.onmouseup = function(e){
e.stopPropagation();
groupRotate.onmousemove = null;
};
或
groupRotate.onmouseclick = function(e){
e.stopPropagation();
}
但这样可以防止每一次点击。任何提示如何我可以做到这一点?
groupRotate.onmousemove = (e) => {
this.setState({ mouseMoving: true });
}
groupRotate.onmouseup = (e) => {
this.setState({ mouseMoving: false });
}
别的地方:
你能举个例子吗?当它会工作,我将它标记为正确 –