react-zoom-pan-pinch 3.4.0 → 3.4.2
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 +10 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +10 -10
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -957,16 +957,9 @@ function makePassiveEventOption() {
|
|
|
957
957
|
}
|
|
958
958
|
|
|
959
959
|
var isExcludedNode = function (node, excluded) {
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
if (isExcludedTag)
|
|
963
|
-
return true;
|
|
964
|
-
var isExcludedClassName = excluded.find(function (className) {
|
|
965
|
-
return node.classList.contains(className);
|
|
960
|
+
return excluded.some(function (exclude) {
|
|
961
|
+
return node.matches("".concat(exclude, ", .").concat(exclude, ", ").concat(exclude, " *, .").concat(exclude, " *"));
|
|
966
962
|
});
|
|
967
|
-
if (isExcludedClassName)
|
|
968
|
-
return true;
|
|
969
|
-
return false;
|
|
970
963
|
};
|
|
971
964
|
var cancelTimeout = function (timeout) {
|
|
972
965
|
if (timeout) {
|
|
@@ -1270,6 +1263,12 @@ var handleDoubleClickResetMode = function (contextInstance, event) {
|
|
|
1270
1263
|
});
|
|
1271
1264
|
handleDoubleClickStop(contextInstance, event);
|
|
1272
1265
|
};
|
|
1266
|
+
function getDoubleClickScale(mode, scale) {
|
|
1267
|
+
if (mode === "toggle") {
|
|
1268
|
+
return scale === 1 ? 1 : -1;
|
|
1269
|
+
}
|
|
1270
|
+
return mode === "zoomOut" ? -1 : 1;
|
|
1271
|
+
}
|
|
1273
1272
|
function handleDoubleClick(contextInstance, event) {
|
|
1274
1273
|
var setup = contextInstance.setup, doubleClickStopEventTimer = contextInstance.doubleClickStopEventTimer, transformState = contextInstance.transformState, contentComponent = contextInstance.contentComponent;
|
|
1275
1274
|
var scale = transformState.scale;
|
|
@@ -1284,7 +1283,7 @@ function handleDoubleClick(contextInstance, event) {
|
|
|
1284
1283
|
}
|
|
1285
1284
|
if (!contentComponent)
|
|
1286
1285
|
return console.error("No ContentComponent found");
|
|
1287
|
-
var delta = mode
|
|
1286
|
+
var delta = getDoubleClickScale(mode, contextInstance.transformState.scale);
|
|
1288
1287
|
var newScale = handleCalculateButtonZoom(contextInstance, delta, step);
|
|
1289
1288
|
// stop execution when scale didn't change
|
|
1290
1289
|
if (scale === newScale)
|
|
@@ -1359,6 +1358,7 @@ var ZoomPanPinch = /** @class */ (function () {
|
|
|
1359
1358
|
_this.cleanupWindowEvents();
|
|
1360
1359
|
};
|
|
1361
1360
|
this.update = function (newProps) {
|
|
1361
|
+
_this.props = newProps;
|
|
1362
1362
|
handleCalculateBounds(_this, _this.transformState.scale);
|
|
1363
1363
|
_this.setup = createSetup(newProps);
|
|
1364
1364
|
};
|