react-zoom-pan-pinch 3.4.2 → 3.4.4
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/README.md +85 -58
- package/dist/index.cjs.js +15 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +15 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1400,10 +1400,19 @@ var ZoomPanPinch = /** @class */ (function () {
|
|
|
1400
1400
|
_this.setCenter();
|
|
1401
1401
|
_this.observer = new ResizeObserver(function () {
|
|
1402
1402
|
var _a;
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
(
|
|
1403
|
+
var currentWidth = contentComponent.offsetWidth;
|
|
1404
|
+
var currentHeight = contentComponent.offsetHeight;
|
|
1405
|
+
if (currentWidth > 0 || currentHeight > 0) {
|
|
1406
|
+
_this.onInitCallbacks.forEach(function (callback) { return callback(getContext(_this)); });
|
|
1407
|
+
_this.setCenter();
|
|
1408
|
+
(_a = _this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1409
|
+
}
|
|
1406
1410
|
});
|
|
1411
|
+
// if nothing about the contentComponent has changed after 5 seconds, disconnect the observer
|
|
1412
|
+
setTimeout(function () {
|
|
1413
|
+
var _a;
|
|
1414
|
+
(_a = _this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1415
|
+
}, 5000);
|
|
1407
1416
|
// Start observing the target node for configured mutations
|
|
1408
1417
|
_this.observer.observe(contentComponent);
|
|
1409
1418
|
}
|
|
@@ -1755,6 +1764,9 @@ var useResize = function (ref, onResize, dependencies) {
|
|
|
1755
1764
|
useLayoutEffect(function () {
|
|
1756
1765
|
var _a;
|
|
1757
1766
|
didUnmount.current = false;
|
|
1767
|
+
if (!("ResizeObserver" in window)) {
|
|
1768
|
+
return;
|
|
1769
|
+
}
|
|
1758
1770
|
if (ref) {
|
|
1759
1771
|
resizeObserverRef.current = new ResizeObserver(function (entries) {
|
|
1760
1772
|
var newSize = ref.getBoundingClientRect();
|