Condense isInRect

pull/21833/head
J. Ryan Stinnett 2019-06-25 11:57:55 +01:00
parent 72bfc3b5ea
commit 67130cb45f
1 changed files with 2 additions and 10 deletions

View File

@ -35,16 +35,8 @@ function getOrCreateContainer() {
function isInRect(x, y, rect, buffer = 10) {
const { top, right, bottom, left } = rect;
if (x < (left - buffer) || x > (right + buffer)) {
return false;
}
if (y < (top - buffer) || y > (bottom + buffer)) {
return false;
}
return true;
return x >= (left - buffer) && x <= (right + buffer)
&& y >= (top - buffer) && y <= (bottom + buffer);
}
/*