Closed JokerSora closed 1 year ago
You can safely use this function to determine if you tapped on a polygon.
` static bool isPointInPolygon(LatLng point, Polygon polygon) { double x = point.latitude, y = point.longitude;
bool inside = false;
for (var i = 0, j = polygon.points.length - 1;
i < polygon.points.length;
j = i++) {
var xi = polygon.points[i].latitude, yi = polygon.points[i].longitude;
var xj = polygon.points[j].latitude, yj = polygon.points[j].longitude;
var intersect =
((yi > y) != (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
inside = intersect ? !inside : inside;
}
return inside;
}`
This package aims to make polylines tappable not polygons
em,now polygon can't be tapped