Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Paris, France
    Posts
    46
    Vote Rating
    0
    Arekkk is on a distinguished road

      0  

    Default Bug found in Ext.Map 'useCurrentLocation'

    Bug found in Ext.Map 'useCurrentLocation'


    Hi Guys,

    I think that i've found a bug on the useCurrentLocation option.
    When i'm trying to use it and navigate in the rendered map, the map is going everytime after a little delay back to the center (current location coordinates), avoiding the user to navigate inside..

    Here is my code :
    Code:
        extend: 'Ext.Panel',
        xtype:'storefinder',
        config: {
             items: [
             {
                    xtype: 'map',
                    useCurrentLocation : true,
                    height: 420,
                    width: 318,
                    docked: 'top',
                    mapOptions: {
                          zoom: 12
                    },
                    listeners: {
                          more options below...
    Let me know if you know why it does this, or if it's a bug in the sdk.
    Thanks !

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,645
    Vote Rating
    816
    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


    I'm not seeing a bug.

    Code:
    new Ext.Container({
        fullscreen : true,
        layout     : 'fit',
        items      : [
            {
                xtype              : 'map',
                useCurrentLocation : true,
                mapOptions         : {
                    zoom : 12
                }
            }
        ]
    });
    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
    Nov 2011
    Location
    Paris, France
    Posts
    46
    Vote Rating
    0
    Arekkk is on a distinguished road

      0  

    Default


    Still the same. Can't find why...
    Code:
    Ext.define("AppTouch2.view.boutique.storefinder", {
        extend: 'Ext.Container',
        xtype:'storefinder',
        config: {
        	   layout:'fit',
        items: [
                {
                xtype              : 'map',
                useCurrentLocation : true,
                mapOptions         : {
                    zoom : 12
                }

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    54
    Vote Rating
    0
    Rui Marinho is on a distinguished road

      0  

    Default


    i can report i have the same issue, the map pans to the center (default location) like if it sometime of timeout i removed the useDefaultLocation to solve it. and i handle my own geolocation.
    sdk rc 2.0.1

  5. #5
    Touch Premium Member svenna's Avatar
    Join Date
    Jun 2007
    Location
    Oslo,Norway
    Posts
    523
    Vote Rating
    22
    svenna has a spectacular aura about svenna has a spectacular aura about

      0  

    Default


    I can confirm. This is a bug.

    It looks like the geo location created as default when using useCurrentLocation is updated about every 5 secs. This is "fine" when you are actually moving, but Touch need a simple config option to create the geo location without auto update.

    I guess Chrome sends a location update from time to time, and that's what triggering the "recenter".

    The Sencha Map object still have a few issues.. I've yet to find an event that can retrieve the map object with getMap() (on painted, render, show etc is to early).

    On show often works, often not, right now I'm using a 1000ms delay on the painted event. But this problem have forum post back to touch 1.

    In this event create the geo location object and pans the map. However with this method the map is of on the first paint, and then centered after 1000ms.

    May also try the other way around, use the useCurrenctLocation again, and then turning autoUpdate later, with something like a map.getGeo().setAutoUpdate(false);

    Code:
    var geo = Ext.create('Ext.util.Geolocation', {
        autoUpdate: false
    });
    
    //Must be run with e.g 1000ms delay, of the getMap() will note include the map.
    var gmap = this.getMap();  
    var infowindow = new google.maps.InfoWindow();
    
    
    geo.updateLocation(function(){
        var loc = new google.maps.LatLng(geo.getLatitude('lat') , geo.getLongitude('lng'));
        gmap.panTo(loc);
    });
    
    Ext.getStore('Oppgaver').each(function(record){
        if (record.get('lat')) {
            var loc = new google.maps.LatLng(record.get('lat') , record.get('lng'));
            var marker = new google.maps.Marker({
                map: gmap,
                position: loc,
                title: record.get('kundenavn')
            });
    
            google.maps.event.addListener(marker, "click", function() {
                // console.log(marker,record);
                // gmap.panTo(marker.getPosition());
                infowindow.setContent("<h1>"+record.get('kundenavn')+"</h1>"+record.get('adresse')+"<br>"+record.get('postnr')+" "+record.get('poststed')+"<br>"+record.get('arbeidstype'));
                infowindow.open(gmap, marker);
    
            });
    
    
        }
    },this);
    Sven Tore Iversen

  6. #6
    Sencha User
    Join Date
    Nov 2011
    Location
    Paris, France
    Posts
    46
    Vote Rating
    0
    Arekkk is on a distinguished road

      0  

    Default


    I found a manual solution.
    On the activate i'm taking the navigator position (navigator.geolocation.getCurrentPosition) and then rendering the map with it in the center option instead of the useCurrentLocation.

    Code:
    activate : function(){    			
         navigator.geolocation.getCurrentPosition(function(position) {
         geoPosition.latitude = position.coords.latitude;
         geoPosition.longitude = position.coords.longitude;
         geoPosition.googlePosition = new google.maps.LatLng(geoPosition.latitude,geoPosition.longitude);
         renderZeMap();
     });
    				
     renderZeMap = function(){
    				
         Ext.getCmp('storeFinder').add({
              xtype: 'map',
    	  mapOptions: {
    	       zoom : 14,
    	       center: geoPosition.googlePosition
    	  },
    ...
    Hope it could help you guys

  7. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,645
    Vote Rating
    816
    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


    Code:
    useCurrentLocation : {
        autoUpdate : false
    }
    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.

  8. #8
    Touch Premium Member svenna's Avatar
    Join Date
    Jun 2007
    Location
    Oslo,Norway
    Posts
    523
    Vote Rating
    22
    svenna has a spectacular aura about svenna has a spectacular aura about

      0  

    Default


    Thanks, Architect defines useCurrentLocation as a true/false, guess it fooled me to miss the "config" part of or geo object
    Sven Tore Iversen

  9. #9
    Sencha User
    Join Date
    Oct 2012
    Posts
    1
    Vote Rating
    0
    betocollin is on a distinguished road

      0  

    Default Not clearly explained...

    Not clearly explained...


    Quote Originally Posted by mitchellsimoens View Post
    Code:
    useCurrentLocation : {
        autoUpdate : false
    }
    What do you mean by this if the option "useCurrentLocation" accepts only a boolean according to Sencha Architect?

    I tried with mapOptions property and geo but no success.

    I could made an override but as Sencha do not recommend I would prefer not doing it.

    Thanks.