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.cjs.js +14 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +14 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/src/core/bounds/bounds.utils.d.ts +2 -0
- package/dist/src/models/context.model.d.ts +3 -0
- package/package.json +1 -1
- package/src/components/transform-component/transform-component.tsx +5 -2
- package/src/components/transform-wrapper/transform-wrapper.tsx +0 -3
- package/src/constants/state.constants.ts +3 -0
- package/src/core/bounds/bounds.utils.ts +30 -0
- package/src/core/instance.core.ts +4 -0
- package/src/models/context.model.ts +3 -0
- package/src/stories/docs/props.tsx +18 -0
package/dist/index.cjs.js
CHANGED
|
@@ -675,6 +675,9 @@ var initialSetup = {
|
|
|
675
675
|
velocityDisabled: false,
|
|
676
676
|
lockAxisX: false,
|
|
677
677
|
lockAxisY: false,
|
|
678
|
+
allowLeftClickPan: true,
|
|
679
|
+
allowMiddleClickPan: true,
|
|
680
|
+
allowRightClickPan: true,
|
|
678
681
|
activationKeys: [],
|
|
679
682
|
excluded: [],
|
|
680
683
|
},
|
|
@@ -1433,6 +1436,12 @@ var ZoomPanPinch = /** @class */ (function () {
|
|
|
1433
1436
|
var keysPressed = _this.isPressingKeys(_this.setup.panning.activationKeys);
|
|
1434
1437
|
if (!keysPressed)
|
|
1435
1438
|
return;
|
|
1439
|
+
if (event.button === 0 && !_this.setup.panning.allowLeftClickPan)
|
|
1440
|
+
return;
|
|
1441
|
+
if (event.button === 1 && !_this.setup.panning.allowMiddleClickPan)
|
|
1442
|
+
return;
|
|
1443
|
+
if (event.button === 2 && !_this.setup.panning.allowRightClickPan)
|
|
1444
|
+
return;
|
|
1436
1445
|
event.preventDefault();
|
|
1437
1446
|
event.stopPropagation();
|
|
1438
1447
|
handleCancelAnimation(_this);
|
|
@@ -1682,9 +1691,6 @@ var TransformWrapper = React__default["default"].forwardRef(function (props, ref
|
|
|
1682
1691
|
React.useImperativeHandle(ref, function () { return getControls(instance); }, [instance]);
|
|
1683
1692
|
React.useEffect(function () {
|
|
1684
1693
|
instance.update(props);
|
|
1685
|
-
return function () {
|
|
1686
|
-
instance.cleanupWindowEvents();
|
|
1687
|
-
};
|
|
1688
1694
|
}, [instance, props]);
|
|
1689
1695
|
return React__default["default"].createElement(Context.Provider, { value: instance }, content);
|
|
1690
1696
|
});
|
|
@@ -1900,16 +1906,19 @@ styleInject(css_248z);
|
|
|
1900
1906
|
|
|
1901
1907
|
var TransformComponent = function (_a) {
|
|
1902
1908
|
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;
|
|
1903
|
-
var
|
|
1909
|
+
var _f = React.useContext(Context), init = _f.init, cleanupWindowEvents = _f.cleanupWindowEvents;
|
|
1904
1910
|
var wrapperRef = React.useRef(null);
|
|
1905
1911
|
var contentRef = React.useRef(null);
|
|
1906
1912
|
React.useEffect(function () {
|
|
1907
1913
|
var wrapper = wrapperRef.current;
|
|
1908
1914
|
var content = contentRef.current;
|
|
1909
1915
|
if (wrapper !== null && content !== null && init) {
|
|
1910
|
-
init(wrapper, content);
|
|
1916
|
+
init === null || init === void 0 ? void 0 : init(wrapper, content);
|
|
1911
1917
|
}
|
|
1912
1918
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1919
|
+
return function () {
|
|
1920
|
+
cleanupWindowEvents === null || cleanupWindowEvents === void 0 ? void 0 : cleanupWindowEvents();
|
|
1921
|
+
};
|
|
1913
1922
|
}, []);
|
|
1914
1923
|
return (React__default["default"].createElement("div", __assign({}, wrapperProps, { ref: wrapperRef, className: "react-transform-wrapper ".concat(styles.wrapper, " ").concat(wrapperClass), style: wrapperStyle }),
|
|
1915
1924
|
React__default["default"].createElement("div", __assign({}, contentProps, { ref: contentRef, className: "react-transform-component ".concat(styles.content, " ").concat(contentClass), style: contentStyle }), children)));
|