Hey there all, I am wanting my users to be able to log back into our site, and when they go to the map, i need it to remember the last position they were at and load that. How can i have the ym4r get the center and zoom of a client? shawn -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ym4r-user/attachments/20080913/a036a882/attachment.html>
What I''ve been doing (on more of an "edit this location" page) is adding event handlers that monitor drag/zoom changes and stash the values into form fields and allowing them to save. No reason you cannot send the value back up to the server via AJAX though. Not sure if you need to detect the movement of a marker or the map though. map.event_init marker, :dragend, "function(){ var latlng = marker.getPoint(); document.getElementById(''location_lat'').value = latlng.lat(); document.getElementById(''location_lng'').value = latlng.lng(); document.getElementById(''location_manually_placed'').checked = true;" + (update_message ? "document.getElementById(''message'').innerText = ''Press UPDATE to save this relocation.''}" : ""); map.event_init map, :zoomend, "function(o,n){ document.getElementById(''location_zoom'').value = n;" + (update_message ? "document.getElementById(''message'').innerText = ''Press UPDATE to save this zoom change.'' }" : ""); regards, Adam -- Adam Jack adam.jack at gmail.com http://wildobs.com/adam_jack http://neukadye.com On Sep 13, 2008, at 8:43 AM, shawn bright wrote:> Hey there all, > I am wanting my users to be able to log back into our site, and when > they go to the map, i need it to remember the last position they > were at and load that. > How can i have the ym4r get the center and zoom of a client? > > shawn > _______________________________________________ > Ym4r-user mailing list > Ym4r-user at rubyforge.org > http://rubyforge.org/mailman/listinfo/ym4r-user
thanks, will see what i can work out with this. -sk On Sat, Sep 13, 2008 at 3:26 PM, Adam Jack <adam.jack at gmail.com> wrote:> What I''ve been doing (on more of an "edit this location" page) is adding > event handlers that monitor drag/zoom changes and stash the values into form > fields and allowing them to save. No reason you cannot send the value back > up to the server via AJAX though. Not sure if you need to detect the > movement of a marker or the map though. > > map.event_init marker, :dragend, "function(){ > var latlng = marker.getPoint(); > document.getElementById(''location_lat'').value = latlng.lat(); > document.getElementById(''location_lng'').value = latlng.lng(); > document.getElementById(''location_manually_placed'').checked = true;" + > (update_message ? > "document.getElementById(''message'').innerText = ''Press UPDATE to > save this relocation.''}" : > ""); > > map.event_init map, :zoomend, "function(o,n){ > document.getElementById(''location_zoom'').value = n;" + > (update_message ? > "document.getElementById(''message'').innerText = ''Press UPDATE to > save this zoom change.'' }" : > ""); > > regards, > > Adam > -- > Adam Jack > adam.jack at gmail.com > http://wildobs.com/adam_jack > http://neukadye.com > > > On Sep 13, 2008, at 8:43 AM, shawn bright wrote: > > Hey there all, >> I am wanting my users to be able to log back into our site, and when they >> go to the map, i need it to remember the last position they were at and load >> that. >> How can i have the ym4r get the center and zoom of a client? >> >> shawn >> _______________________________________________ >> Ym4r-user mailing list >> Ym4r-user at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ym4r-user >> > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ym4r-user/attachments/20080913/1c91d1bd/attachment.html>