@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.js
CHANGED
|
@@ -2124,6 +2124,7 @@ var Viewer = ({ engine }) => {
|
|
|
2124
2124
|
const frameRef = (0, import_react5.useRef)(null);
|
|
2125
2125
|
const jumpRef = (0, import_react5.useRef)(false);
|
|
2126
2126
|
const jumpTimerRef = (0, import_react5.useRef)(null);
|
|
2127
|
+
const lastWidthRef = (0, import_react5.useRef)(null);
|
|
2127
2128
|
const pinchRef = (0, import_react5.useRef)({
|
|
2128
2129
|
active: false,
|
|
2129
2130
|
startDistance: 0,
|
|
@@ -2174,8 +2175,14 @@ var Viewer = ({ engine }) => {
|
|
|
2174
2175
|
const element = viewerRef.current;
|
|
2175
2176
|
if (!element) return;
|
|
2176
2177
|
const updateWidth = () => {
|
|
2177
|
-
const
|
|
2178
|
-
|
|
2178
|
+
const rawWidth = element.getBoundingClientRect?.().width ?? element.offsetWidth;
|
|
2179
|
+
const nextWidth = Math.round(rawWidth);
|
|
2180
|
+
if (nextWidth <= 0) return;
|
|
2181
|
+
const previousWidth = lastWidthRef.current;
|
|
2182
|
+
if (previousWidth != null && Math.abs(nextWidth - previousWidth) < 2)
|
|
2183
|
+
return;
|
|
2184
|
+
lastWidthRef.current = nextWidth;
|
|
2185
|
+
setAvailableWidth(nextWidth);
|
|
2179
2186
|
};
|
|
2180
2187
|
updateWidth();
|
|
2181
2188
|
if (typeof ResizeObserver === "undefined") {
|