vue-geojson-view-ts 1.3.21 → 1.3.23
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/components/MapSearchAddress.vue.d.ts +1 -1
- package/dist/components/MapView.vue.d.ts +22 -0
- package/dist/style.css +1 -1
- package/dist/vue-geojson-view-ts.js +9835 -11162
- package/dist/vue-geojson-view-ts.umd.cjs +50 -66
- package/package.json +1 -1
- package/src/components/MapView.vue +69 -28
package/package.json
CHANGED
|
@@ -7,14 +7,9 @@
|
|
|
7
7
|
<script lang="ts">
|
|
8
8
|
import { defineComponent } from "vue";
|
|
9
9
|
import { markerDefault } from "../helpers/imgBase64";
|
|
10
|
-
import homeIconUrl from "../assets/home.png";
|
|
11
|
-
import endIconUrl from "../assets/end.png";
|
|
12
|
-
import trackingIconUrl from "../assets/tracking.png";
|
|
13
10
|
import origenIconUrl from "../assets/origen.png";
|
|
14
11
|
import destinoIconUrl from "../assets/destino.png";
|
|
15
12
|
import llegadaIconUrl from "../assets/llegada.png";
|
|
16
|
-
import DestinoIconReferencia from "../assets/address.svg";
|
|
17
|
-
import LLegadaSalidaIconReferencia from "../assets/entidad.svg";
|
|
18
13
|
import * as L from "leaflet";
|
|
19
14
|
import "leaflet-draw";
|
|
20
15
|
import "leaflet/dist/leaflet.css";
|
|
@@ -70,6 +65,8 @@ export default defineComponent({
|
|
|
70
65
|
getCoodMarker: { type: Function, required: false },
|
|
71
66
|
getGeoJSON: { type: Function, required: false },
|
|
72
67
|
loadPolygon: { type: Boolean, required: false },
|
|
68
|
+
markerCircleSize: { type: Number, required: false, default: 14 }, // px
|
|
69
|
+
markerSvgSize: { type: Number, required: false, default: 10 }, // px
|
|
73
70
|
},
|
|
74
71
|
data() {
|
|
75
72
|
return {
|
|
@@ -501,8 +498,9 @@ export default defineComponent({
|
|
|
501
498
|
if (Array.isArray(coordProps) && coordProps.length) {
|
|
502
499
|
for (let i = 0; i < coords.length; i++) {
|
|
503
500
|
// Unificar círculo y flecha en un solo divIcon
|
|
504
|
-
|
|
505
|
-
|
|
501
|
+
const circleSize = this.markerCircleSize || 14;
|
|
502
|
+
const svgSize = this.markerSvgSize || 10;
|
|
503
|
+
let iconHtml = `<div style="display:flex;align-items:center;justify-content:center;width:${circleSize}px;height:${circleSize}px;">`;
|
|
506
504
|
// Círculo azul con padding, envuelve el SVG
|
|
507
505
|
let arrowSvg = "";
|
|
508
506
|
if (
|
|
@@ -527,16 +525,20 @@ export default defineComponent({
|
|
|
527
525
|
let brng = Math.atan2(y, x);
|
|
528
526
|
brng = toDeg(brng);
|
|
529
527
|
const angle = (brng + 360) % 360;
|
|
530
|
-
arrowSvg = `<svg width="
|
|
528
|
+
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>`;
|
|
531
529
|
}
|
|
532
|
-
iconHtml +=
|
|
530
|
+
iconHtml +=
|
|
531
|
+
`<div style="background:#2196F3;border-radius:50%;border:1px solid #fff;box-shadow:0 0 2px #000;padding:1px;` +
|
|
532
|
+
`width:${circleSize - 6}px;` +
|
|
533
|
+
`height:${circleSize - 6}px;` +
|
|
534
|
+
`display:flex;align-items:center;justify-content:center;">${arrowSvg}</div>`;
|
|
533
535
|
iconHtml += "</div>";
|
|
534
536
|
const marker = L.marker([coords[i][1], coords[i][0]], {
|
|
535
537
|
icon: L.divIcon({
|
|
536
538
|
className: "",
|
|
537
539
|
html: iconHtml,
|
|
538
|
-
iconSize: [
|
|
539
|
-
iconAnchor: [
|
|
540
|
+
iconSize: [circleSize, circleSize],
|
|
541
|
+
iconAnchor: [circleSize / 2, circleSize / 2],
|
|
540
542
|
}),
|
|
541
543
|
zIndexOffset: -100,
|
|
542
544
|
});
|
|
@@ -599,10 +601,9 @@ export default defineComponent({
|
|
|
599
601
|
// Only render per-vertex markers/arrows when coordProperties exist and are non-empty
|
|
600
602
|
if (Array.isArray(coordProps) && coordProps.length) {
|
|
601
603
|
for (let i = 0; i < coords.length; i++) {
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
// Círculo azul con padding, envuelve el SVG
|
|
604
|
+
const circleSize = this.markerCircleSize || 14;
|
|
605
|
+
const svgSize = this.markerSvgSize || 10;
|
|
606
|
+
let iconHtml = `<div style="display:flex;align-items:center;justify-content:center;width:${circleSize}px;height:${circleSize}px;">`;
|
|
606
607
|
let arrowSvg = "";
|
|
607
608
|
if (
|
|
608
609
|
i < coords.length - 1 &&
|
|
@@ -613,7 +614,6 @@ export default defineComponent({
|
|
|
613
614
|
new Date(coordProps[i + 1].fecha) >
|
|
614
615
|
new Date(coordProps[i].fecha)
|
|
615
616
|
) {
|
|
616
|
-
// Calcular ángulo (bearing)
|
|
617
617
|
const toRad = (deg: number) => (deg * Math.PI) / 180;
|
|
618
618
|
const toDeg = (rad: number) => (rad * 180) / Math.PI;
|
|
619
619
|
const lat1 = toRad(coords[i][1]);
|
|
@@ -626,16 +626,20 @@ export default defineComponent({
|
|
|
626
626
|
let brng = Math.atan2(y, x);
|
|
627
627
|
brng = toDeg(brng);
|
|
628
628
|
const angle = (brng + 360) % 360;
|
|
629
|
-
arrowSvg = `<svg width="
|
|
629
|
+
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>`;
|
|
630
630
|
}
|
|
631
|
-
iconHtml +=
|
|
631
|
+
iconHtml +=
|
|
632
|
+
`<div style="background:#2196F3;border-radius:50%;border:1px solid #fff;box-shadow:0 0 2px #000;padding:1.5px;` +
|
|
633
|
+
`width:${circleSize - 6}px;` +
|
|
634
|
+
`height:${circleSize - 6}px;` +
|
|
635
|
+
`display:flex;align-items:center;justify-content:center;">${arrowSvg}</div>`;
|
|
632
636
|
iconHtml += "</div>";
|
|
633
637
|
const marker = L.marker([coords[i][1], coords[i][0]], {
|
|
634
638
|
icon: L.divIcon({
|
|
635
639
|
className: "",
|
|
636
640
|
html: iconHtml,
|
|
637
|
-
iconSize: [
|
|
638
|
-
iconAnchor: [
|
|
641
|
+
iconSize: [circleSize, circleSize],
|
|
642
|
+
iconAnchor: [circleSize / 2, circleSize / 2],
|
|
639
643
|
}),
|
|
640
644
|
});
|
|
641
645
|
marker.addTo(featureGroup);
|
|
@@ -939,14 +943,51 @@ export default defineComponent({
|
|
|
939
943
|
const formatIsoPreserve = (iso: string): string => {
|
|
940
944
|
const d = new Date(iso);
|
|
941
945
|
if (isNaN(d.getTime())) return iso;
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
946
|
+
|
|
947
|
+
// Intentamos usar Intl para formatear en la zona horaria de Bolivia (America/La_Paz)
|
|
948
|
+
try {
|
|
949
|
+
const parts = new Intl.DateTimeFormat("es-BO", {
|
|
950
|
+
timeZone: "America/La_Paz",
|
|
951
|
+
year: "numeric",
|
|
952
|
+
month: "2-digit",
|
|
953
|
+
day: "2-digit",
|
|
954
|
+
hour: "2-digit",
|
|
955
|
+
minute: "2-digit",
|
|
956
|
+
second: "2-digit",
|
|
957
|
+
hour12: false,
|
|
958
|
+
}).formatToParts(d);
|
|
959
|
+
|
|
960
|
+
const getPart = (type: string) =>
|
|
961
|
+
parts.find((p) => p.type === type)?.value || "";
|
|
962
|
+
const day = getPart("day");
|
|
963
|
+
const month = getPart("month");
|
|
964
|
+
const year = getPart("year");
|
|
965
|
+
const hour = getPart("hour");
|
|
966
|
+
const minute = getPart("minute");
|
|
967
|
+
const second = getPart("second");
|
|
968
|
+
|
|
969
|
+
return `${day}/${month}/${year} ${hour}:${minute}:${second}`;
|
|
970
|
+
|
|
971
|
+
// const pad = (n: number) => n.toString().padStart(2, "0");
|
|
972
|
+
// const day = pad(d.getUTCDate());
|
|
973
|
+
// const month = pad(d.getUTCMonth() + 1);
|
|
974
|
+
// const year = d.getUTCFullYear();
|
|
975
|
+
// const hours = pad(d.getUTCHours());
|
|
976
|
+
// const minutes = pad(d.getUTCMinutes());
|
|
977
|
+
// const seconds = pad(d.getUTCSeconds());
|
|
978
|
+
// return `${day}/${month}/${year} ${hours}:${minutes}:${seconds}`;
|
|
979
|
+
} catch (error) {
|
|
980
|
+
// Fallback: aplicar un offset fijo de -4 horas (Bolivia) sobre la fecha UTC recibida.
|
|
981
|
+
const boliviaOffsetMinutes = -4 * 60; // UTC-4
|
|
982
|
+
const localMs = d.getTime() + boliviaOffsetMinutes * 60_000;
|
|
983
|
+
const bd = new Date(localMs);
|
|
984
|
+
const pad = (n: number) => n.toString().padStart(2, "0");
|
|
985
|
+
return `${pad(bd.getUTCDate())}/${pad(
|
|
986
|
+
bd.getUTCMonth() + 1
|
|
987
|
+
)}/${bd.getUTCFullYear()} ${pad(bd.getUTCHours())}:${pad(
|
|
988
|
+
bd.getUTCMinutes()
|
|
989
|
+
)}:${pad(bd.getUTCSeconds())}`;
|
|
990
|
+
}
|
|
950
991
|
};
|
|
951
992
|
|
|
952
993
|
// Formatear fecha a dd-MM-yyyy hh:mm:ss
|