I have a map that is created by leafletJS. I fitBounds the map to polygon area and my pointer is fixed in center of the map but in the special case like below my polygon is in a shape that the pointer does not fits in the polygon bounds although I fitBounds to polygon bound.
what shall I do for the polygons which the centered pointer does not place in polygon area in first load?
const selectedPoint = point([mapCenter.lat, mapCenter.lng])
const poly = polygon([polygonCoords])
const isPointInPolygon = booleanPointInPolygon(selectedPoint, poly)
if (isPointInPolygon) {
// onDragEnd && onDragEnd({ latitude: mapCenter?.lat, longitude: mapCenter?.lng })
} else {
toast({ content: formatMessage(strings.selectInPolygonError), type: 'error' })
onDragEnd && onDragEnd(null)
myMap.fitBounds(mapPolygon.getBounds())
}