Results 1 to 3 of 3

Thread: Map inside of NavigationView isn't centered correctly

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    22
    Answers
    1
    Vote Rating
    0
      0  

    Default Answered: Map inside of NavigationView isn't centered correctly

    Hello,

    i am trying to put a Ext.Map as item into a NavigationView. My Problem is that neither the zoom-option nor the map.center are set correctly

    Code:
    Ext.define('myapp.view.Map', {
        extend: 'Ext.navigation.View',
        xtype: 'mappanel',
        
        config: {
            title: 'A Map',
            iconCls: 'map',
            
            items: {
                title: 'The Map',
                xtype: 'map',
                id: 'gmap',
                
                config: {
                    mapOptions: {
                        center: new google.maps.LatLng(52.3934598, 13.1298635),
                        zoom: 18,
                        mapTypeId: google.maps.MapTypeId.ROADMAP
                    },
    
    
                },
            }
        },
        
    });

  2. You don't need to use the config object in the map. Try this (haven't tested)

    Code:
    Ext.define('myapp.view.Map', {
        extend: 'Ext.navigation.View',
        xtype: 'mappanel',
    
        config: {
            title: 'A Map',
            iconCls: 'map',
    
            items: {
                title: 'The Map',
                xtype: 'map',
                mapOptions: {
                    center: new google.maps.LatLng(52.3934598, 13.1298635),
                    zoom: 18,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                }
            }
        }
    });

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      0  

    Default

    You don't need to use the config object in the map. Try this (haven't tested)

    Code:
    Ext.define('myapp.view.Map', {
        extend: 'Ext.navigation.View',
        xtype: 'mappanel',
    
        config: {
            title: 'A Map',
            iconCls: 'map',
    
            items: {
                title: 'The Map',
                xtype: 'map',
                mapOptions: {
                    center: new google.maps.LatLng(52.3934598, 13.1298635),
                    zoom: 18,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                }
            }
        }
    });
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    22
    Answers
    1
    Vote Rating
    0
      0  

    Default

    Thank you, that really solved the Problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •