Skip to content

Commit

Permalink
delete unnecessary constant variable
Browse files Browse the repository at this point in the history
  • Loading branch information
VikaAbysova committed Oct 25, 2023
1 parent 6481b07 commit 4097e09
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/engine/utils/PointerChecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand Down

0 comments on commit 4097e09

Please sign in to comment.