react-zoom-pan-pinch 3.5.1 → 3.6.1

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.cjs.js CHANGED
@@ -725,6 +725,10 @@ var initialSetup = {
725
725
  equalToMove: true,
726
726
  },
727
727
  };
728
+ var baseClasses = {
729
+ wrapperClass: "react-transform-wrapper",
730
+ contentClass: "react-transform-component",
731
+ };
728
732
 
729
733
  var createState = function (props) {
730
734
  var _a, _b, _c, _d;
@@ -956,9 +960,10 @@ function makePassiveEventOption() {
956
960
  }
957
961
  }
958
962
 
963
+ var matchPrefix = ".".concat(baseClasses.wrapperClass);
959
964
  var isExcludedNode = function (node, excluded) {
960
965
  return excluded.some(function (exclude) {
961
- return node.matches("".concat(exclude, ", .").concat(exclude, ", ").concat(exclude, " *, .").concat(exclude, " *"));
966
+ return node.matches("".concat(matchPrefix, " ").concat(exclude, ", ").concat(matchPrefix, " .").concat(exclude, ", ").concat(matchPrefix, " ").concat(exclude, " *, ").concat(matchPrefix, " .").concat(exclude, " *"));
962
967
  });
963
968
  };
964
969
  var cancelTimeout = function (timeout) {
@@ -1598,10 +1603,7 @@ var ZoomPanPinch = /** @class */ (function () {
1598
1603
  if (!isAllowed)
1599
1604
  return;
1600
1605
  var isDoubleTap = _this.lastTouch && +new Date() - _this.lastTouch < 200;
1601
- if (isDoubleTap && event.touches.length === 1) {
1602
- _this.onDoubleClick(event);
1603
- }
1604
- else {
1606
+ if (!isDoubleTap) {
1605
1607
  _this.lastTouch = +new Date();
1606
1608
  handleCancelAnimation(_this);
1607
1609
  var touches = event.touches;
@@ -1850,6 +1852,19 @@ var MiniMap = function (_a) {
1850
1852
  var mainRef = React.useRef(null);
1851
1853
  var wrapperRef = React.useRef(null);
1852
1854
  var previewRef = React.useRef(null);
1855
+ var getViewportSize = React.useCallback(function () {
1856
+ if (instance.wrapperComponent) {
1857
+ var rect = instance.wrapperComponent.getBoundingClientRect();
1858
+ return {
1859
+ width: rect.width,
1860
+ height: rect.height
1861
+ };
1862
+ }
1863
+ return {
1864
+ width: 0,
1865
+ height: 0
1866
+ };
1867
+ }, [instance.wrapperComponent]);
1853
1868
  var getContentSize = React.useCallback(function () {
1854
1869
  if (instance.contentComponent) {
1855
1870
  var rect = instance.contentComponent.getBoundingClientRect();
@@ -1908,7 +1923,7 @@ var MiniMap = function (_a) {
1908
1923
  mainRef.current.style.height = "".concat(miniSize.height, "px");
1909
1924
  }
1910
1925
  if (previewRef.current) {
1911
- var size = getContentSize();
1926
+ var size = getViewportSize();
1912
1927
  var scale = computeMiniMapScale();
1913
1928
  var previewScale = scale * (1 / instance.transformState.scale);
1914
1929
  var transform = instance.handleTransformStyles(-instance.transformState.positionX * previewScale, -instance.transformState.positionY * previewScale, 1);
@@ -2000,8 +2015,8 @@ var TransformComponent = function (_a) {
2000
2015
  cleanupWindowEvents === null || cleanupWindowEvents === void 0 ? void 0 : cleanupWindowEvents();
2001
2016
  };
2002
2017
  }, []);
2003
- return (React__default["default"].createElement("div", __assign({}, wrapperProps, { ref: wrapperRef, className: "react-transform-wrapper ".concat(styles.wrapper, " ").concat(wrapperClass), style: wrapperStyle }),
2004
- React__default["default"].createElement("div", __assign({}, contentProps, { ref: contentRef, className: "react-transform-component ".concat(styles.content, " ").concat(contentClass), style: contentStyle }), children)));
2018
+ return (React__default["default"].createElement("div", __assign({}, wrapperProps, { ref: wrapperRef, className: "".concat(baseClasses.wrapperClass, " ").concat(styles.wrapper, " ").concat(wrapperClass), style: wrapperStyle }),
2019
+ React__default["default"].createElement("div", __assign({}, contentProps, { ref: contentRef, className: "".concat(baseClasses.contentClass, " ").concat(styles.content, " ").concat(contentClass), style: contentStyle }), children)));
2005
2020
  };
2006
2021
 
2007
2022
  var useTransformContext = function () {