If it is difficult you can use simple "if/else" construction. Write a code as simple as you can. On the next step you can refactor it. I will show you a very simple example using JavaScript and <canvas> element that you can run in JSFiddle: https://jsfiddle.net/8Observer8/jhzef4dx/18/
I created a canvas elemen with the size 300x300
<canvas id="myCanvas" width="300" height="300"></canvas>
I wrote a handler for mouse click. I show a message when conditions is true:
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
// Draw a circle
ctx.beginPath();
ctx.arc(50, 50, 30, 0, 2 * Math.PI);
ctx.stroke();
canvas.onclick = function(event) {
var x = event.offsetX;
var y = event.offsetY;
if (0 < x && x < 100 && 0 < y && y < 100)
{
alert("it is left top corner " + x + " " + y);
}
else if (200 <= x && x < 300 && 200 < y && y < 300)
{
alert("it is right bottom corner " + x + " " + y);
}
}