Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add panning and zooming to SVG map element
This commit adds a dependency on the [`svg-pan-zoom` package][svg-pan-zoom]. The plus and minus buttons introduced in the previous commit are decorated with `data-action` declarations which route `click` events to the `seats#zoomIn` and `seats#zoomOut` actions, respectively. When navigating to other floors (i.e. navigations that trigger `seats#discardMap`), [destroy the `svg-pan-zoom` provided instance] during Stimulus' [`disconnect` lifecycle method][disconnect], which is invoked during Turbolinks-initiated page visits, even for elements annotated with `data-turbolinks-permanent`. This commit wraps the collection of `<use>` elements in an outer [`<g>` element][g-element] (as suggested by [aritutta/svg-pan-zoom#146]). [svg-pan-zoom]: https://github.com/ariutta/svg-pan-zoom/tree/3.6.0 [g-element]: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/g [aritutta/svg-pan-zoom#146]: bumbu/svg-pan-zoom#146 [destroy]: https://github.com/ariutta/svg-pan-zoom/tree/3.6.0#public-api [disconnect]: https://stimulusjs.org/reference/lifecycle-callbacks#disconnection
- Loading branch information