@papyrus-sdk/ui-react 0.2.15 → 0.2.16
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.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2097,6 +2097,7 @@ var Viewer = ({ engine }) => {
|
|
|
2097
2097
|
const frameRef = useRef4(null);
|
|
2098
2098
|
const jumpRef = useRef4(false);
|
|
2099
2099
|
const jumpTimerRef = useRef4(null);
|
|
2100
|
+
const lastWidthRef = useRef4(null);
|
|
2100
2101
|
const pinchRef = useRef4({
|
|
2101
2102
|
active: false,
|
|
2102
2103
|
startDistance: 0,
|
|
@@ -2147,8 +2148,14 @@ var Viewer = ({ engine }) => {
|
|
|
2147
2148
|
const element = viewerRef.current;
|
|
2148
2149
|
if (!element) return;
|
|
2149
2150
|
const updateWidth = () => {
|
|
2150
|
-
const
|
|
2151
|
-
|
|
2151
|
+
const rawWidth = element.getBoundingClientRect?.().width ?? element.offsetWidth;
|
|
2152
|
+
const nextWidth = Math.round(rawWidth);
|
|
2153
|
+
if (nextWidth <= 0) return;
|
|
2154
|
+
const previousWidth = lastWidthRef.current;
|
|
2155
|
+
if (previousWidth != null && Math.abs(nextWidth - previousWidth) < 2)
|
|
2156
|
+
return;
|
|
2157
|
+
lastWidthRef.current = nextWidth;
|
|
2158
|
+
setAvailableWidth(nextWidth);
|
|
2152
2159
|
};
|
|
2153
2160
|
updateWidth();
|
|
2154
2161
|
if (typeof ResizeObserver === "undefined") {
|