2011-08-05 81 views
0

我在Google地图上遇到了侦听器问题。Sencha触摸Google地图标记侦听器不工作

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)); 
    }); 

听众似乎存在问题,因为它没有触及console.log('touched marker');.

我试着改变监听器到trafficMap来查看是否响应,但它没有。我已经尝试过,点击,mousedown,mouseup等。

谢谢。

回答

0

google.maps.event

google.maps.Event

1

有一个在煎茶触摸的当前版本中的错误。

这里有一个修复: - Maps Listener on click

启动前的地图只需添加以下代码:

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); 
}; 

希望这有助于!