In the browser, I am trying to determine if the point representing the position of the mouse is in what I call the "outer area". For example, in an attached image, the outer area is the area with a blue background.

In the code and image, W represents the width of the browser viewing area, while H represents the height and x, y for the mouse position
Right now I am using this piece of code to do this:
if (((x>0 && x<w1) || (x>w2 && x<W))
||
((x>w1 && x<w2) &&
((y>0 && y<h1) || (y>h2 && y<H))
))
console.log("we are in the outer area")
While it works as is, I wonder if there is a better way to do this?
source
share