@liveroom-tech/react-immersive 1.3.1 → 1.3.2

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 CHANGED
@@ -4128,12 +4128,16 @@ function CinematicCamera({
4128
4128
  const enterPos = (0, import_react15.useRef)(new import_three18.Vector3());
4129
4129
  const enterTarget = (0, import_react15.useRef)(new import_three18.Vector3());
4130
4130
  const startedRef = (0, import_react15.useRef)(false);
4131
+ const pausedElapsedRef = (0, import_react15.useRef)(0);
4131
4132
  const orbitRef = (0, import_react15.useRef)(null);
4132
4133
  const tmpPos = (0, import_react15.useMemo)(() => new import_three18.Vector3(), []);
4133
4134
  const tmpTarget = (0, import_react15.useMemo)(() => new import_three18.Vector3(), []);
4134
4135
  (0, import_react15.useEffect)(() => {
4135
4136
  if (!playing) {
4136
4137
  startedRef.current = false;
4138
+ if (elapsedRef.current > 0) {
4139
+ pausedElapsedRef.current = elapsedRef.current;
4140
+ }
4137
4141
  return;
4138
4142
  }
4139
4143
  const controls = controlsRef.current;
@@ -4141,7 +4145,7 @@ function CinematicCamera({
4141
4145
  controls.getPosition(enterPos.current);
4142
4146
  controls.getTarget(enterTarget.current);
4143
4147
  }
4144
- elapsedRef.current = 0;
4148
+ elapsedRef.current = pausedElapsedRef.current || 0;
4145
4149
  enterElapsedRef.current = 0;
4146
4150
  if (!hasPath) {
4147
4151
  const scene = sceneRef.current;
@@ -4205,6 +4209,7 @@ function CinematicCamera({
4205
4209
  );
4206
4210
  if (finished) {
4207
4211
  startedRef.current = false;
4212
+ pausedElapsedRef.current = 0;
4208
4213
  onFinished?.();
4209
4214
  return;
4210
4215
  }
package/dist/index.mjs CHANGED
@@ -4167,12 +4167,16 @@ function CinematicCamera({
4167
4167
  const enterPos = useRef8(new Vector36());
4168
4168
  const enterTarget = useRef8(new Vector36());
4169
4169
  const startedRef = useRef8(false);
4170
+ const pausedElapsedRef = useRef8(0);
4170
4171
  const orbitRef = useRef8(null);
4171
4172
  const tmpPos = useMemo11(() => new Vector36(), []);
4172
4173
  const tmpTarget = useMemo11(() => new Vector36(), []);
4173
4174
  useEffect11(() => {
4174
4175
  if (!playing) {
4175
4176
  startedRef.current = false;
4177
+ if (elapsedRef.current > 0) {
4178
+ pausedElapsedRef.current = elapsedRef.current;
4179
+ }
4176
4180
  return;
4177
4181
  }
4178
4182
  const controls = controlsRef.current;
@@ -4180,7 +4184,7 @@ function CinematicCamera({
4180
4184
  controls.getPosition(enterPos.current);
4181
4185
  controls.getTarget(enterTarget.current);
4182
4186
  }
4183
- elapsedRef.current = 0;
4187
+ elapsedRef.current = pausedElapsedRef.current || 0;
4184
4188
  enterElapsedRef.current = 0;
4185
4189
  if (!hasPath) {
4186
4190
  const scene = sceneRef.current;
@@ -4244,6 +4248,7 @@ function CinematicCamera({
4244
4248
  );
4245
4249
  if (finished) {
4246
4250
  startedRef.current = false;
4251
+ pausedElapsedRef.current = 0;
4247
4252
  onFinished?.();
4248
4253
  return;
4249
4254
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveroom-tech/react-immersive",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",