开发者

Sencha Touch Google Maps marker listener not working

开发者 https://www.devze.com 2023-03-25 21:45 出处:网络
I\'m having an issue with listeners on Google Maps. var marker_icon = new google.maps.MarkerImage(\'images/map/\' + thisIcon + \'.png\', new google.maps.Size(32, 32));var trafficMarker = new google.m

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

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(trafficMark开发者_Python百科er, '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.


There is a bug in the current version of Sencha Touch.

There is a fix here:- Maps Listener on click.

Just add the following code before initiating maps:

Ext.gesture.Manager.onMouseEventOld = Ext.gesture.Manager.onMouseEvent;
Ext.gesture.Manager.onMouseEvent = function(e) {
var target = e.target;

while (target) {
    if (Ext.fly(target) && Ext.fly(target).hasCls('x-map')) {
        return;
    }

    target = target.parentNode;
}

this.onMouseEventOld.apply(this, arguments);
};

Hope this helps!


google.maps.event

not

google.maps.Event

0

精彩评论

暂无评论...
验证码 换一张
取 消