Open-Historical-Map-Labs / openhistoricaltiles

First iteration of vector tiles from OHM Planet data
BSD 2-Clause "Simplified" License
3 stars 0 forks source link

Make url refreshes smoother (remove flash of South Bronx) #50

Closed jeffreyameyer closed 5 years ago

jeffreyameyer commented 5 years ago

Currently, when the demo is refreshed for a URL-specified time & place, eg. https://openhistoricalmap.github.io/openhistoricaltiles/mbgl-control-timeslider/demo/#13.401/50.05426/19.95121/600,600-1950

Immediately on hitting refresh, you briefly see a flash of the South Bronx, which is weird, as that's not where the map was before the refresh & not where it ends up after the refresh is done.

Desired behavior is not to see the South Bronx, and only to see the area you were originally looking at.

gregallensworth commented 5 years ago

As of 0983d3e the demo will override START_CENTER and START_ZOOM before the map is loaded, so the map will start centered on the target area. This avoids the flash of starting view in New York.

There is still a flash of all content, unfiltered by date at first, as the date filtering cannot happen until after the map is loaded so layers are initialized. The workaround here would be somewhat more tedious and arguably a bit contrived toward this one use case:

jeffreyameyer commented 5 years ago

Is it really just one use case or one that happens every time someone loads a new url or fidgets with url params directly?

On Wed, Jun 5, 2019 at 10:33 AM Greg Allensworth notifications@github.com wrote:

As of 0983d3e https://github.com/OpenHistoricalMap/openhistoricaltiles/commit/0983d3e5f6ea9a7917de2c05accb8c2e9204c799 the demo will override START_CENTER and START_ZOOM before the map is loaded, so the map will start centered on the target area. This avoids the flash of starting view in New York.

There is still a flash of all unfiltered date content at first, as the date filtering cannot happen until after the map is loaded so layers are initialized. The workaround here would be somewhat more tedious and arguably a bit contrived toward this one use case:

  • set visibility: none on all layers in that GLMAP_STYLE starting style
  • add to the TimeSliderControl support for a new event callback, when the date filtering has been established
  • have that timesliderready callback, set visibility: visible on all of the layers which are being managed by the TimeSlider

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OpenHistoricalMap/openhistoricaltiles/issues/50?email_source=notifications&email_token=AALM4EQFYB7ZTKSOIVLCYVTPY72HNA5CNFSM4HTAI5AKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXAOOFI#issuecomment-499181333, or mute the thread https://github.com/notifications/unsubscribe-auth/AALM4EXPCRNRTKTSOPVMEZLPY72HNANCNFSM4HTAI5AA .

-- 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

gregallensworth commented 5 years ago

b06931e brings the second part: demo.js has workarounds to hide the OHM layers until the TimeSliderControl is underway, then to re-enable them. The effect is far less "flash" of date-unfiltered content at startup.