Closed danrademacher closed 5 years ago
In theory, the hashchange
event could work this way... if not for the fact that the slider updates the params. A change to the slider state updates the URL params, so having URL params update the slider state forms a circular condition.
I spent some hours working on the resulting bugs back when I first created the UrlHashReader
and UrlHashWriter
and never got it to work acceptably. Eventually I just had the UrlHashReader
run once at page start, and gave up on having it monitor for hashchange
events.
Still, I can put some hours into trying stuff.
I have added the hashchange
handler for the MBGL version of the slider here, so you can give it a try. https://openhistoricalmap.github.io/openhistoricaltiles/mbgl-control-timeslider/demo/
It seems to be basically working as expected, despite my previous problems with it during earlier development some months back. So that's good.
Seems to work just right on the MBGL demo!
Here is an implementation for Leaflet. Beyond simply being a wrapper to the MBGL TimeSlider.Urlhashreader, this also needs to adjust the Leaflet map's own lat/lng/zoom.
https://openhistoricalmap.github.io/openhistoricaltiles/leaflet-control-mbgltimeslider/demo/
This one has a bit of "twitchy" feeling to it, since vector tiles for Leaflet is in fact handled by an underlying Mapbox GL API map, so there's some lag while it updates a whole second map API. But it seems to work properly here, despite those issues I had some months back.
Nice work!!
On Thu, Oct 24, 2019 at 3:18 PM Greg Allensworth notifications@github.com wrote:
Here is an implementation for Leaflet. Beyond simply being a wrapper to the MBGL TimeSlider.Urlhashreader, this also needs to adjust the Leaflet map's own lat/lng/zoom.
https://openhistoricalmap.github.io/openhistoricaltiles/leaflet-control-mbgltimeslider/demo/
This one has a bit of "twitchy" feeling to it, since vector tiles for Leaflet is in fact handled by an underlying Mapbox GL API map, so there's some lag while it updates a whole second map API. But it seems to work properly here, despite those issues I had some months back.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OpenHistoricalMap/openhistoricaltiles/issues/67?email_source=notifications&email_token=AALM4ERIV4LJU57U4737T6DQQINK5A5CNFSM4JE3JLQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECGTPJA#issuecomment-546125732, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALM4ESDT5C4CCMMH7GE2XLQQINK5ANCNFSM4JE3JLQA .
-- Jeff Meyer 206-676-2347 osm: Open Historical Map (OHM) http://wiki.openstreetmap.org/wiki/Open_Historical_Map / my OSM user page http://www.openstreetmap.org/user/jeffmeyer t: @OpenHistMap
During a call with Jeff this morning, I was trying to inspect a certain location by copying URL params from OHM site into the demo, but the map didn't respond as I expected. As shown here:
The application reverts to whatever params were loaded before.
Alternatively, if I create the URL in a text editor and paste into a new tab, it loads as expected:
Is there a way to make the timeslider respond to manual changes of parameters in the URL?
Depending on level of effort, we may or may not do this.