vue-geojson-view-ts 1.3.20 → 1.3.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-geojson-view-ts",
3
- "version": "1.3.20",
3
+ "version": "1.3.22",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -70,6 +70,8 @@ export default defineComponent({
70
70
  getCoodMarker: { type: Function, required: false },
71
71
  getGeoJSON: { type: Function, required: false },
72
72
  loadPolygon: { type: Boolean, required: false },
73
+ markerCircleSize: { type: Number, required: false, default: 14 }, // px
74
+ markerSvgSize: { type: Number, required: false, default: 10 }, // px
73
75
  },
74
76
  data() {
75
77
  return {
@@ -497,48 +499,56 @@ export default defineComponent({
497
499
  Array.isArray(feature.properties.coordProperties)
498
500
  ? feature.properties.coordProperties
499
501
  : [];
500
- for (let i = 0; i < coords.length; i++) {
501
- // Unificar círculo y flecha en un solo divIcon
502
- let iconHtml =
503
- '<div style="display:flex;align-items:center;justify-content:center;width:14px;height:14px;">';
504
- // Círculo azul con padding, envuelve el SVG
505
- let arrowSvg = "";
506
- if (
507
- i < coords.length - 1 &&
508
- coordProps[i] &&
509
- coordProps[i + 1] &&
510
- coordProps[i].fecha &&
511
- coordProps[i + 1].fecha &&
512
- new Date(coordProps[i + 1].fecha) >
513
- new Date(coordProps[i].fecha)
514
- ) {
515
- // Calcular ángulo (bearing)
516
- const toRad = (deg: number) => (deg * Math.PI) / 180;
517
- const toDeg = (rad: number) => (rad * 180) / Math.PI;
518
- const lat1 = toRad(coords[i][1]);
519
- const lat2 = toRad(coords[i + 1][1]);
520
- const dLon = toRad(coords[i + 1][0] - coords[i][0]);
521
- const y = Math.sin(dLon) * Math.cos(lat2);
522
- const x =
523
- Math.cos(lat1) * Math.sin(lat2) -
524
- Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLon);
525
- let brng = Math.atan2(y, x);
526
- brng = toDeg(brng);
527
- const angle = (brng + 360) % 360;
528
- arrowSvg = `<svg width="10" height="10" viewBox="0 0 22 22" style="display:block;transform:rotate(${angle}deg);"><polygon points="11,3 15,17 11,14 7,17" fill="#fff" stroke="#fff" stroke-width="1.5"/></svg>`;
502
+ // Only render per-vertex markers/arrows when coordProperties exist and are non-empty
503
+ if (Array.isArray(coordProps) && coordProps.length) {
504
+ for (let i = 0; i < coords.length; i++) {
505
+ // Unificar círculo y flecha en un solo divIcon
506
+ const circleSize = this.markerCircleSize || 14;
507
+ const svgSize = this.markerSvgSize || 10;
508
+ let iconHtml = `<div style="display:flex;align-items:center;justify-content:center;width:${circleSize}px;height:${circleSize}px;">`;
509
+ // Círculo azul con padding, envuelve el SVG
510
+ let arrowSvg = "";
511
+ if (
512
+ i < coords.length - 1 &&
513
+ coordProps[i] &&
514
+ coordProps[i + 1] &&
515
+ coordProps[i].fecha &&
516
+ coordProps[i + 1].fecha &&
517
+ new Date(coordProps[i + 1].fecha) >
518
+ new Date(coordProps[i].fecha)
519
+ ) {
520
+ // Calcular ángulo (bearing)
521
+ const toRad = (deg: number) => (deg * Math.PI) / 180;
522
+ const toDeg = (rad: number) => (rad * 180) / Math.PI;
523
+ const lat1 = toRad(coords[i][1]);
524
+ const lat2 = toRad(coords[i + 1][1]);
525
+ const dLon = toRad(coords[i + 1][0] - coords[i][0]);
526
+ const y = Math.sin(dLon) * Math.cos(lat2);
527
+ const x =
528
+ Math.cos(lat1) * Math.sin(lat2) -
529
+ Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLon);
530
+ let brng = Math.atan2(y, x);
531
+ brng = toDeg(brng);
532
+ const angle = (brng + 360) % 360;
533
+ arrowSvg = `<svg width="${svgSize}" height="${svgSize}" viewBox="0 0 22 22" style="display:block;transform:rotate(${angle}deg);"><polygon points="11,3 15,17 11,14 7,17" fill="#fff" stroke="#fff"/></svg>`;
534
+ }
535
+ iconHtml +=
536
+ `<div style="background:#2196F3;border-radius:50%;border:1px solid #fff;box-shadow:0 0 2px #000;padding:1px;` +
537
+ `width:${circleSize - 6}px;` +
538
+ `height:${circleSize - 6}px;` +
539
+ `display:flex;align-items:center;justify-content:center;">${arrowSvg}</div>`;
540
+ iconHtml += "</div>";
541
+ const marker = L.marker([coords[i][1], coords[i][0]], {
542
+ icon: L.divIcon({
543
+ className: "",
544
+ html: iconHtml,
545
+ iconSize: [circleSize, circleSize],
546
+ iconAnchor: [circleSize / 2, circleSize / 2],
547
+ }),
548
+ zIndexOffset: -100,
549
+ });
550
+ marker.addTo(featureGroup);
529
551
  }
530
- iconHtml += `<div style="background:#2196F3;border-radius:50%;border:1px solid #fff;box-shadow:0 0 2px #000;padding:1px;width:8px;height:8px;display:flex;align-items:center;justify-content:center;">${arrowSvg}</div>`;
531
- iconHtml += "</div>";
532
- const marker = L.marker([coords[i][1], coords[i][0]], {
533
- icon: L.divIcon({
534
- className: "",
535
- html: iconHtml,
536
- iconSize: [14, 14],
537
- iconAnchor: [7, 7],
538
- }),
539
- zIndexOffset: -100,
540
- });
541
- marker.addTo(featureGroup);
542
552
  }
543
553
  }
544
554
  }
@@ -593,47 +603,52 @@ export default defineComponent({
593
603
  Array.isArray(item.properties.coordProperties)
594
604
  ? item.properties.coordProperties
595
605
  : [];
596
- for (let i = 0; i < coords.length; i++) {
597
- // Unificar círculo y flecha en un solo divIcon
598
- let iconHtml =
599
- '<div style="display:flex;align-items:center;justify-content:center;width:14px;height:14px;">';
600
- // Círculo azul con padding, envuelve el SVG
601
- let arrowSvg = "";
602
- if (
603
- i < coords.length - 1 &&
604
- coordProps[i] &&
605
- coordProps[i + 1] &&
606
- coordProps[i].fecha &&
607
- coordProps[i + 1].fecha &&
608
- new Date(coordProps[i + 1].fecha) >
609
- new Date(coordProps[i].fecha)
610
- ) {
611
- // Calcular ángulo (bearing)
612
- const toRad = (deg: number) => (deg * Math.PI) / 180;
613
- const toDeg = (rad: number) => (rad * 180) / Math.PI;
614
- const lat1 = toRad(coords[i][1]);
615
- const lat2 = toRad(coords[i + 1][1]);
616
- const dLon = toRad(coords[i + 1][0] - coords[i][0]);
617
- const y = Math.sin(dLon) * Math.cos(lat2);
618
- const x =
619
- Math.cos(lat1) * Math.sin(lat2) -
620
- Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLon);
621
- let brng = Math.atan2(y, x);
622
- brng = toDeg(brng);
623
- const angle = (brng + 360) % 360;
624
- arrowSvg = `<svg width="10" height="10" viewBox="0 0 22 22" style="display:block;transform:rotate(${angle}deg);"><polygon points="11,3 15,17 11,14 7,17" fill="#fff" stroke="#fff" stroke-width="1.5"/></svg>`;
606
+ // Only render per-vertex markers/arrows when coordProperties exist and are non-empty
607
+ if (Array.isArray(coordProps) && coordProps.length) {
608
+ for (let i = 0; i < coords.length; i++) {
609
+ const circleSize = this.markerCircleSize || 14;
610
+ const svgSize = this.markerSvgSize || 10;
611
+ let iconHtml = `<div style="display:flex;align-items:center;justify-content:center;width:${circleSize}px;height:${circleSize}px;">`;
612
+ let arrowSvg = "";
613
+ if (
614
+ i < coords.length - 1 &&
615
+ coordProps[i] &&
616
+ coordProps[i + 1] &&
617
+ coordProps[i].fecha &&
618
+ coordProps[i + 1].fecha &&
619
+ new Date(coordProps[i + 1].fecha) >
620
+ new Date(coordProps[i].fecha)
621
+ ) {
622
+ const toRad = (deg: number) => (deg * Math.PI) / 180;
623
+ const toDeg = (rad: number) => (rad * 180) / Math.PI;
624
+ const lat1 = toRad(coords[i][1]);
625
+ const lat2 = toRad(coords[i + 1][1]);
626
+ const dLon = toRad(coords[i + 1][0] - coords[i][0]);
627
+ const y = Math.sin(dLon) * Math.cos(lat2);
628
+ const x =
629
+ Math.cos(lat1) * Math.sin(lat2) -
630
+ Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLon);
631
+ let brng = Math.atan2(y, x);
632
+ brng = toDeg(brng);
633
+ const angle = (brng + 360) % 360;
634
+ arrowSvg = `<svg width="${svgSize}" height="${svgSize}" viewBox="0 0 22 22" style="display:block;transform:rotate(${angle}deg);"><polygon points="11,3 15,17 11,14 7,17" fill="#fff" stroke="#fff"/></svg>`;
635
+ }
636
+ iconHtml +=
637
+ `<div style="background:#2196F3;border-radius:50%;border:1px solid #fff;box-shadow:0 0 2px #000;padding:1.5px;` +
638
+ `width:${circleSize - 6}px;` +
639
+ `height:${circleSize - 6}px;` +
640
+ `display:flex;align-items:center;justify-content:center;">${arrowSvg}</div>`;
641
+ iconHtml += "</div>";
642
+ const marker = L.marker([coords[i][1], coords[i][0]], {
643
+ icon: L.divIcon({
644
+ className: "",
645
+ html: iconHtml,
646
+ iconSize: [circleSize, circleSize],
647
+ iconAnchor: [circleSize / 2, circleSize / 2],
648
+ }),
649
+ });
650
+ marker.addTo(featureGroup);
625
651
  }
626
- iconHtml += `<div style="background:#2196F3;border-radius:50%;border:1px solid #fff;box-shadow:0 0 2px #000;padding:1.5px;width:8px;height:8px;display:flex;align-items:center;justify-content:center;">${arrowSvg}</div>`;
627
- iconHtml += "</div>";
628
- const marker = L.marker([coords[i][1], coords[i][0]], {
629
- icon: L.divIcon({
630
- className: "",
631
- html: iconHtml,
632
- iconSize: [14, 14],
633
- iconAnchor: [7, 7],
634
- }),
635
- });
636
- marker.addTo(featureGroup);
637
652
  }
638
653
  }
639
654
  }
@@ -952,7 +967,11 @@ export default defineComponent({
952
967
  // Seleccionar el icono de referencia según el tipo (1 -> Destino, else -> LLegadaSalida)
953
968
  const tipo = props.tipo;
954
969
  const referenciaIcon =
955
- tipo === 1 ? DestinoIconReferencia : LLegadaSalidaIconReferencia;
970
+ tipo === 0
971
+ ? origenIconUrl
972
+ : tipo === 1
973
+ ? destinoIconUrl
974
+ : llegadaIconUrl;
956
975
 
957
976
  // Construir HTML del popup con mejor UI para la imagen
958
977
  // Contenedor externo controla el ancho; el popup tiene su propia clase para limitar altura
@@ -965,7 +984,7 @@ export default defineComponent({
965
984
  // Icono de referencia a la izquierda de la descripción
966
985
  html += `<div style="display:flex;align-items:center;gap:8px;padding-top:6px;">`;
967
986
  if (referenciaIcon) {
968
- html += `<img src="${referenciaIcon}" style="width:20px;height:20px;flex:0 0 20px;"/>`;
987
+ html += `<img src="${referenciaIcon}" style="width:30px;height:30px;flex:0 0 15px;"/>`;
969
988
  }
970
989
  if (fechaFormateada) {
971
990
  html += `<div style="font-size:14px;"><b>${descripcion}:</b> ${fechaFormateada}</div>`;