From 7bf0184499daf912a7b7085134c3eef28d406406 Mon Sep 17 00:00:00 2001 From: Timur Khazamov Date: Mon, 6 Jan 2020 23:06:54 +0500 Subject: [PATCH] Fixed ellipse hit test if sizes are negative (#205) --- src/element/collision.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/element/collision.ts b/src/element/collision.ts index c1b3efb5..4d1af1b2 100644 --- a/src/element/collision.ts +++ b/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;