stop settings from stranding a recording and losing its own state
This commit is contained in:
+12
-2
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte"
|
||||
import { onDestroy, onMount } from "svelte"
|
||||
import { api, formatBytes, type Config, type Format, type GifBudgetMode, type GifDither, type RecordedClip, type ExportResult, type CaptureRect } from "./api"
|
||||
import { save } from "@tauri-apps/plugin-dialog"
|
||||
import { emit, listen } from "@tauri-apps/api/event"
|
||||
@@ -385,6 +385,13 @@
|
||||
|
||||
function tick() { elapsedTimer = window.setInterval(() => { elapsed += 0.1 }, 100) }
|
||||
function clearTick() { if (elapsedTimer !== null) { clearInterval(elapsedTimer); elapsedTimer = null } }
|
||||
onDestroy(clearTick)
|
||||
|
||||
// The settings view replaces Main, which would strand a running capture or
|
||||
// encode with no UI left to stop it, so the button stays locked while one is
|
||||
// live.
|
||||
const BUSY_PHASES: Phase[] = ["recording", "paused", "exporting"]
|
||||
let settingsLocked = $derived(BUSY_PHASES.includes(phase))
|
||||
|
||||
// Reactivity
|
||||
$effect(() => {
|
||||
@@ -473,7 +480,8 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div class="topbar-right">
|
||||
<button class="icon-btn" onclick={onSettings} aria-label="settings" title="settings">
|
||||
<button class="icon-btn" onclick={onSettings} aria-label="settings" disabled={settingsLocked}
|
||||
title={settingsLocked ? "stop the current recording or export first" : "settings"}>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="8" cy="8" r="2"/>
|
||||
<path d="M8 1v2M8 13v2M1 8h2M13 8h2M3.3 3.3l1.4 1.4M11.3 11.3l1.4 1.4M3.3 12.7l1.4-1.4M11.3 4.7l1.4-1.4"/>
|
||||
@@ -806,6 +814,8 @@
|
||||
transition: color 80ms, border-color 80ms, background 80ms;
|
||||
}
|
||||
.icon-btn:hover { color: var(--text); border-color: var(--border-2); background: var(--bg-3); }
|
||||
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
|
||||
.icon-btn:disabled:hover { color: var(--text-3); border-color: var(--border); background: transparent; }
|
||||
|
||||
/* ---- Main ---- */
|
||||
.main {
|
||||
|
||||
Reference in New Issue
Block a user