Search code examples
iosgoogle-maps-sdk-ios

Increase tap area of GMSPolyline


,In our app, users can create GMS- features on a map. Those features are then editable, with the editing process starting from a tap. In some cases, if the style applied to a polyline is a 1 or 2 point line, they are difficult for a user to tap. I have researched this and found nothing on how to increase the tap area.

I would like to do something like adding a buffer around the line, such as in this example, but the buffer would not be visible to the user as it would only provide an increased tap area:

enter image description here

Does anyone know if this is possible? Any good resource on how to do this? Thanks!


Solution

  • If you want to know if the user tapped a location that is within a certain distance from a GMSPath you can use GMSGeometryIsLocationOnPathTolerance .

    Using this combined with the mapView:didTapAtCoordinate GMSMapViewDelegate method you're all set.