react-zoom-pan-pinch 3.4.0 → 3.4.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
@@ -1270,6 +1270,12 @@ var handleDoubleClickResetMode = function (contextInstance, event) {
1270
1270
  });
1271
1271
  handleDoubleClickStop(contextInstance, event);
1272
1272
  };
1273
+ function getDoubleClickScale(mode, scale) {
1274
+ if (mode === "toggle") {
1275
+ return scale === 1 ? 1 : -1;
1276
+ }
1277
+ return mode === "zoomOut" ? -1 : 1;
1278
+ }
1273
1279
  function handleDoubleClick(contextInstance, event) {
1274
1280
  var setup = contextInstance.setup, doubleClickStopEventTimer = contextInstance.doubleClickStopEventTimer, transformState = contextInstance.transformState, contentComponent = contextInstance.contentComponent;
1275
1281
  var scale = transformState.scale;
@@ -1284,7 +1290,7 @@ function handleDoubleClick(contextInstance, event) {
1284
1290
  }
1285
1291
  if (!contentComponent)
1286
1292
  return console.error("No ContentComponent found");
1287
- var delta = mode === "zoomOut" ? -1 : 1;
1293
+ var delta = getDoubleClickScale(mode, contextInstance.transformState.scale);
1288
1294
  var newScale = handleCalculateButtonZoom(contextInstance, delta, step);
1289
1295
  // stop execution when scale didn't change
1290
1296
  if (scale === newScale)
@@ -1359,6 +1365,7 @@ var ZoomPanPinch = /** @class */ (function () {
1359
1365
  _this.cleanupWindowEvents();
1360
1366
  };
1361
1367
  this.update = function (newProps) {
1368
+ _this.props = newProps;
1362
1369
  handleCalculateBounds(_this, _this.transformState.scale);
1363
1370
  _this.setup = createSetup(newProps);
1364
1371
  };