gmappanel移动到标记坐标 - EXTJS 4

时间:2013-02-26 21:54:11

标签: javascript google-maps extjs extjs4

 function addDoctorLocation(options) 
    {
        var gm = Ext.getCmp('mygooglemap');
        var mpoint = new google.maps.LatLng(options.lat,options.lng);
        var marker = gm.addMarker(mpoint,options.marker,false,false, options.listeners);
   // move the map to the mark and adjust the zoom level at here
    }

        tree.on('checkchange', function(node){
            var data = node.data;

            if (data.checked == true){

            lati = 5.391788482666016; 
            longi = 100.29693603515625; 

            var options = {
            lat:lati,
            lng:longi,
            marker: {title:"Hello World!"},
            listeners: {
                         click: function(e){

                                             }
                        }     
            }     
            addDoctorLocation(options);  
            }       
        })

问题

如何将地图移动到那里标记并调整缩放级别?

1 个答案:

答案 0 :(得分:0)

gm.setCenter(mpoint);
gm.setZoom(8);

请在此处查看google.maps.Map类的方法部分:https://developers.google.com/maps/documentation/javascript/reference?hl=en#Map