1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    21
    Vote Rating
    1
    daftwolfie is on a distinguished road

      0  

    Default Unanswered: Google Map keeps centering to current location

    Unanswered: Google Map keeps centering to current location


    Hi all, my map displays two markers, my current location and another marker which has a lat and long. My map always seems to be centering to my current location. If I were to remove ' useCurrentLocation: true,', the map would display default locations with no markers. Is there a way in which I can center it to the other marker instead? Thank you!!

    Here's the map code:

    Code:
    Ext.define('demo.view.Mapo', {
        extend: 'Ext.Map',
        xtype:'mapo',
        config: {
            title:'Incident Location',
            iconCls:'maps',
            layout:'fit',
            draggable: true,
            useCurrentLocation: true,
            mapOptions: {
                zoom: 11,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            }
        },
        initialize: function(){
            var me = this;
            me.on('maprender', function(comp, map){
    		var image = 'resources/images/current.png';
    			new google.maps.Marker({
                    position: new google.maps.LatLng(
                            this._geo.getLatitude(), 
                            this._geo.getLongitude()
                    ),
    				icon: image,
                    map: map,
                    title: "Current Location",
                    animation: google.maps.Animation.DROP
                });
    		for (i=0; i<5; i++){
    		
    		var data = Ext.getStore('news').getData().items[i].data
    		};
                new google.maps.Marker({
                    position: new google.maps.LatLng(
                            data.Latitude, 
                            data.Longitude
                    ),
    				//icon: image,
                    map: map,
                    title: "Incident Location",
                    animation: google.maps.Animation.BOUNCE
                });
    			
    			
            });
            me.callParent(arguments);
        }
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,731
    Answers
    3362
    Vote Rating
    754
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    This is because you have useCurrentLocation set to true. When the Geolocation class gets a new position it will center on that.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    91
    Vote Rating
    2
    satishs is on a distinguished road

      0  

    Default


    Hello daftwolfie:

    I am running into same issue, did you get this resolved? Setting useCurrentLocation to false, renders the map at a different zoom level that I want .

    How can the refresh to center at current location be prevented?. Can you please share your solution if you've resolved it.

    Thanks.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar