@orioro/react-maplibre-util 0.6.0 → 0.7.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @orioro/react-maplibre-util
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - expose SyncedMaps mouse event handlers and add svgImages to GeoReDUS
8
+
9
+ ### Patch Changes
10
+
11
+ - @orioro/react-chart-util@0.3.0
12
+
3
13
  ## 0.6.0
4
14
 
5
15
  ### Minor Changes
package/dist/index.mjs CHANGED
@@ -912,26 +912,35 @@ function makeSyncedMaps(_a) {
912
912
  var _c = useState(initialViewState),
913
913
  viewState = _c[0],
914
914
  setViewState = _c[1];
915
- var onSyncMove = useCallback(function (evt) {
916
- return setViewState(evt.viewState);
917
- }, []);
915
+ var syncedOnMove = useCallback(function (evt) {
916
+ setViewState(evt.viewState);
917
+ if (typeof baseMapProps.onMove === 'function') {
918
+ baseMapProps.onMove(evt);
919
+ }
920
+ }, [baseMapProps.onMove]);
918
921
  var _d = useState(false),
919
922
  isDragging = _d[0],
920
923
  setIsDragging = _d[1];
921
- var onDragEnd = useCallback(function () {
922
- return setIsDragging(false);
923
- }, [setIsDragging]);
924
+ var syncedOnDragEnd = useCallback(function (e) {
925
+ setIsDragging(false);
926
+ if (typeof baseMapProps.onDragEnd === 'function') {
927
+ baseMapProps.onDragEnd(e);
928
+ }
929
+ }, [setIsDragging, baseMapProps.onDragEnd]);
924
930
  var _e = useState(null),
925
931
  hoverInfo = _e[0],
926
932
  setHoverInfo = _e[1];
927
933
  var _f = useState(null),
928
934
  tooltips = _f[0],
929
935
  setTooltips = _f[1];
930
- var onDragStart = useCallback(function () {
936
+ var syncedOnDragStart = useCallback(function (e) {
931
937
  setIsDragging(true);
932
938
  setTooltips(null);
933
- }, []);
934
- var _onMouseMove = useCallback(function (index, event) {
939
+ if (typeof baseMapProps.onDragStart === 'function') {
940
+ baseMapProps.onDragStart(e);
941
+ }
942
+ }, [baseMapProps.onDragStart]);
943
+ var syncedOnMouseMove = useCallback(function (event, index) {
935
944
  var nextHoverInfo = parseHoverInfo(index, event);
936
945
  setHoverInfo(function (prevHoverInfo) {
937
946
  mapSetFeaturesState(event.target, prevHoverInfo === null || prevHoverInfo === void 0 ? void 0 : prevHoverInfo.features, {
@@ -950,7 +959,13 @@ function makeSyncedMaps(_a) {
950
959
  }
951
960
  return getTooltip(nextHoverInfo, mapInstanceRefs[index]) || null;
952
961
  }) : null);
953
- }, [maps]);
962
+ if (typeof baseMapProps.onMouseMove === 'function') {
963
+ //
964
+ // Allow onMouseMove to be composed with base
965
+ //
966
+ baseMapProps.onMouseMove(event);
967
+ }
968
+ }, [maps, baseMapProps.onMouseMove]);
954
969
  //
955
970
  // There is no notion of mouseenter/mouseleave
956
971
  // in maplibre.gl.
@@ -960,7 +975,7 @@ function makeSyncedMaps(_a) {
960
975
  // https://github.com/mapbox/mapbox-gl-js/issues/10594
961
976
  // https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/MapEventType/#mouseout
962
977
  //
963
- var onMouseOut = useCallback(function (event) {
978
+ var syncedOnMouseOut = useCallback(function (event) {
964
979
  setHoverInfo(null);
965
980
  setTooltips(null);
966
981
  if (Array.isArray(hoverInfo === null || hoverInfo === void 0 ? void 0 : hoverInfo.features)) {
@@ -968,7 +983,10 @@ function makeSyncedMaps(_a) {
968
983
  hover: false
969
984
  });
970
985
  }
971
- }, [setHoverInfo, setTooltips, hoverInfo]);
986
+ if (typeof baseMapProps.onMouseOut === 'function') {
987
+ baseMapProps.onMouseOut(event);
988
+ }
989
+ }, [setHoverInfo, setTooltips, hoverInfo, baseMapProps.onMouseOut]);
972
990
  //
973
991
  // Expose map instances
974
992
  //
@@ -1021,11 +1039,11 @@ function makeSyncedMaps(_a) {
1021
1039
  width: '100%',
1022
1040
  height: '100%'
1023
1041
  }),
1024
- onMove: onSyncMove,
1025
- onDragStart: onDragStart,
1026
- onDragEnd: onDragEnd,
1042
+ onMove: syncedOnMove,
1043
+ onDragStart: syncedOnDragStart,
1044
+ onDragEnd: syncedOnDragEnd,
1027
1045
  onMouseMove: function onMouseMove(event) {
1028
- return _onMouseMove(index, event);
1046
+ return syncedOnMouseMove(event, index);
1029
1047
  },
1030
1048
  //
1031
1049
  // There is no notion of mouseenter/mouseleave
@@ -1036,7 +1054,7 @@ function makeSyncedMaps(_a) {
1036
1054
  // https://github.com/mapbox/mapbox-gl-js/issues/10594
1037
1055
  // https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/MapEventType/#mouseout
1038
1056
  //
1039
- onMouseOut: onMouseOut
1057
+ onMouseOut: syncedOnMouseOut
1040
1058
  })));
1041
1059
  }), children);
1042
1060
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orioro/react-maplibre-util",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "packageManager": "yarn@4.0.2",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",