私は賢者のタッチを学んでおり、Googleマップにマーカーを置いています。私はほとんどの例をオンラインで見てきましたが、マーカーとinfoWindowを動作させることができません。以下は私のコードです:Sencha touch - Googleマップのマーカーがありません
myApp.views.MapCard = Ext.extend(Ext.Panel, {
id: "mapcard",
layout: 'card',
initComponent: function() {
this.map = new Ext.Map({
useCurrentLocation: true,
mapOptions: {
zoom: 12,
},
});
this.panel = new Ext.Panel({
layout: 'fit',
items: this.map,
});
this.items = this.panel;
myApp.views.MapCard.superclass.initComponent.call(this);
refresh = function(theMap) {
var geoTag = {
lat: '47.584863',
longi: '-122.147026',
text: 'Hello World',
}
addMarker(geoTag, theMap);
}
addMarker = function(geoTag, theMap) {
var latLng = new google.maps.LatLng(geoTag.lat, geoTag.longi);
var marker = new google.maps.Marker({
map: theMap.map,
position: latLng
});
google.maps.event.addListener(marker, "click", function() {
geoTagBubble.setContent(tweet.text);
geoTagBubble.open(theMap.map, marker);
});
};
geoTagBubble = new google.maps.InfoWindow();
refresh(this.map);
},
});
Ext.reg('mapcard', myApp.views.MapCard);
私はまた、ユーザーの現在位置を取得できませんよ、私はマップがinitComponent中にロードされていないことを確信しています。私は後で緯度/経度とループを引き出すためにjsonサービスを呼び出すことになります。より良い実装があれば教えてください!
ありがとうございます!あなたは、ビュー・ソースの下またはGitHubの上のソースコードを見つけることができます http://septa.mobi
:ここ