【问题标题】:Sencha Touch Google Maps marker listener not workingSencha Touch Google Maps 标记监听器不工作
【发布时间】:2011-08-05 10:07:12
【问题描述】:

我在 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 以查看它是否响应,但它没有。我试过了,click,mousedown,mouseup等。

谢谢。

【问题讨论】:

    标签: javascript google-maps sencha-touch


    【解决方案1】:

    当前版本的 Sencha Touch 存在一个错误。

    这里有一个修复:- 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);
    };
    

    希望这会有所帮助!

    【讨论】:

      【解决方案2】:

      google.maps.event

      不是

      google.maps.Event

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-05-03
        • 1970-01-01
        相关资源
        最近更新 更多