@m4l/gclick 0.3.7 → 0.3.8

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.
Files changed (89) hide show
  1. package/components/ReportsViewer/subcomponents/ReportSheetMapFitBounds/ReportSheetMapFitBounds.d.ts +3 -2
  2. package/components/ReportsViewer/subcomponents/ReportSheetMapFitBounds/ReportSheetMapFitBounds.d.ts.map +1 -1
  3. package/components/ReportsViewer/subcomponents/ReportSheetMapFitBounds/ReportSheetMapFitBounds.js +16 -20
  4. package/components/index.d.ts +1 -0
  5. package/components/index.d.ts.map +1 -1
  6. package/components/maps/components/GpsMap/constants.d.ts +1 -0
  7. package/components/maps/components/GpsMap/constants.d.ts.map +1 -1
  8. package/components/maps/components/GpsMap/constants.js +16 -14
  9. package/components/maps/components/GpsMap/contexts/MapContext/MapContext.d.ts +2 -1
  10. package/components/maps/components/GpsMap/contexts/MapContext/MapContext.d.ts.map +1 -1
  11. package/components/maps/components/GpsMap/contexts/MapContext/helpers/featureObservability.d.ts +28 -0
  12. package/components/maps/components/GpsMap/contexts/MapContext/helpers/featureObservability.d.ts.map +1 -0
  13. package/components/maps/components/GpsMap/contexts/MapContext/helpers/featureObservability.js +111 -0
  14. package/components/maps/components/GpsMap/contexts/MapContext/helpers/geoJsonBounds.d.ts +9 -0
  15. package/components/maps/components/GpsMap/contexts/MapContext/helpers/geoJsonBounds.d.ts.map +1 -0
  16. package/components/maps/components/GpsMap/contexts/MapContext/helpers/geoJsonBounds.js +183 -0
  17. package/components/maps/components/GpsMap/contexts/MapContext/helpers/helpers.d.ts +112 -0
  18. package/components/maps/components/GpsMap/contexts/MapContext/helpers/helpers.d.ts.map +1 -0
  19. package/components/maps/components/GpsMap/contexts/MapContext/helpers/helpers.js +87 -0
  20. package/components/maps/components/GpsMap/contexts/MapContext/helpers/layerDataBounds.d.ts +10 -0
  21. package/components/maps/components/GpsMap/contexts/MapContext/helpers/layerDataBounds.d.ts.map +1 -0
  22. package/components/maps/components/GpsMap/contexts/MapContext/helpers/layerDataBounds.js +12 -0
  23. package/components/maps/components/GpsMap/contexts/MapContext/index.d.ts +2 -1
  24. package/components/maps/components/GpsMap/contexts/MapContext/index.d.ts.map +1 -1
  25. package/components/maps/components/GpsMap/contexts/MapContext/store.d.ts +6 -2
  26. package/components/maps/components/GpsMap/contexts/MapContext/store.d.ts.map +1 -1
  27. package/components/maps/components/GpsMap/contexts/MapContext/store.js +301 -123
  28. package/components/maps/components/GpsMap/contexts/MapContext/types.d.ts +191 -20
  29. package/components/maps/components/GpsMap/contexts/MapContext/types.d.ts.map +1 -1
  30. package/components/maps/components/GpsMap/contexts/MapContext/types.js +8 -0
  31. package/components/maps/components/GpsMap/featureRenders/CommonFeatureRender/index.d.ts.map +1 -1
  32. package/components/maps/components/GpsMap/featureRenders/CommonFeatureRender/index.js +93 -124
  33. package/components/maps/components/GpsMap/hooks/index.d.ts +3 -0
  34. package/components/maps/components/GpsMap/hooks/index.d.ts.map +1 -1
  35. package/components/maps/components/GpsMap/hooks/useAutoFocus/helpers.d.ts +12 -0
  36. package/components/maps/components/GpsMap/hooks/useAutoFocus/helpers.d.ts.map +1 -0
  37. package/components/maps/components/GpsMap/hooks/useAutoFocus/helpers.js +29 -0
  38. package/components/maps/components/GpsMap/hooks/useAutoFocus/index.d.ts +1 -4
  39. package/components/maps/components/GpsMap/hooks/useAutoFocus/index.d.ts.map +1 -1
  40. package/components/maps/components/GpsMap/hooks/useAutoFocus/index.js +32 -59
  41. package/components/maps/components/GpsMap/hooks/useAutoFocus/types.d.ts +4 -13
  42. package/components/maps/components/GpsMap/hooks/useAutoFocus/types.d.ts.map +1 -1
  43. package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.d.ts +7 -0
  44. package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.d.ts.map +1 -0
  45. package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.js +42 -0
  46. package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.types.d.ts +19 -0
  47. package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.types.d.ts.map +1 -0
  48. package/components/maps/components/GpsMap/hooks/useObservableFeatureEventHandlers.d.ts +12 -0
  49. package/components/maps/components/GpsMap/hooks/useObservableFeatureEventHandlers.d.ts.map +1 -0
  50. package/components/maps/components/GpsMap/hooks/useObservableFeatureEventHandlers.js +43 -0
  51. package/components/maps/components/GpsMap/index.d.ts +1 -0
  52. package/components/maps/components/GpsMap/index.d.ts.map +1 -1
  53. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/constants.d.ts +5 -0
  54. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/constants.d.ts.map +1 -1
  55. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/constants.js +20 -13
  56. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/index.d.ts +4 -3
  57. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/index.d.ts.map +1 -1
  58. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/index.js +175 -120
  59. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/types.d.ts +6 -0
  60. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/types.d.ts.map +1 -1
  61. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/subcomponents/MyActions/MyActions.d.ts.map +1 -1
  62. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/subcomponents/MyActions/MyActions.js +26 -12
  63. package/components/maps/components/GpsMap/subcomponents/LayersContainer/subcomponents/Layer/Layer.js +1 -1
  64. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/constants.d.ts +6 -0
  65. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/constants.d.ts.map +1 -1
  66. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/constants.js +38 -26
  67. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useDatagridFiltered.js +26 -26
  68. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useFilterAndSort/useFilterAndSort.js +27 -27
  69. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useMaster.js +4 -4
  70. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useModuleDynamicActions.d.ts +1 -1
  71. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useModuleDynamicActions.d.ts.map +1 -1
  72. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useModuleDynamicActions.js +34 -28
  73. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useRowActionsGetter.d.ts.map +1 -1
  74. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useRowActionsGetter.js +41 -36
  75. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useTabFiltered.js +17 -17
  76. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/Form.d.ts.map +1 -1
  77. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/Form.js +16 -18
  78. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useDrawing.d.ts +3 -2
  79. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useDrawing.d.ts.map +1 -1
  80. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useDrawing.js +136 -92
  81. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/GeneralData.d.ts.map +1 -1
  82. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/GeneralData.js +29 -23
  83. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceFeatureRender/GeofenceFeatureRender.d.ts +1 -1
  84. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceFeatureRender/GeofenceFeatureRender.d.ts.map +1 -1
  85. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceFeatureRender/GeofenceFeatureRender.js +60 -95
  86. package/components/maps/index.d.ts +1 -0
  87. package/components/maps/index.d.ts.map +1 -1
  88. package/index.js +143 -136
  89. package/package.json +3 -4
@@ -1,9 +1,12 @@
1
1
  export * from './useDisableMapEventsOnMouseOver';
2
2
  export * from './useDisableMapEventsOnFlag';
3
+ export * from './useMapInteractionCapture';
4
+ export * from './useObservableFeatureEventHandlers';
3
5
  export * from './useMapStore';
4
6
  export * from './useRegisterMapToolController';
5
7
  export { useFilterDecimation } from './useFilterDecimation';
6
8
  export { createPixelPathDecimationFilter } from './useFilterDecimation/decimationMethods';
7
9
  export type { UseFilterDecimationConfig } from './useFilterDecimation';
8
10
  export type { PixelPathFilterConfig } from './useFilterDecimation/decimationMethods';
11
+ export type { UseMapInteractionCaptureOptions, UseMapInteractionCaptureResult, } from './useMapInteractionCapture.types';
9
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAC1F,YAAY,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,YAAY,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qCAAqC,CAAC;AACpD,cAAc,eAAe,CAAC;AAC9B,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAC1F,YAAY,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,YAAY,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,YAAY,EACV,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,kCAAkC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { LayerDataBounds, ViewportBounds } from '../../contexts/MapContext/types';
2
+ import { ActiveAutoFocusLayer } from './types';
3
+ export { areLayerDataBoundsEqual } from '../../contexts/MapContext/helpers/layerDataBounds';
4
+ /**
5
+ * Computes one union bounds from every active autofocus layer.
6
+ */
7
+ export declare function getActiveAutoFocusLayerBounds(layersWithAutoFocus: ActiveAutoFocusLayer[]): LayerDataBounds | undefined;
8
+ /**
9
+ * Converts serialized layer bounds into the host viewport bounds shape.
10
+ */
11
+ export declare function toViewportBounds(bounds: LayerDataBounds): ViewportBounds;
12
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/hooks/useAutoFocus/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAE5F;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,mBAAmB,EAAE,oBAAoB,EAAE,GAC1C,eAAe,GAAG,SAAS,CAuB7B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,cAAc,CAWxE"}
@@ -0,0 +1,29 @@
1
+ function r(t) {
2
+ if (t.length === 0)
3
+ return;
4
+ let a = t[0].dataBounds.southWest[0], s = t[0].dataBounds.southWest[1], e = t[0].dataBounds.northEast[0], o = t[0].dataBounds.northEast[1];
5
+ for (let h = 1; h < t.length; h++) {
6
+ const n = t[h].dataBounds;
7
+ a = Math.min(a, n.southWest[0]), s = Math.min(s, n.southWest[1]), e = Math.max(e, n.northEast[0]), o = Math.max(o, n.northEast[1]);
8
+ }
9
+ return {
10
+ southWest: [a, s],
11
+ northEast: [e, o]
12
+ };
13
+ }
14
+ function d(t) {
15
+ return {
16
+ southWest: {
17
+ lat: t.southWest[0],
18
+ lng: t.southWest[1]
19
+ },
20
+ northEast: {
21
+ lat: t.northEast[0],
22
+ lng: t.northEast[1]
23
+ }
24
+ };
25
+ }
26
+ export {
27
+ r as getActiveAutoFocusLayerBounds,
28
+ d as toViewportBounds
29
+ };
@@ -1,8 +1,5 @@
1
1
  /**
2
- * "useAutoFocus" esta pendiente de que las capas que tiene auto foucus y son visible o cuando cambien su features.
3
- * en cambios su propiedad de autoFocus o visible, el Efecto de autonEnfoque se activa, haciendo
4
- * que el mapa se ajuste a los límites de las capas que tienen auto focus.
5
- * @author Juan Escobar
2
+ * Keeps autofocus driven by cached layer-level data bounds instead of feature mount metadata.
6
3
  */
7
4
  export declare function useAutoFocus(): void;
8
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/hooks/useAutoFocus/index.tsx"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,wBAAgB,YAAY,SAkG3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/hooks/useAutoFocus/index.tsx"],"names":[],"mappings":"AAYA;;GAEG;AACH,wBAAgB,YAAY,SA4D3B"}
@@ -1,65 +1,38 @@
1
- import { useEffect as d } from "react";
2
- import { useMap as y } from "react-leaflet";
3
- import h from "lodash-es/throttle";
4
- import i from "leaflet";
5
- import { useMapStore as m } from "../useMapStore/index.js";
1
+ import { useRef as c, useMemo as m, useEffect as i } from "react";
2
+ import f from "lodash-es/throttle";
6
3
  import { deepShallow as p } from "@m4l/components";
7
- function j() {
8
- const f = y(), n = m((a) => a.autoFocusLayers ? a.layersIds.filter((o) => !!(a.hashLayers[o].autoFocus && a.hashLayers[o].visible)).map((o) => ({
9
- layerId: o,
10
- features: (function() {
11
- if (a.hashLayers[o].geoJsonObject?.object.type === "FeatureCollection")
12
- return (a.hashLayers[o].geoJsonObject?.object).features.filter((e) => e.layerData !== void 0).map((e) => ({ featureId: e.id, layerData: e.layerData }));
4
+ import { useMapStore as d } from "../useMapStore/index.js";
5
+ import { toViewportBounds as l, getActiveAutoFocusLayerBounds as B } from "./helpers.js";
6
+ import { areLayerDataBoundsEqual as h } from "../../contexts/MapContext/helpers/layerDataBounds.js";
7
+ function L() {
8
+ const u = d((o) => o.mapActions.moveToBounds), r = d((o) => o.autoFocusLayers ? o.layersIds.reduce((t, a) => {
9
+ const s = o.hashLayers[a];
10
+ return s?.autoFocus && s.visible && s.dataBounds && t.push({
11
+ layerId: a,
12
+ dataBounds: s.dataBounds,
13
+ dataBoundsVersion: s.dataBoundsVersion ?? 0
14
+ }), t;
15
+ }, []) : [], p), n = c(void 0), e = m(() => f((o) => {
16
+ const t = u(
17
+ l(o),
13
18
  {
14
- const t = a.hashLayers[o].geoJsonObject?.object;
15
- if (t.layerData !== void 0)
16
- return [{ featureId: t.id, layerData: t.layerData }];
19
+ animate: !1,
20
+ maxZoom: 22,
21
+ padding: [50, 50]
17
22
  }
18
- return [];
19
- })()
20
- })) : void 0, p);
21
- d(() => {
22
- const l = h((o) => {
23
- const t = [];
24
- for (const e of o) {
25
- const s = e?.features;
26
- for (let r = 0; r < s.length; r++) {
27
- const u = s[r];
28
- if (u.layerData !== void 0) {
29
- const c = {
30
- layerId: e.layerId,
31
- featureId: u.featureId,
32
- layerData: u.layerData
33
- };
34
- t.push(c);
35
- } else
36
- console.error(`La capa ${e.layerId} no tiene un método getBounds`);
37
- }
38
- }
39
- if (t.length > 0) {
40
- let e = t[0], s = i.latLngBounds(
41
- e.layerData.boundsNW,
42
- e.layerData.boundsSE
43
- );
44
- for (let r = 1; r < t.length; r++) {
45
- e = t[r];
46
- const u = i.latLngBounds(
47
- e.layerData.boundsNW,
48
- e.layerData.boundsSE
49
- );
50
- s = s.extend(u);
51
- }
52
- f.fitBounds(s, { animate: !1, maxZoom: 22, padding: [50, 50] });
53
- }
54
- }, 300, {
55
- leading: !1,
56
- // enviar el primer evento de fitBounds, para
57
- trailing: !0
58
- // Incluir siempre el ultimo evento en la cola, para que no quede se quedee a la mitad del fitBounds
59
- });
60
- n && l(n);
61
- }, [n]);
23
+ );
24
+ (t.status === "success" || t.status === "noop") && (n.current = o);
25
+ }, 300, {
26
+ leading: !1,
27
+ trailing: !0
28
+ }), [u]);
29
+ i(() => {
30
+ const o = B(r);
31
+ !o || h(n.current, o) || e(o);
32
+ }, [r, e]), i(() => () => {
33
+ e.cancel();
34
+ }, [e]);
62
35
  }
63
36
  export {
64
- j as useAutoFocus
37
+ L as useAutoFocus
65
38
  };
@@ -1,16 +1,7 @@
1
- import { FeatureId } from '../../contexts/MapContext';
2
- import { FeatureLayerData } from '../../contexts/MapContext/types';
3
- export type FeatureData = {
4
- featureId: FeatureId;
5
- layerData: FeatureLayerData | undefined;
6
- };
7
- export type LayerWithFeatures = {
8
- layerId: string;
9
- features: FeatureData[];
10
- };
11
- export type LayerForBound = {
1
+ import { LayerDataBounds } from '../../contexts/MapContext/types';
2
+ export type ActiveAutoFocusLayer = {
12
3
  layerId: string;
13
- featureId: FeatureId;
14
- layerData: FeatureLayerData;
4
+ dataBounds: LayerDataBounds;
5
+ dataBoundsVersion: number;
15
6
  };
16
7
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/hooks/useAutoFocus/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,gBAAgB,GAAG,SAAS,CAAC;CACzC,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,gBAAgB,CAAC;CAC7B,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/hooks/useAutoFocus/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,eAAe,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { UseMapInteractionCaptureOptions, UseMapInteractionCaptureResult } from './useMapInteractionCapture.types';
2
+ /**
3
+ * Small host-facing hook that lets tools query and capture the map interaction
4
+ * channels they need without touching `MapContext` internals directly.
5
+ */
6
+ export declare function useMapInteractionCapture(options: UseMapInteractionCaptureOptions): UseMapInteractionCaptureResult;
7
+ //# sourceMappingURL=useMapInteractionCapture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMapInteractionCapture.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/hooks/useMapInteractionCapture.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,kCAAkC,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,+BAA+B,GACvC,8BAA8B,CAmFhC"}
@@ -0,0 +1,42 @@
1
+ import { useMemo as C, useCallback as s, useEffect as b } from "react";
2
+ import { shallow as m } from "zustand/shallow";
3
+ import { useMapStore as w } from "./useMapStore/index.js";
4
+ function B(I) {
5
+ const {
6
+ ownerId: e,
7
+ channels: t,
8
+ enabled: n = !0,
9
+ autoReleaseOnUnmount: l = !0
10
+ } = I, {
11
+ getInteractionOwner: c,
12
+ requestInteractionCapture: i,
13
+ releaseAllInteractionCapture: o,
14
+ releaseInteractionCapture: p
15
+ } = w((r) => r.mapActions, m), u = w((r) => t.reduce((a, f) => (a[f] = r.interactionOwnership.ownersByChannel[f], a), {}), m), h = C(() => n ? t.every((r) => {
16
+ const a = u[r];
17
+ return a === void 0 || a === e;
18
+ }) : !1, [t, n, e, u]), O = C(() => n ? t.every((r) => u[r] === e) : !1, [t, n, e, u]), d = s(() => n ? i(e, t) : !1, [t, n, e, i]), v = s((r) => {
19
+ p(e, r ?? t);
20
+ }, [t, e, p]), y = s(() => {
21
+ o(e);
22
+ }, [e, o]), A = s((r) => c(r), [c]);
23
+ return b(() => {
24
+ if (!(!n || !l))
25
+ return () => {
26
+ o(e);
27
+ };
28
+ }, [l, n, e, o]), {
29
+ channels: t,
30
+ getOwner: A,
31
+ hasCapture: O,
32
+ isAvailable: h,
33
+ ownerId: e,
34
+ ownersByChannel: u,
35
+ releaseAllCapture: y,
36
+ releaseCapture: v,
37
+ requestCapture: d
38
+ };
39
+ }
40
+ export {
41
+ B as useMapInteractionCapture
42
+ };
@@ -0,0 +1,19 @@
1
+ import { InteractionChannel, InteractionOwnerId } from '../contexts/MapContext/types';
2
+ export type UseMapInteractionCaptureOptions = {
3
+ ownerId: InteractionOwnerId;
4
+ channels: InteractionChannel[];
5
+ enabled?: boolean;
6
+ autoReleaseOnUnmount?: boolean;
7
+ };
8
+ export type UseMapInteractionCaptureResult = {
9
+ ownerId: InteractionOwnerId;
10
+ channels: InteractionChannel[];
11
+ ownersByChannel: Partial<Record<InteractionChannel, InteractionOwnerId>>;
12
+ isAvailable: boolean;
13
+ hasCapture: boolean;
14
+ requestCapture: () => boolean;
15
+ releaseCapture: (channels?: InteractionChannel[]) => void;
16
+ releaseAllCapture: () => void;
17
+ getOwner: (channel: InteractionChannel) => InteractionOwnerId | undefined;
18
+ };
19
+ //# sourceMappingURL=useMapInteractionCapture.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMapInteractionCapture.types.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/hooks/useMapInteractionCapture.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,MAAM,+BAA+B,GAAG;IAC5C,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CAAC;IACzE,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,MAAM,OAAO,CAAC;IAC9B,cAAc,EAAE,CAAC,QAAQ,CAAC,EAAE,kBAAkB,EAAE,KAAK,IAAI,CAAC;IAC1D,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,kBAAkB,GAAG,SAAS,CAAC;CAC3E,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { LeafletEvent, LeafletEventHandlerFnMap } from 'leaflet';
2
+ import { FeatureId } from '../contexts/MapContext/types';
3
+ /**
4
+ * Returns whether the last host observable dispatch marked this Leaflet event
5
+ * as captured by an active observable subscriber.
6
+ */
7
+ export declare function isObservableFeatureEventCaptured(event?: LeafletEvent): boolean;
8
+ /**
9
+ * Builds the minimal host-oriented Leaflet event handlers required for one observable feature.
10
+ */
11
+ export declare function useObservableFeatureEventHandlers(layerId: string, featureId: FeatureId): LeafletEventHandlerFnMap | undefined;
12
+ //# sourceMappingURL=useObservableFeatureEventHandlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useObservableFeatureEventHandlers.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/hooks/useObservableFeatureEventHandlers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAGtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAK9D;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,CAAC,EAAE,YAAY,GAAG,OAAO,CAI9E;AAQD;;GAEG;AACH,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,SAAS,GACnB,wBAAwB,GAAG,SAAS,CAyCtC"}
@@ -0,0 +1,43 @@
1
+ import { useMemo as i } from "react";
2
+ import { shallow as v } from "zustand/shallow";
3
+ import { createObservableFeatureEvent as l } from "../contexts/MapContext/helpers/featureObservability.js";
4
+ import { useMapStore as m } from "./useMapStore/index.js";
5
+ const b = "__m4lObservableFeatureCaptured";
6
+ function F(e) {
7
+ return !!e?.[b];
8
+ }
9
+ function E(e, r) {
10
+ e[b] = r;
11
+ }
12
+ function h(e, r) {
13
+ const [a, o] = m(
14
+ (t) => [
15
+ t.hashLayers[e]?.featureObservability,
16
+ t.mapActions.dispatchObservableFeatureEvent
17
+ ],
18
+ v
19
+ );
20
+ return i(() => {
21
+ if (!a?.enabled)
22
+ return;
23
+ const t = a.events ?? [
24
+ "click",
25
+ "dblclick",
26
+ "contextmenu",
27
+ "mouseover",
28
+ "mouseout"
29
+ ], n = {};
30
+ return t.forEach((s) => {
31
+ n[s] = (u) => {
32
+ const c = o(
33
+ l(s, e, r, u)
34
+ );
35
+ E(u, c);
36
+ };
37
+ }), n;
38
+ }, [o, r, a, e]);
39
+ }
40
+ export {
41
+ F as isObservableFeatureEventCaptured,
42
+ h as useObservableFeatureEventHandlers
43
+ };
@@ -5,6 +5,7 @@ export * from './contexts/MapContext';
5
5
  export * from './featureRenders';
6
6
  export * from './popups';
7
7
  export { getMapComponentsDictionary } from './dictionary';
8
+ export { isObservableFeatureEventCaptured } from './hooks/useObservableFeatureEventHandlers';
8
9
  export * from './pluginLayers';
9
10
  export { LAT_LON_FIXED_DIGITS } from './constants';
10
11
  export * from './hooks';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAG,MAAM,UAAU,CAAC;AACnC,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE3E,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE1D,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAG,MAAM,UAAU,CAAC;AACnC,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE3E,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAE7F,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,cAAc,SAAS,CAAC"}
@@ -1,4 +1,9 @@
1
1
  import { FormMeasureValues } from './types';
2
+ import { InteractionChannel } from '../../../../../../contexts/MapContext/types';
3
+ export declare const MEASURE_TOOL_INTERACTION_OWNER_ID = "measure-tool";
4
+ export declare const MEASURE_TOOL_REQUIRED_INTERACTION_CHANNELS: InteractionChannel[];
5
+ export declare const MEASURE_TOOL_DUPLICATE_POINT_WINDOW_MS = 250;
6
+ export declare const MEASURE_TOOL_DUPLICATE_POINT_EPSILON = 1e-7;
2
7
  export declare const STROKE_COLOR_DEFAULT = "#aaccaa";
3
8
  export declare const STROKE_OPACITY_DEFAULT: {
4
9
  value: number;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,sBAAsB;;;CAA8B,CAAC;AAClE,eAAO,MAAM,sBAAsB;;;CAA8B,CAAC;AAClE,eAAO,MAAM,yBAAyB;;;CAAgC,CAAC;AACvE,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAC5C,eAAO,MAAM,oBAAoB;;;CAA+B,CAAC;AACjE,eAAO,MAAM,mBAAmB,EAAE,iBAYjC,CAAC;AACF,eAAO,MAAM,qBAAqB;;;;;;;;;CASjC,CAAC;AAGF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;IA2BlC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAEtF,eAAO,MAAM,iCAAiC,iBAAiB,CAAC;AAChE,eAAO,MAAM,0CAA0C,EAAE,kBAAkB,EAG1E,CAAC;AACF,eAAO,MAAM,sCAAsC,MAAM,CAAC;AAC1D,eAAO,MAAM,oCAAoC,OAAY,CAAC;AAE9D,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,sBAAsB;;;CAA8B,CAAC;AAClE,eAAO,MAAM,sBAAsB;;;CAA8B,CAAC;AAClE,eAAO,MAAM,yBAAyB;;;CAAgC,CAAC;AACvE,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAC5C,eAAO,MAAM,oBAAoB;;;CAA+B,CAAC;AACjE,eAAO,MAAM,mBAAmB,EAAE,iBAYjC,CAAC;AACF,eAAO,MAAM,qBAAqB;;;;;;;;;CASjC,CAAC;AAGF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;IA2BlC,CAAC"}
@@ -1,5 +1,8 @@
1
- import { MAP_DICCTIONARY as a } from "../../../../../../dictionary.js";
2
- const t = {
1
+ import { MAP_DICCTIONARY as _ } from "../../../../../../dictionary.js";
2
+ const t = "measure-tool", a = [
3
+ "map_click",
4
+ "viewport_control"
5
+ ], i = 250, r = 1e-7, o = {
3
6
  /** General Data */
4
7
  statusLoad: "ready",
5
8
  reInits: 0,
@@ -11,7 +14,7 @@ const t = {
11
14
  /** de Apoyo */
12
15
  statusEdition: "initial"
13
16
  // geometry: null ,
14
- }, r = {
17
+ }, I = {
15
18
  strokeLineWeight: 4,
16
19
  markerHeight: 38,
17
20
  markerWidth: 32,
@@ -19,11 +22,11 @@ const t = {
19
22
  labelMarkerWidth: 0,
20
23
  labelMarkerAnchorY: 25,
21
24
  labelMarkerAnchorX: -23
22
- }, _ = [
25
+ }, e = [
23
26
  {
24
27
  id: "k",
25
- dictionaryLabelId: a.LABEL_MEASURE_UNIT_KILOMETERS,
26
- dictionarySymbolId: a.LABEL_MEASURE_UNIT_KILOMETERS_SYMBOL,
28
+ dictionaryLabelId: _.LABEL_MEASURE_UNIT_KILOMETERS,
29
+ dictionarySymbolId: _.LABEL_MEASURE_UNIT_KILOMETERS_SYMBOL,
27
30
  factor_x0: 0,
28
31
  factor_x1: 1,
29
32
  factor_x2: 0,
@@ -31,8 +34,8 @@ const t = {
31
34
  },
32
35
  {
33
36
  id: "m",
34
- dictionaryLabelId: a.LABEL_MEASURE_UNIT_METERS,
35
- dictionarySymbolId: a.LABEL_MEASURE_UNIT_METERS_SYMBOL,
37
+ dictionaryLabelId: _.LABEL_MEASURE_UNIT_METERS,
38
+ dictionarySymbolId: _.LABEL_MEASURE_UNIT_METERS_SYMBOL,
36
39
  factor_x0: 0,
37
40
  factor_x1: 1e3,
38
41
  factor_x2: 0,
@@ -40,8 +43,8 @@ const t = {
40
43
  },
41
44
  {
42
45
  id: "mi",
43
- dictionaryLabelId: a.LABEL_MEASURE_UNIT_MILES,
44
- dictionarySymbolId: a.LABEL_MEASURE_UNIT_MILES_SYMBOL,
46
+ dictionaryLabelId: _.LABEL_MEASURE_UNIT_MILES,
47
+ dictionarySymbolId: _.LABEL_MEASURE_UNIT_MILES_SYMBOL,
45
48
  factor_x0: 0,
46
49
  factor_x1: 0.621371,
47
50
  factor_x2: 0,
@@ -49,7 +52,11 @@ const t = {
49
52
  }
50
53
  ];
51
54
  export {
52
- t as INITIAL_FORM_VALUES,
53
- _ as MAGNITUDE_FACTOR_ITEMS,
54
- r as STYLE_MEASURE_OPTIONS
55
+ o as INITIAL_FORM_VALUES,
56
+ e as MAGNITUDE_FACTOR_ITEMS,
57
+ r as MEASURE_TOOL_DUPLICATE_POINT_EPSILON,
58
+ i as MEASURE_TOOL_DUPLICATE_POINT_WINDOW_MS,
59
+ t as MEASURE_TOOL_INTERACTION_OWNER_ID,
60
+ a as MEASURE_TOOL_REQUIRED_INTERACTION_CHANNELS,
61
+ I as STYLE_MEASURE_OPTIONS
55
62
  };
@@ -1,8 +1,9 @@
1
1
  import { StatusEdition } from '../../types';
2
2
  /**
3
- * useMeasure hook se encarga de pintar las marcas y una línea que las une, para calcular la distancia o el area (NextMVP)
4
- * de ellas. En su primera versión no incluye agregar nuevas marcas entre los vertices por facilidad de implementación
5
- * ya que el costo beneficio es muy alto si se coloca esa capacidad.
3
+ * `useMeasure` paints the markers and line used to calculate distance or area
4
+ * (`NextMVP`). The first version intentionally skips inserting new markers
5
+ * between existing vertices because the implementation cost is high relative to
6
+ * the current UX value.
6
7
  * @returns
7
8
  */
8
9
  export declare function useMeasure(): {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAO5C;;;;;GAKG;AACH,wBAAgB,UAAU;;;;;EAkXzB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAe5C;;;;;;GAMG;AACH,wBAAgB,UAAU;;;;;EAifzB"}