CUTR-at-USF / usf-mobullity

USF Maps responsive web application
http://maps.usf.edu/
8 stars 7 forks source link

"My Location" button doesn't seem to work #156

Closed barbeau closed 8 years ago

barbeau commented 8 years ago

On Chrome on my laptop from home.

Steps to reproduce:

  1. Open maps.usf.edu
  2. Wait for your position to show on map
  3. Drag map away from your position
  4. Click on "My location" button

What I see:

What I expect:

@jmfield2 Could you please take a look at this? Should be top priority as it seems broken on production. Thanks!

jmfield2 commented 8 years ago

I think this is happening because since disabling the Locate button code to only use our local geolocate callbacks, it would not have much to do once enabled unless the user actually moves (thus triggering the callback). There may be another issue that is preventing the appropriate style from cycling upon subsequent clicks (the icon should go between black and blue which corresponds to toggling the 'follow me' functionality) which seems to not work on chrome. This does seem to still work on FF for me.

To mitigate the 'nothing happens' issue, we can add the following to the L.Locate start method:

            if (webapp.map.currentLocation != false)
                webapp.map.lmap.panTo( webapp.map.currentLocation.latlng );

Which will pan the map back to the last location whenever the button is clicked (and should be 'activated').

Need some additional testing, but this might be enough for now.

jmfield2 commented 8 years ago

158 should fix this