OZtree
OZtree copied to clipboard
Tour controller (was: Tour URL format)
After discussion with @jrosindell , we think that the simplest format for a URL for a tour is something like
www.onezoom.org/life/my_tour
which can be distinguished from a "normal" geo-located URL because of the lack of @ sign, i.e. it's not www.onezoom.org/life/@foo=bar. This should play nicely with e.g. partner pages, which can be of the form www.onezoom.org/linnean/my_tour.
We think that ?tour=dinosaurs:4 is less fraught with parsing mishap than the above. Where "4" is the number of the tourstop in sequence (OTT might be more stable, but not necessarily unique in a tour).
record_url will need to preserve it, so a copy-pasted URL will also continue at that tourstop if you've paused the tour and started poking around.
You may have to assume that tours start paused, so starting means a click and autoplay.
The bulk of this work here will be a Tour (javascript) controller, that can be plumbed into URL state and trigger an update.
The tour controller should also be responsible for the tutorial / screensaver wiring. I'm not sure if there should be some consideration for pre-loading the tutorial. But it's unlikely worth the effort.
Also as part of this the initialisation of Tour needs to be tightened up. setup_page() return types are a bit vague, depending on what is handed in, and the ready promise is a bit messy.
- [x] Manage the destruction of any old Tour objects (presumably we have a screensaver + active tour slot?) by calling a destructor on the Tour class, which allows it to detach and destroy any associated DOM, solving #199
The above, after doing a lot of ~unrelated bugfixes, introduces controller_tour. This means I can do e.g. onezoom.controller.tour_start('/tour/tutorial_MDmouse') from the /life page.
Next step is to add an option for managing the tour via. URL, as described above.
The above adds a "tour" querystring parameter, which looks like tour=/tour/tutorial@2, where "2" is an optional tourstop number. The URL is parsed well enough that we won't mistake it for the @ in the OTT.
Merged into main with https://github.com/OneZoom/OZtree/pull/639