react-zoom-pan-pinch 3.1.1 → 3.3.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.d.ts CHANGED
@@ -165,6 +165,9 @@ type ReactZoomPanPinchProps = {
165
165
  velocityDisabled?: boolean;
166
166
  lockAxisX?: boolean;
167
167
  lockAxisY?: boolean;
168
+ allowLeftClickPan?: boolean;
169
+ allowMiddleClickPan?: boolean;
170
+ allowRightClickPan?: boolean;
168
171
  activationKeys?: string[];
169
172
  excluded?: string[];
170
173
  };
package/dist/index.esm.js CHANGED
@@ -667,6 +667,9 @@ var initialSetup = {
667
667
  velocityDisabled: false,
668
668
  lockAxisX: false,
669
669
  lockAxisY: false,
670
+ allowLeftClickPan: true,
671
+ allowMiddleClickPan: true,
672
+ allowRightClickPan: true,
670
673
  activationKeys: [],
671
674
  excluded: [],
672
675
  },
@@ -1425,6 +1428,12 @@ var ZoomPanPinch = /** @class */ (function () {
1425
1428
  var keysPressed = _this.isPressingKeys(_this.setup.panning.activationKeys);
1426
1429
  if (!keysPressed)
1427
1430
  return;
1431
+ if (event.button === 0 && !_this.setup.panning.allowLeftClickPan)
1432
+ return;
1433
+ if (event.button === 1 && !_this.setup.panning.allowMiddleClickPan)
1434
+ return;
1435
+ if (event.button === 2 && !_this.setup.panning.allowRightClickPan)
1436
+ return;
1428
1437
  event.preventDefault();
1429
1438
  event.stopPropagation();
1430
1439
  handleCancelAnimation(_this);
@@ -1674,9 +1683,6 @@ var TransformWrapper = React.forwardRef(function (props, ref) {
1674
1683
  useImperativeHandle(ref, function () { return getControls(instance); }, [instance]);
1675
1684
  useEffect(function () {
1676
1685
  instance.update(props);
1677
- return function () {
1678
- instance.cleanupWindowEvents();
1679
- };
1680
1686
  }, [instance, props]);
1681
1687
  return React.createElement(Context.Provider, { value: instance }, content);
1682
1688
  });
@@ -1892,16 +1898,19 @@ styleInject(css_248z);
1892
1898
 
1893
1899
  var TransformComponent = function (_a) {
1894
1900
  var children = _a.children, _b = _a.wrapperClass, wrapperClass = _b === void 0 ? "" : _b, _c = _a.contentClass, contentClass = _c === void 0 ? "" : _c, wrapperStyle = _a.wrapperStyle, contentStyle = _a.contentStyle, _d = _a.wrapperProps, wrapperProps = _d === void 0 ? {} : _d, _e = _a.contentProps, contentProps = _e === void 0 ? {} : _e;
1895
- var init = useContext(Context).init;
1901
+ var _f = useContext(Context), init = _f.init, cleanupWindowEvents = _f.cleanupWindowEvents;
1896
1902
  var wrapperRef = useRef(null);
1897
1903
  var contentRef = useRef(null);
1898
1904
  useEffect(function () {
1899
1905
  var wrapper = wrapperRef.current;
1900
1906
  var content = contentRef.current;
1901
1907
  if (wrapper !== null && content !== null && init) {
1902
- init(wrapper, content);
1908
+ init === null || init === void 0 ? void 0 : init(wrapper, content);
1903
1909
  }
1904
1910
  // eslint-disable-next-line react-hooks/exhaustive-deps
1911
+ return function () {
1912
+ cleanupWindowEvents === null || cleanupWindowEvents === void 0 ? void 0 : cleanupWindowEvents();
1913
+ };
1905
1914
  }, []);
1906
1915
  return (React.createElement("div", __assign({}, wrapperProps, { ref: wrapperRef, className: "react-transform-wrapper ".concat(styles.wrapper, " ").concat(wrapperClass), style: wrapperStyle }),
1907
1916
  React.createElement("div", __assign({}, contentProps, { ref: contentRef, className: "react-transform-component ".concat(styles.content, " ").concat(contentClass), style: contentStyle }), children)));