vue-geojson-view-ts 1.3.15 → 1.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue-geojson-view-ts.js +433 -423
- package/dist/vue-geojson-view-ts.umd.cjs +11 -11
- package/package.json +1 -1
- package/src/components/MapView.vue +25 -2
package/package.json
CHANGED
|
@@ -453,11 +453,20 @@ export default defineComponent({
|
|
|
453
453
|
pointToLayer: this.getPointToLayer.bind(this),
|
|
454
454
|
onEachFeature: function (feature, layer) {
|
|
455
455
|
featureGroup.addLayer(layer);
|
|
456
|
-
// Mostrar popup
|
|
456
|
+
// Mostrar popup para Point
|
|
457
457
|
if (feature.geometry.type === "Point") {
|
|
458
458
|
var popupContent = self.getPopupContent(feature);
|
|
459
459
|
layer.bindPopup(popupContent);
|
|
460
460
|
}
|
|
461
|
+
// Mostrar popup para Polygon y MultiPolygon al hacer clic
|
|
462
|
+
else if (
|
|
463
|
+
feature.geometry.type === "Polygon" ||
|
|
464
|
+
feature.geometry.type === "MultiPolygon"
|
|
465
|
+
) {
|
|
466
|
+
var tooltipContent =
|
|
467
|
+
self.getPolygonTooltipContent(feature);
|
|
468
|
+
layer.bindPopup(tooltipContent);
|
|
469
|
+
}
|
|
461
470
|
},
|
|
462
471
|
});
|
|
463
472
|
}
|
|
@@ -475,11 +484,19 @@ export default defineComponent({
|
|
|
475
484
|
L.geoJson(item, {
|
|
476
485
|
onEachFeature: function (feature, layer) {
|
|
477
486
|
featureGroup.addLayer(layer);
|
|
478
|
-
// Mostrar popup
|
|
487
|
+
// Mostrar popup para Point
|
|
479
488
|
if (feature.geometry.type === "Point") {
|
|
480
489
|
var popupContent = self.getPopupContent(feature);
|
|
481
490
|
layer.bindPopup(popupContent);
|
|
482
491
|
}
|
|
492
|
+
// Mostrar popup para Polygon y MultiPolygon al hacer clic
|
|
493
|
+
else if (
|
|
494
|
+
feature.geometry.type === "Polygon" ||
|
|
495
|
+
feature.geometry.type === "MultiPolygon"
|
|
496
|
+
) {
|
|
497
|
+
var tooltipContent = self.getPolygonTooltipContent(feature);
|
|
498
|
+
layer.bindPopup(tooltipContent);
|
|
499
|
+
}
|
|
483
500
|
},
|
|
484
501
|
});
|
|
485
502
|
}
|
|
@@ -660,6 +677,12 @@ export default defineComponent({
|
|
|
660
677
|
html += "</div>";
|
|
661
678
|
return html;
|
|
662
679
|
},
|
|
680
|
+
getPolygonTooltipContent(feature: any): string {
|
|
681
|
+
const props = feature.properties || {};
|
|
682
|
+
const descripcion = props.descripcion || props.name || "Sin descripción";
|
|
683
|
+
|
|
684
|
+
return `<div style="font-weight: bold; padding: 5px;">${descripcion}</div>`;
|
|
685
|
+
},
|
|
663
686
|
},
|
|
664
687
|
watch: {
|
|
665
688
|
coordinatesMap(newVal) {
|