1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    2
    Vote Rating
    0
    Jasard is on a distinguished road

      0  

    Default Google Maps Marker Listener Not Working

    Google Maps Marker Listener Not Working


    Hi, I'm having an issue with listeners on Google Maps.

    Code:
    var marker_icon = new google.maps.MarkerImage('images/map/' + thisIcon + '.png', new google.maps.Size(32, 32));        var trafficMarker = new google.maps.Marker({
                position: new google.maps.LatLng(alert.lat, alert.lon),
                map: trafficMap,
                icon: marker_icon,
                id: 'trafficAlertIcon' + i
            });
            console.log('Test Log3');
                
            google.maps.Event.addListener(trafficMarker, 'mousedown', function() 
            {
                console.log('touched marker');
                trafficTabPanel.layout.setActiveItem(1, {type: 'slide', direction: 'left'});
                LoadIncidentMap(this.id.substring(16));
            });
    There seems to be an issue with the listener as it is not hitting the console.log('touched marker');.

    I've tried changing the listener to trafficMap to see if that responds but it does not. I have tried, click, mousedown, mouseup etc.

    Thanks.

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    0
    jrboddie is on a distinguished road

      0  

    Default


    Try:

    google.maps.event.addListener()


    Lower case on 'event'.

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Posts
    2
    Vote Rating
    0
    Jasard is on a distinguished road

      0  

    Default


    That did actually fix it, which is peculiar because I only just changed it to that as a last ditch attempt to get it working! It wasn't working previously like that so I'm wondering if it's a coincidence and it was resolved some other way... very odd.

    An additional issue which mousedown / mouseup throws instead of using click (click does not work) is that if you accidentally press down on the marker to drag the map, it always fires the listener.