Hello, people.
I'm having a great time learning Sencha Touch but it seems to me that somethings should be simpler or are buggy. What I'm trying to do right now is add a Marker to show the current location on a Map.
I have a Viewport with a top Toolbar and a TabPanel, with a Map on the first card (tab) and I can get the current location without a problem. The problem I'm having is with the creation of the marker indicating where I am.
I've tried event listeners on both the map and it's parent container, but still can't get it to work. Maybe it's a scope problem?! Any help would be much appreciated...
Code:
Ext.setup({
...
onReady: function() {
var TopBar, Tabs, MapHome, Viewport, Homecard;
/*
* HOME
*/
MapHome = new Ext.Map({
title: 'Map',
useCurrentLocation: true
});
Homecard = new Ext.Panel({
title: "home",
iconCls: "home",
items: [MapHome],
listeners: {
activate: function() {
var marker = new google.maps.Marker({
position: MapHome.map.center,
title : 'testing',
map: MapHome.map
});
}
}
});
/*
* MAIN
*/
TopBar = new Ext.Toolbar({
dock: 'top',
xtype: "toolbar",
title: "<img class='titleLogo' src='css/images/logo.png' />",
items: [
{ xtype: 'spacer' },
{
iconCls: 'settings9',
iconMask: true,
text: 'options'
}
]
});
Tabs = new Ext.TabPanel({
id: 'tabs',
//fullscreen:true,
dock: 'bottom',
flex: 1,
tabBar: {
dock: 'bottom',
layout: {
pack: 'center'
}
},
items: [ Homecard]
});
Viewport = new Ext.Panel({
fullscreen:true,
layout:{type:'vbox',align: 'stretch'},
useLoadMask:true,
ui:'dark',
items: [TopBar,Tabs],
});
}
});