From 4097e09c8a4de2051b740189aaac0c35c4106a9b Mon Sep 17 00:00:00 2001 From: Vika Abysova Date: Wed, 25 Oct 2023 16:25:15 +0300 Subject: [PATCH] delete unnecessary constant variable --- src/engine/utils/PointerChecker.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/engine/utils/PointerChecker.js b/src/engine/utils/PointerChecker.js index 33dccc14..23996a3b 100644 --- a/src/engine/utils/PointerChecker.js +++ b/src/engine/utils/PointerChecker.js @@ -15,10 +15,8 @@ class PointerChecker { static isPointerOnLine(vs, ve, vScr) { // The distance to the line by "x" and "y" const MIN_DIST = 10; - // The number for define a half of the distance - const TWO = 2; // Define the center point of the line by "y" coordinate - const centerLineY = (vs.y + ve.y) / TWO; + const centerLineY = (vs.y + ve.y) / 2; // Define the angle slope of the line const m = (ve.y - vs.y) / (ve.x - vs.x); // Define the intercept of the line @@ -39,8 +37,8 @@ class PointerChecker { vs.x === ve.x && vScr.x <= vs.x + MIN_DIST && vScr.x >= vs.x - MIN_DIST && - vScr.y >= centerLineY - widthY / TWO && - vScr.y <= centerLineY + widthY / TWO + vScr.y >= centerLineY - widthY / 2 && + vScr.y <= centerLineY + widthY / 2 ) { return true; }