Disabling mouse events outside background image

Hello everyone, I’ve been trying to work on a function to create a polygon by left mouse clicks above a background image.

However, I need to be able to disable this function when entity is being created outside this background image. Or the user shouldn’t be able to create an entity outside the boundaries of the map using the function. As shown below the picture:

Are there any workaround for this? would Cesium be able to detect if mouse events are outside the background image?

Hi @RobertSalas, to clarify:

outside the boundaries of the map

Is your map 2D?

Sorry for the late response!

It is in 2D, but we have solved the problem by creating a polygon around outside the map and detect mouse movements from there and disable events if it is within that said polygon.