From 78cf0f5cb5739d86d873e22c2892f536daa0245e Mon Sep 17 00:00:00 2001 From: christbau <42711620+christbau@users.noreply.github.com> Date: Wed, 5 Jun 2019 10:55:46 +0200 Subject: [PATCH] Change preciseCheck function The variable half should be half the node size so the hitbox on the node is correct. (When I changed the size of the node, the hitbox was off by half the node size) --- src/WebGL/webglInputEvents.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebGL/webglInputEvents.js b/src/WebGL/webglInputEvents.js index a4654f1..4234bfc 100644 --- a/src/WebGL/webglInputEvents.js +++ b/src/WebGL/webglInputEvents.js @@ -104,7 +104,7 @@ function webglInputEvents(webglGraphics) { function preciseCheck(nodeUI, x, y) { if (nodeUI && nodeUI.size) { var pos = nodeUI.position, - half = nodeUI.size; + half = nodeUI.size/2; return pos.x - half < x && x < pos.x + half && pos.y - half < y && y < pos.y + half;