From 67130cb45f0bbf2f54fa09f6e58446c96d445100 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Tue, 25 Jun 2019 11:57:55 +0100 Subject: [PATCH] Condense isInRect --- src/components/views/elements/InteractiveTooltip.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/components/views/elements/InteractiveTooltip.js b/src/components/views/elements/InteractiveTooltip.js index 42b3561135..b56fd62556 100644 --- a/src/components/views/elements/InteractiveTooltip.js +++ b/src/components/views/elements/InteractiveTooltip.js @@ -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); } /*