@opengeoweb/webmap-react 19.2.0 → 19.4.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/dist/index.esm.js CHANGED
@@ -5903,6 +5903,7 @@ var FeatureLayer = function FeatureLayer(_ref) {
5903
5903
  hoverSelect = _ref.hoverSelect,
5904
5904
  clickOnFeature = _ref.clickOnFeature,
5905
5905
  boxSelect = _ref.boxSelect,
5906
+ layerId = _ref.layerId,
5906
5907
  testId = _ref.testId,
5907
5908
  opacity = _ref.opacity,
5908
5909
  _ref$declutter = _ref.declutter,
@@ -5928,6 +5929,7 @@ var FeatureLayer = function FeatureLayer(_ref) {
5928
5929
  zIndex: zIndex,
5929
5930
  style: style,
5930
5931
  properties: {
5932
+ layerId: layerId,
5931
5933
  testId: testId
5932
5934
  },
5933
5935
  opacity: opacity,
@@ -5945,7 +5947,7 @@ var FeatureLayer = function FeatureLayer(_ref) {
5945
5947
  };
5946
5948
  // NOTE: style should not be part of this effect, as it changes always, causing the layer to be add/removed continuousely.
5947
5949
  // eslint-disable-next-line react-hooks/exhaustive-deps
5948
- }, [map, zIndex, testId, visible]);
5950
+ }, [layerId, map, zIndex, testId, visible]);
5949
5951
  useEffect(function () {
5950
5952
  // Handle style function:
5951
5953
  if (layerRef.current && style) {
@@ -6113,6 +6115,7 @@ var OpenLayersFeatureLayer = function OpenLayersFeatureLayer(_ref) {
6113
6115
  hoverSelect = _ref.hoverSelect,
6114
6116
  clickOnFeature = _ref.clickOnFeature,
6115
6117
  boxSelect = _ref.boxSelect,
6118
+ layerId = _ref.layerId,
6116
6119
  testId = _ref.testId,
6117
6120
  opacity = _ref.opacity,
6118
6121
  _ref$declutter = _ref.declutter,
@@ -6144,6 +6147,7 @@ var OpenLayersFeatureLayer = function OpenLayersFeatureLayer(_ref) {
6144
6147
  declutter: declutter,
6145
6148
  features: features.current,
6146
6149
  hoverSelect: hoverSelect,
6150
+ layerId: layerId,
6147
6151
  opacity: opacity,
6148
6152
  style: style,
6149
6153
  testId: testId,
@@ -7482,12 +7486,18 @@ var TimeAwareWMTSLayer = function TimeAwareWMTSLayer(_ref) {
7482
7486
  map.addLayer(layer);
7483
7487
  setLayer(layer);
7484
7488
  setSource(source);
7489
+ if (wmLayer) {
7490
+ wmLayer.olSource = source;
7491
+ }
7485
7492
  return function () {
7486
7493
  map.removeLayer(layer);
7487
7494
  setLayer(undefined);
7495
+ if (wmLayer) {
7496
+ wmLayer.olSource = null;
7497
+ }
7488
7498
  };
7489
7499
  // eslint-disable-next-line react-hooks/exhaustive-deps
7490
- }, [map, TimeAwareWMTSLayer]);
7500
+ }, [map, TimeAwareWMTSLayer, wmLayer]);
7491
7501
  useEffect(function () {
7492
7502
  if (dimensions) {
7493
7503
  source === null || source === void 0 || source.updateDimensions(WMTSDimensionsFromDimensions(dimensions));
@@ -8229,7 +8239,8 @@ var OpenLayersGetFeatureInfo = function OpenLayersGetFeatureInfo(_ref) {
8229
8239
  var displayMapPin = _ref.displayMapPin,
8230
8240
  disableMapPin = _ref.disableMapPin,
8231
8241
  mapPinLocation = _ref.mapPinLocation,
8232
- selectLocation = _ref.selectLocation;
8242
+ selectLocation = _ref.selectLocation,
8243
+ shouldHandleClick = _ref.shouldHandleClick;
8233
8244
  var _useContext = useContext(MapContext),
8234
8245
  map = _useContext.map;
8235
8246
  var _useIconStyle = useIconStyle({
@@ -8257,6 +8268,9 @@ var OpenLayersGetFeatureInfo = function OpenLayersGetFeatureInfo(_ref) {
8257
8268
  return function () {};
8258
8269
  }
8259
8270
  var key = map.on('click', function (e) {
8271
+ if (shouldHandleClick && !shouldHandleClick(e)) {
8272
+ return;
8273
+ }
8260
8274
  var projection = map.getView().getProjection();
8261
8275
  var resolution = map.getView().getResolution();
8262
8276
  var location = toLonLat(e.coordinate, projection);
@@ -8272,7 +8286,7 @@ var OpenLayersGetFeatureInfo = function OpenLayersGetFeatureInfo(_ref) {
8272
8286
  return function () {
8273
8287
  unByKey(key);
8274
8288
  };
8275
- }, [map, displayMapPin, selectLocation]);
8289
+ }, [map, displayMapPin, selectLocation, shouldHandleClick]);
8276
8290
  if (!displayMapPin) {
8277
8291
  return null;
8278
8292
  }
@@ -1,8 +1,10 @@
1
+ import type { MapBrowserEvent } from 'ol';
1
2
  import type { MapLocation } from '../../../types/types';
2
3
  export interface OpenLayersGetFeatureInfoProps {
3
4
  displayMapPin?: boolean;
4
5
  disableMapPin?: boolean;
5
6
  mapPinLocation?: MapLocation;
6
7
  selectLocation: (location: MapLocation) => void;
8
+ shouldHandleClick?: (event: MapBrowserEvent<KeyboardEvent | WheelEvent | PointerEvent>) => boolean;
7
9
  }
8
10
  export declare const OpenLayersGetFeatureInfo: React.FC<OpenLayersGetFeatureInfoProps>;
@@ -8,6 +8,7 @@ export interface FeatureLayerProps {
8
8
  hoverSelect?: HoverSelect;
9
9
  clickOnFeature?: ClickOnFeature;
10
10
  boxSelect?: BoxSelect;
11
+ layerId?: string;
11
12
  testId?: string;
12
13
  opacity?: number;
13
14
  declutter?: boolean;
@@ -8,6 +8,7 @@ export interface OpenLayersFeatureLayerProps {
8
8
  hoverSelect?: HoverSelect;
9
9
  clickOnFeature?: ClickOnFeature;
10
10
  boxSelect?: BoxSelect;
11
+ layerId?: string;
11
12
  testId?: string;
12
13
  opacity?: number;
13
14
  declutter?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap-react",
3
- "version": "19.2.0",
3
+ "version": "19.4.0",
4
4
  "description": "GeoWeb react wrapper for webmap",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {