diff --git a/app/javascript/controllers/hello_controller.js b/app/javascript/controllers/hello_controller.js deleted file mode 100644 index 28fdb137..00000000 --- a/app/javascript/controllers/hello_controller.js +++ /dev/null @@ -1,18 +0,0 @@ -// Visit The Stimulus Handbook for more details -// https://stimulusjs.org/handbook/introduction -// -// This example controller works with specially annotated HTML like: -// -//
-//

-//
- -import { Controller } from "stimulus" - -export default class extends Controller { - static targets = [ "output" ] - - connect() { - this.outputTarget.textContent = 'Hello, Stimulus!' - } -} diff --git a/app/javascript/controllers/seats_controller.js b/app/javascript/controllers/seats_controller.js new file mode 100644 index 00000000..974b16f7 --- /dev/null +++ b/app/javascript/controllers/seats_controller.js @@ -0,0 +1,24 @@ +import { Controller } from "stimulus" +import svgPanZoom from "svg-pan-zoom" + +export default class extends Controller { + static targets = [ + "map", + ] + + connect() { + this.map = svgPanZoom(this.mapTarget, { + viewportSelector: "#map-viewport", + center: true, + fit: true, + zoomEnabled: false, + zoomScaleSensitivity: 0.75, + minZoom: 1.0, + maxZoom: 8, + }) + } + + disconnect() { + this.map.destroy() + } +} diff --git a/app/views/seats/index.html.erb b/app/views/seats/index.html.erb index 46826f46..5ec9a240 100644 --- a/app/views/seats/index.html.erb +++ b/app/views/seats/index.html.erb @@ -7,6 +7,7 @@