瀏覽代碼

Fix contextmenu handler in JS (#1014)

Aksel 3 年之前
父節點
當前提交
7c8ea60529
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      hxd/Window.js.hx

+ 5 - 3
hxd/Window.js.hx

@@ -97,11 +97,13 @@ class Window {
 
 		js.Browser.window.addEventListener("resize", checkResize);
 
-		canvas.oncontextmenu = function(e){
+		canvas.addEventListener("contextmenu", function(e){
 			e.stopPropagation();
-			e.preventDefault();
+			if (e.button == 2) {
+				e.preventDefault();
+			}
 			return false;
-		};
+		});
 		if( globalEvents ) {
 			// make first mousedown on canvas trigger event
 			canvas.addEventListener("mousedown", function(e) {