]> git.proxmox.com Git - sencha-touch.git/blob - src/examples/oreilly/app/view/tab/Location.js
import Sencha Touch 2.4.2 source
[sencha-touch.git] / src / examples / oreilly / app / view / tab / Location.js
1 Ext.define('Oreilly.view.tab.Location', {
2
3 extend: 'Ext.Container',
4 xtype: 'location',
5
6 config: {
7
8 title: 'Location',
9 iconCls: 'locate',
10
11 layout: 'fit',
12
13 items: [
14 {
15 docked: 'top',
16 xtype: 'toolbar',
17 title: 'Location'
18 }
19 ]
20 },
21
22 initialize: function() {
23
24 var position = new google.maps.LatLng(Oreilly.app.mapCenter[0], Oreilly.app.mapCenter[1]),
25 infoWindow = new google.maps.InfoWindow({ content: Oreilly.app.mapText }),
26 map, marker;
27
28 this.callParent();
29
30 map = this.add({
31 xtype: 'map',
32 mapOptions: {
33 center: position,
34 mapTypeId: google.maps.MapTypeId.ROADMAP
35 }
36 });
37
38 marker = new google.maps.Marker({
39 position: position,
40 map: map.getMap(),
41 visible: true
42 });
43
44 google.maps.event.addListener(marker, 'click', function() {
45 infoWindow.open(map, marker);
46 });
47
48 setTimeout(function() {
49 map.getMap().panTo(position);
50 }, 1000);
51 }
52 });