@doyourjob/gravity-ui-page-constructor 5.31.235 → 5.31.236
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.
|
@@ -12,9 +12,9 @@ const UnicornScene = (props) => {
|
|
|
12
12
|
const sceneRef = (0, react_1.useRef)(null);
|
|
13
13
|
const syncPausedState = (0, react_1.useCallback)(() => {
|
|
14
14
|
if (sceneRef.current) {
|
|
15
|
-
sceneRef.current.paused = !play;
|
|
15
|
+
sceneRef.current.paused = !play || !inView;
|
|
16
16
|
}
|
|
17
|
-
}, [play]);
|
|
17
|
+
}, [play, inView]);
|
|
18
18
|
(0, react_1.useEffect)(() => {
|
|
19
19
|
const observer = new IntersectionObserver(([entry]) => {
|
|
20
20
|
setInView(entry.isIntersecting);
|
|
@@ -33,13 +33,14 @@ const UnicornScene = (props) => {
|
|
|
33
33
|
syncPausedState();
|
|
34
34
|
const timer = setTimeout(syncPausedState, 100);
|
|
35
35
|
return () => clearTimeout(timer);
|
|
36
|
-
}, [syncPausedState
|
|
36
|
+
}, [syncPausedState]);
|
|
37
37
|
const handleLoad = () => {
|
|
38
38
|
syncPausedState();
|
|
39
39
|
if (rest.onLoad) {
|
|
40
40
|
rest.onLoad();
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
return (react_1.default.createElement("div", { ref: containerRef, style: { width: '100%', height: '100%' } },
|
|
43
|
+
return (react_1.default.createElement("div", { ref: containerRef, style: { width: '100%', height: '100%' } },
|
|
44
|
+
react_1.default.createElement(unicornstudio_react_1.default, Object.assign({}, rest, { sdkUrl: sdkUrl, paused: !play || !inView, lazyLoad: false, sceneRef: sceneRef, onLoad: handleLoad }))));
|
|
44
45
|
};
|
|
45
46
|
exports.default = UnicornScene;
|
|
@@ -9,9 +9,9 @@ const UnicornScene = (props) => {
|
|
|
9
9
|
const sceneRef = useRef(null);
|
|
10
10
|
const syncPausedState = useCallback(() => {
|
|
11
11
|
if (sceneRef.current) {
|
|
12
|
-
sceneRef.current.paused = !play;
|
|
12
|
+
sceneRef.current.paused = !play || !inView;
|
|
13
13
|
}
|
|
14
|
-
}, [play]);
|
|
14
|
+
}, [play, inView]);
|
|
15
15
|
useEffect(() => {
|
|
16
16
|
const observer = new IntersectionObserver(([entry]) => {
|
|
17
17
|
setInView(entry.isIntersecting);
|
|
@@ -30,13 +30,14 @@ const UnicornScene = (props) => {
|
|
|
30
30
|
syncPausedState();
|
|
31
31
|
const timer = setTimeout(syncPausedState, 100);
|
|
32
32
|
return () => clearTimeout(timer);
|
|
33
|
-
}, [syncPausedState
|
|
33
|
+
}, [syncPausedState]);
|
|
34
34
|
const handleLoad = () => {
|
|
35
35
|
syncPausedState();
|
|
36
36
|
if (rest.onLoad) {
|
|
37
37
|
rest.onLoad();
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
return (React.createElement("div", { ref: containerRef, style: { width: '100%', height: '100%' } },
|
|
40
|
+
return (React.createElement("div", { ref: containerRef, style: { width: '100%', height: '100%' } },
|
|
41
|
+
React.createElement(UnicornSceneLib, Object.assign({}, rest, { sdkUrl: sdkUrl, paused: !play || !inView, lazyLoad: false, sceneRef: sceneRef, onLoad: handleLoad }))));
|
|
41
42
|
};
|
|
42
43
|
export default UnicornScene;
|