Using the sketchviewmodel i have drawn a graphic which acts like a polygon filter on the map.

Anyways, i have added logic such that clicking inside the polygon pops up a custom toolbar etc.
To do all this, my code is something like this:
mapView.hitTest(clickCoordinates).then((response: any) => {
if (response.results.length === 0) {
const polygonFilter = getPolygonFilterGraphic(layer);
// check if the click coordinates is inside the polygon filter
const point = new esri.Point({
x: event.mapPoint.x, y: event.mapPoint.y, spatialReference: esri.SpatialReference.WebMercator
);
if (polygonFilter && polygonFilter.geometry.contains(point)) {
// pop up the toolbar
}
This works fine except in the case where i pan around the world. so in my screenshot above if i pan around the world and arrive at this polygon filter over japan again, if i click inside it, the mapPoint is never inside the polygonFilter.geometry (ie. the contains() predicate always fails.)
I suspect it has to do with the mapPoint's x coordinate being outside the current extent xmin and xmax. do i need to be normalizing the mapPoint or the polygonFilter.geometry or both? and if so, how do i normalize it? Any help would be appreciated thanks!