77
77
</div >
78
78
79
79
<div class =" col-md-4" >
80
- <!-- TODO locator map -- >
80
+ <div id = " locator-map " ></ div >
81
81
<div class =" table-responsive" >
82
82
<table class =" table" >
83
83
<thead >
@@ -145,19 +145,8 @@ export default {
145
145
},
146
146
data () {
147
147
return {
148
+ locatorMap: null ,
148
149
map: null ,
149
- baseLayer: Leaflet .tileLayer (
150
- " https://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}@2x.png" ,
151
- {
152
- attribution: ` Map data <a href="https://www.openstreetmap.org/copyright">© OpenStreetMap contributors</a>, © <a href="https://carto.com/attributions">CARTO</a>`
153
- }
154
- ),
155
- labelLayer: Leaflet .tileLayer (
156
- " https://{s}.basemaps.cartocdn.com/dark_only_labels/{z}/{x}/{y}@2x.png" ,
157
- {
158
- zIndex: 1000
159
- }
160
- ),
161
150
previewLayer: null ,
162
151
overlayLayer: null ,
163
152
geojsonOptions: {
@@ -343,6 +332,48 @@ export default {
343
332
},
344
333
methods: {
345
334
initialize () {
335
+ this .initializePreviewMap ();
336
+ this .initializeLocatorMap ();
337
+ },
338
+ initializeLocatorMap () {
339
+ this .locatorMap = Leaflet .map (" locator-map" , {
340
+ attributionControl: false ,
341
+ zoomControl: false ,
342
+ boxZoom: false ,
343
+ doubleClickZoom: false ,
344
+ dragging: false ,
345
+ scrollWheelZoom: false ,
346
+ touchZoom: false
347
+ });
348
+
349
+ Leaflet .tileLayer (
350
+ " https://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}@2x.png" ,
351
+ {
352
+ attribution: ` Map data <a href="https://www.openstreetmap.org/copyright">© OpenStreetMap contributors</a>, © <a href="https://carto.com/attributions">CARTO</a>`
353
+ }
354
+ ).addTo (this .locatorMap );
355
+ Leaflet .tileLayer (
356
+ " https://{s}.basemaps.cartocdn.com/dark_only_labels/{z}/{x}/{y}@2x.png" ,
357
+ {
358
+ zIndex: 1000
359
+ }
360
+ ).addTo (this .locatorMap );
361
+
362
+ const overlayLayer = Leaflet .geoJSON (this .item , {
363
+ pane: " tilePane" ,
364
+ style: {
365
+ weight: 1 ,
366
+ color: " #ffd65d" ,
367
+ opacity: 1 ,
368
+ fillOpacity: 1
369
+ }
370
+ }).addTo (this .locatorMap );
371
+
372
+ this .locatorMap .fitBounds (overlayLayer .getBounds (), {
373
+ padding: [95 , 95 ]
374
+ });
375
+ },
376
+ initializePreviewMap () {
346
377
this .map = Leaflet .map (" map" );
347
378
this .map .on (" moveend" , this .updateHash );
348
379
this .map .on (" zoomend" , this .updateHash );
@@ -361,18 +392,29 @@ export default {
361
392
this .map .getContainer ().classList .add (" leaflet-pseudo-fullscreen" );
362
393
}
363
394
364
- this .baseLayer .addTo (this .map );
365
- this .labelLayer .addTo (this .map );
395
+ Leaflet .tileLayer (
396
+ " https://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}@2x.png" ,
397
+ {
398
+ attribution: ` Map data <a href="https://www.openstreetmap.org/copyright">© OpenStreetMap contributors</a>, © <a href="https://carto.com/attributions">CARTO</a>`
399
+ }
400
+ ).addTo (this .map );
401
+ Leaflet .tileLayer (
402
+ " https://{s}.basemaps.cartocdn.com/dark_only_labels/{z}/{x}/{y}@2x.png" ,
403
+ {
404
+ zIndex: 1000
405
+ }
406
+ ).addTo (this .map );
366
407
367
408
if (this .tileSource ) {
368
409
this .tileLayer = Leaflet .tileLayer (this .tileSource , {
369
410
attribution: this .attribution
370
411
}).addTo (this .map );
371
412
}
372
413
373
- this .overlayLayer = Leaflet .geoJSON (this .item , this .geojsonOptions ).addTo (
374
- this .map
375
- );
414
+ this .overlayLayer = Leaflet .geoJSON (this .item , {
415
+ ... this .geojsonOptions ,
416
+ pane: " tilePane"
417
+ }).addTo (this .map );
376
418
377
419
if (this .center != null ) {
378
420
const [zoom , lat , lng ] = this .center ;
@@ -532,13 +574,10 @@ code {
532
574
z-index : 99999 ;
533
575
}
534
576
535
- .vue2leaflet-map {
577
+ #locator-map {
578
+ height : 200px ;
536
579
width : 100% ;
537
- height : 100% ;
538
- border : 1px solid #fff ;
539
- background-color : #090909 ;
540
- z-index : 1 ;
541
- position : relative ;
580
+ margin-bottom : 10px ;
542
581
}
543
582
544
583
#map-container {
0 commit comments