antvis/G6

The issue has been closed
右键的mouseup事件没有被触发 #1671
xinheHuang posted onGitHub
根据浏览器和jquery实现规范,在contextmenu事件调用preventDefault方法时,右键的mouseup事件应该被触发。 原因可能是g-base中的这段代码,直接忽视了右键:https://github.com/antvis/g/blob/f1dd2cc436ea123939f400a9a9d88f1ebce46be9/packages/g-base/src/event/event-contoller.ts#L319-L340
jquery 的实现: 打开链接: https://www.runoob.com/try/try.php?filename=tryjquery_event_bind_ref 并粘贴以下代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>contextmenu test case</title>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("p").bind("click",function(){
console.log("click");
});
$("p").bind("mousedown",function(){
console.log("mousedown");
});
$("p").bind("mouseup",function(){
console.log("mouseup");
});
$("p").bind("contextmenu",function(ev){
ev.preventDefault();
console.log("contextmenu");
});
});
</script>
</head>
<body>
<p>点我!</p>
</body>
</html>