Unverified Commit 187e2ee9 authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera Committed by GitHub
Browse files

Merge branch 'master' into playground-controls-attribution

parents cbd50415 ffcbad69
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@
      <router-link to="/marker">Marker</router-link>
      <router-link to="/circle">Circle</router-link>
      <router-link to="/control-attribution">Attribution</router-link>
      <router-link to="/icon">Icon</router-link>
      <router-link to="/control-custom-message">Custom Message</router-link>
    </div>
    <div class="map-wrapper">
      <router-view />
+4 −0
Original line number Diff line number Diff line
@@ -11,6 +11,10 @@ const routes = [
  {
    path: "/control-attribution",
    component: () => import("./views/ControlAttribution.vue"),
  { path: "/icon", component: () => import("./views/Icon.vue") },
  {
    path: "/control-custom-message",
    component: () => import("./views/ControlCustomMessage.vue"),
  },
];

+32 −0
Original line number Diff line number Diff line
<template>
  <l-map ref="map" :zoom="2" :center="[47.41322, -1.219482]">
    <l-tile-layer
      url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
      layer-type="base"
      name="OpenStreetMap"
    ></l-tile-layer>
    <l-control class="leaflet-control leaflet-demo-control"
      >Hello, Map!</l-control
    >
  </l-map>
</template>
<script>
import { LMap, LTileLayer, LControl } from "./../../components";

export default {
  components: {
    LMap,
    LTileLayer,
    LControl,
  },
};
</script>

<style>
.leaflet-demo-control {
  background: white;
  border: 1px solid steelblue;
  border-radius: 0.6em;
  padding: 0.5em;
}
</style>
+54 −0
Original line number Diff line number Diff line
<template>
  <div style="width: 100%; height: 100%;">
    <l-map ref="map" v-model:zoom="zoom" :center="[47.41322, -1.219482]">
      <l-tile-layer
        url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
        layer-type="base"
        name="OpenStreetMap"
      ></l-tile-layer>

      <l-marker :lat-lng="[47.41322, -1.219482]">
        <l-icon :icon-url="iconUrl" :icon-size="iconSize" />
      </l-marker>
    </l-map>

    <button @click="changeIcon">New kitten icon</button>
  </div>
</template>
<script>
import { LMap, LTileLayer, LMarker, LIcon } from "./../../components";

export default {
  components: {
    LMap,
    LTileLayer,
    LMarker,
    LIcon,
  },
  data() {
    return {
      zoom: 8,
      iconWidth: 45,
      iconHeight: 90,
    };
  },
  computed: {
    iconUrl() {
      return `https://placekitten.com/${this.iconWidth}/${this.iconHeight}`;
    },
    iconSize() {
      return [this.iconWidth, this.iconHeight];
    },
  },
  methods: {
    changeIcon() {
      this.iconWidth += 1;
      if (this.iconWidth > this.iconHeight) {
        this.iconWidth = Math.floor(this.iconHeight / 2);
      }
    },
  },
};
</script>

<style></style>