(props: {
issue: Accessor<CameraPreviewIssue | null>;
})
| 354 | // Legacy stuff below |
| 355 | |
| 356 | function LegacyCameraPreviewPage(props: { |
| 357 | issue: Accessor<CameraPreviewIssue | null>; |
| 358 | }) { |
| 359 | const isCameraOnlyMode = () => getCameraOnlyMode(); |
| 360 | |
| 361 | const [state, setState] = makePersisted( |
| 362 | createStore<CameraWindowState>(getDefaultCameraWindowState()), |
| 363 | { name: CAMERA_WINDOW_STATE_STORAGE_KEY }, |
| 364 | ); |
| 365 | |
| 366 | const centerCameraOnlyWindow = () => { |
| 367 | ignoreMoveFor(1500); |
| 368 | void commands.ignoreCameraWindowPosition(1500); |
| 369 | void centerCurrentWindow(); |
| 370 | setTimeout(() => { |
| 371 | void centerCurrentWindow(); |
| 372 | }, 120); |
| 373 | }; |
| 374 | |
| 375 | onMount(() => { |
| 376 | if (isCameraOnlyMode()) { |
| 377 | centerCameraOnlyWindow(); |
| 378 | } |
| 379 | }); |
| 380 | |
| 381 | createEffect( |
| 382 | on( |
| 383 | () => isCameraOnlyMode(), |
| 384 | (isCameraOnly, wasCameraOnly) => { |
| 385 | if (isCameraOnly && !wasCameraOnly) { |
| 386 | centerCameraOnlyWindow(); |
| 387 | } |
| 388 | }, |
| 389 | ), |
| 390 | ); |
| 391 | |
| 392 | createEffect(() => { |
| 393 | const currentSize = state.size as number | string; |
| 394 | if (typeof currentSize !== "number" || Number.isNaN(currentSize)) { |
| 395 | setState( |
| 396 | "size", |
| 397 | currentSize === "lg" ? CAMERA_PRESET_LARGE : CAMERA_DEFAULT_SIZE, |
| 398 | ); |
| 399 | } |
| 400 | }); |
| 401 | |
| 402 | createEffect(() => { |
| 403 | commands.setCameraPreviewState({ |
| 404 | size: state.size, |
| 405 | shape: state.shape, |
| 406 | mirrored: state.mirrored, |
| 407 | background_blur: normalizeBackgroundBlurMode(state.backgroundBlur), |
| 408 | }); |
| 409 | }); |
| 410 | |
| 411 | const [hasPositioned, setHasPositioned] = createSignal(isCameraOnlyMode()); |
| 412 | |
| 413 | const [hasFrame, setHasFrame] = createSignal(false); |
nothing calls this directly
no test coverage detected