소스 검색

Fixed ellipse hit test if sizes are negative (#205)

Timur Khazamov 5 년 전
부모
커밋
7bf0184499
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/element/collision.ts

+ 2 - 2
src/element/collision.ts

@@ -27,8 +27,8 @@ export function hitTest(
     let tx = 0.707;
     let ty = 0.707;
 
-    const a = element.width / 2;
-    const b = element.height / 2;
+    const a = Math.abs(element.width) / 2;
+    const b = Math.abs(element.height) / 2;
 
     [0, 1, 2, 3].forEach(x => {
       const xx = a * tx;