andoncloud-map-widget 1.0.3 → 1.0.5

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.js CHANGED
@@ -614,11 +614,7 @@ function Trans(_ref) {
614
614
  defaultNSFromContext = _ref2.defaultNS;
615
615
 
616
616
  var i18n = i18nFromProps || i18nFromContext || getI18n();
617
-
618
- var t = tFromProps || i18n.t.bind(i18n) || function (k) {
619
- return k;
620
- };
621
-
617
+ var t = tFromProps || i18n && i18n.t.bind(i18n);
622
618
  return Trans$1(_objectSpread$9({
623
619
  children: children,
624
620
  count: count,
@@ -629,7 +625,7 @@ function Trans(_ref) {
629
625
  values: values,
630
626
  defaults: defaults,
631
627
  components: components,
632
- ns: ns || t.ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS,
628
+ ns: ns || t && t.ns || defaultNSFromContext || i18n && i18n.options && i18n.options.defaultNS,
633
629
  i18n: i18n,
634
630
  t: tFromProps,
635
631
  shouldUnescape: shouldUnescape
@@ -4324,7 +4320,7 @@ function hasMultilineItems(maybeArray) {
4324
4320
  return maybeArray != null && maybeArray.some(isMultiline);
4325
4321
  }
4326
4322
 
4327
- var LIBRARY_VERSION = '1.0.3';
4323
+ var LIBRARY_VERSION = '1.0.5';
4328
4324
 
4329
4325
  var SettingsFormContent = function SettingsFormContent(_ref) {
4330
4326
  var _data$floorPlans;
@@ -22447,6 +22443,10 @@ var Map$1 = function Map(_ref) {
22447
22443
  return Promise.reject(e);
22448
22444
  }
22449
22445
  }, [removeFeatures]);
22446
+ React.useEffect(function () {
22447
+ var _mapRef$current2;
22448
+ (_mapRef$current2 = mapRef.current) == null ? void 0 : _mapRef$current2.invalidateSize();
22449
+ }, [width, height]);
22450
22450
  React.useEffect(function () {
22451
22451
  var map = mapRef.current;
22452
22452
  setControlsDisplay(!!editMode);
@@ -22489,8 +22489,8 @@ var Map$1 = function Map(_ref) {
22489
22489
  // @ts-ignore no typings
22490
22490
  layer.dragging.disable();
22491
22491
  if (tooltip) {
22492
- var _mapRef$current2;
22493
- (_mapRef$current2 = mapRef.current) == null ? void 0 : _mapRef$current2.openTooltip(tooltip);
22492
+ var _mapRef$current3;
22493
+ (_mapRef$current3 = mapRef.current) == null ? void 0 : _mapRef$current3.openTooltip(tooltip);
22494
22494
  }
22495
22495
  }
22496
22496
  });
@@ -22544,15 +22544,15 @@ var Map$1 = function Map(_ref) {
22544
22544
  var openTooltip = function openTooltip(layer) {
22545
22545
  var tooltip = layer.getTooltip();
22546
22546
  if (tooltip) {
22547
- var _mapRef$current3;
22548
- (_mapRef$current3 = mapRef.current) == null ? void 0 : _mapRef$current3.openTooltip(tooltip);
22547
+ var _mapRef$current4;
22548
+ (_mapRef$current4 = mapRef.current) == null ? void 0 : _mapRef$current4.openTooltip(tooltip);
22549
22549
  }
22550
22550
  };
22551
22551
  var closeTooltip = function closeTooltip(layer) {
22552
22552
  var tooltip = layer.getTooltip();
22553
22553
  if (tooltip) {
22554
- var _mapRef$current4;
22555
- (_mapRef$current4 = mapRef.current) == null ? void 0 : _mapRef$current4.closeTooltip(tooltip);
22554
+ var _mapRef$current5;
22555
+ (_mapRef$current5 = mapRef.current) == null ? void 0 : _mapRef$current5.closeTooltip(tooltip);
22556
22556
  }
22557
22557
  };
22558
22558
  var centerTooltip = function centerTooltip(layer) {
@@ -22663,15 +22663,19 @@ var Map$1 = function Map(_ref) {
22663
22663
  }, workplace.name);
22664
22664
  })), React__default["default"].createElement(MapContainer, {
22665
22665
  ref: mapRef,
22666
- bounds: [[height, 0], [0, width]],
22667
22666
  center: (settings == null ? void 0 : settings.center) || [width / 2, height / 2],
22667
+ minZoom: 1,
22668
+ maxZoom: 5,
22668
22669
  zoom: (settings == null ? void 0 : settings.zoom) || 1,
22670
+ zoomSnap: 0.1,
22671
+ zoomDelta: 0.1,
22672
+ wheelPxPerZoomLevel: 600,
22669
22673
  zoomControl: false,
22670
22674
  doubleClickZoom: false,
22671
22675
  touchZoom: false
22672
- }, imageUrl && imageDimensions && React__default["default"].createElement(ImageOverlay, {
22676
+ }, mapRef.current && imageUrl && imageDimensions && React__default["default"].createElement(ImageOverlay, {
22673
22677
  url: imageUrl,
22674
- bounds: [[height, 0], [0, height * (imageDimensions.height / imageDimensions.width)]]
22678
+ bounds: new leafletSrc.LatLngBounds(mapRef.current.unproject([0, imageDimensions.height], 2), mapRef.current.unproject([imageDimensions.width, 0], 2))
22675
22679
  }), React__default["default"].createElement(FeatureGroup, {
22676
22680
  ref: function ref(featureGroup) {
22677
22681
  if (featureGroup) onFeatureGroupReady(featureGroup);