indexOfTappedPath method
Implementation
int indexOfTappedPath(TapEvent tapEvent) {
Mappoint tapped = tapEvent.mappoint;
for (int idx = 0; idx < _path.length - 1; ++idx) {
Mappoint point0 = tapEvent.projection.latLonToPixel(_path[idx]);
Mappoint point1 = tapEvent.projection.latLonToPixel(_path[idx + 1]);
double distance = LatLongUtils.distanceSegmentPoint(point0.x, point0.y, point1.x, point1.y, tapped.x, tapped.y);
if (distance <= renderInfo!.renderInstruction.fontSize) return idx;
}
return -1;
}