Skip to content
This repository was archived by the owner on May 20, 2024. It is now read-only.

Commit 56ff00b

Browse files
committed
fix some map stuff
1 parent 4d91f89 commit 56ff00b

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

src/groupInfo/components/GroupGalleryMap.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<script>
1414
import StandardMap from '@/maps/components/StandardMap'
1515
import { groupMarker } from '@/maps/components/markers'
16-
import L from 'leaflet'
16+
import { latLngBounds } from 'leaflet/dist/leaflet-src.esm'
1717
1818
export default {
1919
components: { StandardMap },
@@ -66,7 +66,7 @@ export default {
6666
if (this.myCoordinates) {
6767
coordsForBounds.push(this.myCoordinates)
6868
}
69-
return L.latLngBounds(coordsForBounds).pad(0.2)
69+
return latLngBounds(coordsForBounds).pad(0.2)
7070
},
7171
singleGroup () {
7272
if (this.groupsWithCoordinates.length === 1) {

src/maps/components/Map.story.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import GroupMap from './GroupMap'
66
import UserMapPreview from './UserMapPreview'
77
import StandardMap from './StandardMap'
88
import { usersMock, placesMock, placeWithoutLocation } from '>/mockdata'
9-
import L from 'leaflet'
9+
import { latLng as LlatLng } from 'leaflet/dist/leaflet-src.esm'
1010

1111
const style = {
1212
height: '200px',
1313
}
1414

1515
function latLng (place) {
16-
return L.latLng(place.latitude, place.longitude)
16+
return LlatLng(place.latitude, place.longitude)
1717
}
1818

1919
const currentGroup = {

src/maps/components/StandardMap.vue

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import {
5858
5959
import ExtendedMarker from './ExtendedMarker'
6060
61-
import L from 'leaflet'
61+
import { Icon as LIcon, latLngBounds } from 'leaflet/dist/leaflet-src.esm'
6262
6363
import {
6464
QMenu,
@@ -70,8 +70,8 @@ import shadowUrl from 'leaflet/dist/images/marker-shadow.png'
7070
7171
// fix default marker icon
7272
// https://github.com/Leaflet/Leaflet/issues/4968
73-
delete L.Icon.Default.prototype._getIconUrl
74-
L.Icon.Default.mergeOptions({ iconRetinaUrl, iconUrl, shadowUrl })
73+
delete LIcon.Default.prototype._getIconUrl
74+
LIcon.Default.mergeOptions({ iconRetinaUrl, iconUrl, shadowUrl })
7575
7676
const SELECTED_OPACITY = 1
7777
const UNSELECTED_OPACITY = 0.5
@@ -213,7 +213,7 @@ export default {
213213
if (this.forceBounds) return this.forceBounds
214214
if (this.forceCenter && !Number.isNaN(this.forceCenter.lat)) return null
215215
if (!this.preventZoom && this.hasMarkers && !this.hasOneMarker) {
216-
return L.latLngBounds(this.markersForBound.map(m => m.latLng)).pad(0.2)
216+
return latLngBounds(this.markersForBound.map(m => m.latLng)).pad(0.2)
217217
}
218218
return undefined
219219
},
@@ -245,6 +245,9 @@ export default {
245245
}
246246
return undefined
247247
},
248+
centerAndZoom () {
249+
return [this.center, this.zoom]
250+
},
248251
},
249252
watch: {
250253
zoom (val) {
@@ -260,6 +263,24 @@ export default {
260263
})
261264
}
262265
},
266+
/* TODO use or drop
267+
bounds (bounds) {
268+
this.$nextTick(() => {
269+
if (!this.leafletObject) return
270+
if (!bounds) return
271+
if (!bounds.isValid()) return
272+
this.leafletObject.flyToBounds(bounds)
273+
})
274+
},
275+
centerAndZoom ([center, zoom]) {
276+
this.$nextTick(() => {
277+
if (!this.leafletObject) return
278+
if (!center) return
279+
if (!zoom) return
280+
this.leafletObject.flyTo(center, zoom)
281+
})
282+
},
283+
*/
263284
},
264285
methods: {
265286
dragend ({ target }, marker) {

0 commit comments

Comments
 (0)