Sha256: 5e8d353124c6816195d82938e9c1bed1437fde84e1ec1cf133caba7e25896d87

Contents?: true

Size: 1.21 KB

Versions: 11

Compression:

Stored size: 1.21 KB

Contents

import * as L from "leaflet";
import MapController from "src/decidim/map/controller"

const openLink = window.open;

export default class MapStaticController extends MapController {
  start() {
    this.map.removeControl(this.map.zoomControl);
    this.map.dragging.disable();
    this.map.touchZoom.disable();
    this.map.doubleClickZoom.disable();
    this.map.scrollWheelZoom.disable();
    this.map.boxZoom.disable();
    this.map.keyboard.disable();
    if (this.map.tap) {
      this.map.tap.disable();
    }

    if (this.config.zoom) {
      this.map.setZoom(this.config.zoom);
    } else {
      this.map.setZoom(15);
    }

    if (this.config.latitude && this.config.longitude) {
      const coordinates = [this.config.latitude, this.config.longitude];

      this.map.panTo(coordinates);
      const marker = L.marker(coordinates, {
        icon: this.createIcon(),
        keyboard: true,
        title: this.config.title
      }).addTo(this.map);
      marker._icon.removeAttribute("tabindex");
    }

    if (this.config.link) {
      this.map._container.addEventListener("click", (ev) => {
        ev.preventDefault();
        this.map._container.focus();
        openLink(this.config.link, "_blank");
      });
    }
  }
}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decidim-core-0.27.3 app/packs/src/decidim/map/controller/static.js
decidim-core-0.26.7 app/packs/src/decidim/map/controller/static.js
decidim-core-0.26.5 app/packs/src/decidim/map/controller/static.js
decidim-core-0.27.2 app/packs/src/decidim/map/controller/static.js
decidim-core-0.27.1 app/packs/src/decidim/map/controller/static.js
decidim-core-0.26.4 app/packs/src/decidim/map/controller/static.js
decidim-core-0.27.0 app/packs/src/decidim/map/controller/static.js
decidim-core-0.26.3 app/packs/src/decidim/map/controller/static.js
decidim-core-0.27.0.rc2 app/packs/src/decidim/map/controller/static.js
decidim-core-0.27.0.rc1 app/packs/src/decidim/map/controller/static.js
decidim-core-0.26.2 app/packs/src/decidim/map/controller/static.js