-
17 May 2012 6:42 AM #1
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 :
Let me know if you know why it does this, or if it's a bug in the sdk.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...
Thanks !
-
17 May 2012 6:56 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,710
- Vote Rating
- 436
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
17 May 2012 7:31 AM #3
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 }
-
20 May 2012 4:39 PM #4
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
-
20 Jun 2012 1:25 AM #5
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
-
20 Jun 2012 3:57 AM #6
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.
Hope it could help you guysCode: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 }, ...
-
20 Jun 2012 4:33 AM #7Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,710
- Vote Rating
- 436
Code:useCurrentLocation : { autoUpdate : false }Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
20 Jun 2012 4:49 AM #8
Thanks, Architect defines useCurrentLocation as a true/false, guess it fooled me to miss the "config" part of or geo object
Sven Tore Iversen
-
31 Oct 2012 7:45 AM #9
Not clearly explained...
Not clearly explained...
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.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote