google-maps-ios-utils icon indicating copy to clipboard operation
google-maps-ios-utils copied to clipboard

Detect touch on marker or cluster

Open hoangtam101 opened this issue 8 years ago • 5 comments

Hi Guy How can i detect touch on marker or cluster ? Touch on number or image simulator screen shot jul 27 2016 2 56 35 pm

hoangtam101 avatar Jul 27 '16 07:07 hoangtam101

I do the following to zoom when on a cluster vs on a marker:

func mapView(mapView: GMSMapView, didTapMarker marker: GMSMarker) -> Bool {

    let zoom = defaults.floatForKey(AppDelegate.zoomNamespace)

    let zoomIncrement:Float = 0.5

    let zoomIn = GMSCameraUpdate.zoomTo(zoom+zoomIncrement)


    let clusters = clusterManager.clusterAlgorithm.getClusters(zoom)

    for (_, cluster) in clusters.enumerate() {

        if cluster.isKindOfClass(GStaticCluster) {

            let clusterMarker = (cluster as! GStaticCluster).marker

            if clusterMarker.position.latitude == marker.position.

latitude

                && clusterMarker.position.longitude == marker.position.

longitude {

                // Click on cluster to zoom in

                self.mapView.animateWithCameraUpdate(zoomIn)

            }

        }

    }

On Tue, Jul 26, 2016 at 9:57 PM, TamNguyen [email protected] wrote:

Hi Guy How can i detect touch on marker or cluster ? Touch on number or image [image: simulator screen shot jul 27 2016 2 56 35 pm] https://cloud.githubusercontent.com/assets/9377583/17168028/578f6b44-540a-11e6-9c76-f0170285bbca.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DDRBoxman/google-maps-ios-utils/issues/32, or mute the thread https://github.com/notifications/unsubscribe-auth/ACqz9JStGi9K5wu-gP1jiO4UlGyED4Zxks5qZw9TgaJpZM4JV7im .

jamesynotnot avatar Jul 27 '16 21:07 jamesynotnot

Hi thank you for your comment But i want detect touch on number zoom map to show item marker inside this.

hoangtam101 avatar Jul 28 '16 01:07 hoangtam101

ok i got it. Thank you so much

hoangtam101 avatar Jul 28 '16 01:07 hoangtam101

Hey guy. When i touch on number cluster i want to zoom map to level show all item marker inside this. How to implement ? Thanks,

hoangtam101 avatar Jul 28 '16 02:07 hoangtam101

@hoangtam101 check issue 30

hope it will help you.

Cheers!

hyd00 avatar Nov 23 '16 07:11 hyd00