johnpipo1712 / jquery-ui-map

Automatically exported from code.google.com/p/jquery-ui-map
0 stars 0 forks source link

watchPosition not working under jqm 1.1.1? #63

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Take this working example 
http://jquery-ui-map.googlecode.com/svn/trunk/demos/jquery-google-maps-mobile.ht
ml#gps_map
2. switch from jqm 1.0 to 1.1.1
3.

What is the expected output? What do you see instead?
The view should pan to the current position but instead, the map is initialized 
and stays in the starting position

What version of the product are you using? On what operating system?
jquery-ui-map v3, jquery 1.7.1, jqm 1.1.1

Please provide any additional information below.
I was using jqm1.1.0 and switched to jqm1.1.1, now the jquery-ui-map seems not 
to work properly (at least on this instruction)
Here's the code I used:

function loadGMaps() {
    $(document).live('pageinit', function() {
        $('#main-map').gmap({'disableDefaultUI':true, 'callback': function(map) {           
            var self = this;            
            self.watchPosition( function(position, status) {
                if ( status === 'OK' ) {
                    var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
                    if ( !self.get('markers').client ) {
                        self.addMarker({ 'id': 'client', 'position': latlng, 'bounds': true });
                    } else {
                        self.get('markers').client.setPosition(latlng);
                        map.panTo(latlng);
                    }
                    /*self.search({ 'address': 'Vancouver, Canada' }, function(results, status) {               
                        if ( status === 'OK' ) {
                            console.log(results[0]);
                            }
                        });*/
                }
            });         
        }});
    }); 

    $(document).live( 'pageshow', function() {
        $('#main-map').gmap('refresh')
    });

    $(document).live( 'pagehide', function() {
        $('#main-map').gmap('clearWatch')
    });

}

Original issue reported on code.google.com by diego.ma...@gmail.com on 31 Aug 2012 at 12:09

GoogleCodeExporter commented 8 years ago
Do we have a resource working on this yet?

Original comment by prosof...@gmail.com on 3 Sep 2012 at 1:48

GoogleCodeExporter commented 8 years ago
I am also experiencing the same issue using JQM 1.1.1

Original comment by jadail...@gmail.com on 13 Sep 2012 at 10:27