소스 검색

Prevent mouse from loosing focus when moving gismos

Clement Espeute 2 년 전
부모
커밋
0af2aee08c
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      hide/comp/Scene.hx

+ 9 - 0
hide/comp/Scene.hx

@@ -30,6 +30,15 @@ class Scene extends Component implements h3d.IDrawable {
 		this.config = config;
 		element.addClass("hide-scene-container");
 		canvas = cast new Element("<canvas class='hide-scene' style='width:100%;height:100%'/>").appendTo(element)[0];
+
+		// Prevent mouse loosing focus on drag&drops
+		canvas.onpointerdown = function(e : js.html.PointerEvent) {
+			canvas.setPointerCapture(e.pointerId);
+		}
+		canvas.onpointerup = function(e : js.html.PointerEvent) {
+			canvas.releasePointerCapture(e.pointerId);
+		}
+
 		canvas.addEventListener("mousemove",function(_) canvas.focus());
 		canvas.addEventListener("mouseleave",function(_) canvas.blur());
 		canvas.oncontextmenu = function(e){