@liveroom-tech/react-immersive 1.0.0 → 1.0.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.js +5 -3
- package/dist/index.mjs +5 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5025,10 +5025,12 @@ function ModelViewer({
|
|
|
5025
5025
|
const sceneRef = (0, import_react21.useRef)(null);
|
|
5026
5026
|
const fitAttemptedRef = (0, import_react21.useRef)(false);
|
|
5027
5027
|
const fitInFlightRef = (0, import_react21.useRef)(false);
|
|
5028
|
+
const cameraProvidedRef = (0, import_react21.useRef)(Boolean(camera));
|
|
5029
|
+
cameraProvidedRef.current = Boolean(camera);
|
|
5028
5030
|
const initialCameraStateRef = (0, import_react21.useRef)(null);
|
|
5029
5031
|
const [isAutoFraming, setIsAutoFraming] = (0, import_react21.useState)(Boolean(modelUrl));
|
|
5030
5032
|
const [cameraPositioned, setCameraPositioned] = (0, import_react21.useState)(
|
|
5031
|
-
!modelUrl || Boolean(onAutoFit)
|
|
5033
|
+
!modelUrl || Boolean(onAutoFit) || Boolean(camera)
|
|
5032
5034
|
);
|
|
5033
5035
|
const [downloadMenuOpen, setDownloadMenuOpen] = (0, import_react21.useState)(false);
|
|
5034
5036
|
const [modelLoaded, setModelLoaded] = (0, import_react21.useState)(false);
|
|
@@ -5846,7 +5848,7 @@ function ModelViewer({
|
|
|
5846
5848
|
return;
|
|
5847
5849
|
}
|
|
5848
5850
|
setIsAutoFraming(true);
|
|
5849
|
-
setCameraPositioned(Boolean(onAutoFit));
|
|
5851
|
+
setCameraPositioned(Boolean(onAutoFit) || cameraProvidedRef.current);
|
|
5850
5852
|
let cancelled = false;
|
|
5851
5853
|
let timer = null;
|
|
5852
5854
|
const scheduleCheck = (delay) => {
|
|
@@ -5870,7 +5872,7 @@ function ModelViewer({
|
|
|
5870
5872
|
return;
|
|
5871
5873
|
}
|
|
5872
5874
|
fitInFlightRef.current = true;
|
|
5873
|
-
const fitPromise = onAutoFit ? onAutoFit() : fitScene(true);
|
|
5875
|
+
const fitPromise = onAutoFit ? onAutoFit() : cameraProvidedRef.current ? Promise.resolve(true) : fitScene(true);
|
|
5874
5876
|
fitPromise.then((didFit) => {
|
|
5875
5877
|
fitAttemptedRef.current = didFit !== false;
|
|
5876
5878
|
if (fitAttemptedRef.current) {
|
package/dist/index.mjs
CHANGED
|
@@ -5083,10 +5083,12 @@ function ModelViewer({
|
|
|
5083
5083
|
const sceneRef = useRef9(null);
|
|
5084
5084
|
const fitAttemptedRef = useRef9(false);
|
|
5085
5085
|
const fitInFlightRef = useRef9(false);
|
|
5086
|
+
const cameraProvidedRef = useRef9(Boolean(camera));
|
|
5087
|
+
cameraProvidedRef.current = Boolean(camera);
|
|
5086
5088
|
const initialCameraStateRef = useRef9(null);
|
|
5087
5089
|
const [isAutoFraming, setIsAutoFraming] = useState10(Boolean(modelUrl));
|
|
5088
5090
|
const [cameraPositioned, setCameraPositioned] = useState10(
|
|
5089
|
-
!modelUrl || Boolean(onAutoFit)
|
|
5091
|
+
!modelUrl || Boolean(onAutoFit) || Boolean(camera)
|
|
5090
5092
|
);
|
|
5091
5093
|
const [downloadMenuOpen, setDownloadMenuOpen] = useState10(false);
|
|
5092
5094
|
const [modelLoaded, setModelLoaded] = useState10(false);
|
|
@@ -5904,7 +5906,7 @@ function ModelViewer({
|
|
|
5904
5906
|
return;
|
|
5905
5907
|
}
|
|
5906
5908
|
setIsAutoFraming(true);
|
|
5907
|
-
setCameraPositioned(Boolean(onAutoFit));
|
|
5909
|
+
setCameraPositioned(Boolean(onAutoFit) || cameraProvidedRef.current);
|
|
5908
5910
|
let cancelled = false;
|
|
5909
5911
|
let timer = null;
|
|
5910
5912
|
const scheduleCheck = (delay) => {
|
|
@@ -5928,7 +5930,7 @@ function ModelViewer({
|
|
|
5928
5930
|
return;
|
|
5929
5931
|
}
|
|
5930
5932
|
fitInFlightRef.current = true;
|
|
5931
|
-
const fitPromise = onAutoFit ? onAutoFit() : fitScene(true);
|
|
5933
|
+
const fitPromise = onAutoFit ? onAutoFit() : cameraProvidedRef.current ? Promise.resolve(true) : fitScene(true);
|
|
5932
5934
|
fitPromise.then((didFit) => {
|
|
5933
5935
|
fitAttemptedRef.current = didFit !== false;
|
|
5934
5936
|
if (fitAttemptedRef.current) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liveroom-tech/react-immersive",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"homepage": "https://react-immersive.liveroom.dev",
|
|
76
76
|
"repository": {
|
|
77
77
|
"type": "git",
|
|
78
|
-
"url": "https://
|
|
78
|
+
"url": "https://github.com/liveroom-technologies/react-immersive-docs.git"
|
|
79
79
|
},
|
|
80
80
|
"bugs": {
|
|
81
81
|
"url": "https://github.com/liveroom-technologies/react-immersive-docs/issues"
|