split Main into components, move gif math to backend
This commit is contained in:
+127
-371
@@ -1,8 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte"
|
||||
import { api, convertFileSrc, formatBytes, type Config, type Format, type GifBudgetMode, type GifDither, type RecordedClip, type ExportResult, type CaptureRect } from "./api"
|
||||
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"
|
||||
import TrimPanel from "./TrimPanel.svelte"
|
||||
import GifControls from "./GifControls.svelte"
|
||||
import Preview from "./Preview.svelte"
|
||||
import FramesStrip from "./FramesStrip.svelte"
|
||||
|
||||
type Phase = "idle" | "recording" | "paused" | "editing" | "exporting" | "done"
|
||||
|
||||
@@ -50,6 +54,7 @@
|
||||
let errMsg: string | null = $state(null)
|
||||
let encodeProgress: { pass: number; total: number; pct: number } | null = $state(null)
|
||||
let audioWarning: string | null = $state(null)
|
||||
let retryingAudio: boolean = $state(false)
|
||||
let useFrame: boolean = $state(false)
|
||||
let previewTimer: number | null = null
|
||||
let thumbCache: Map<string, string[]> = $state(new Map())
|
||||
@@ -66,44 +71,49 @@
|
||||
|
||||
// Derived
|
||||
let trimmedDuration = $derived(Math.max(0.1, trimEnd - trimStart))
|
||||
// NOTE: This logic mirrors gif_params() in encode.rs. Keep in sync.
|
||||
// GIF size/dimensions estimate - computed by the Rust backend so the
|
||||
// math stays in lockstep with encode.rs::gif_params.
|
||||
let gifEstimate: { width: number; fps: number; height: number; dims_label: string } | null = $state(null)
|
||||
let gifEstimateTimer: number | null = null
|
||||
|
||||
async function refreshGifEstimate() {
|
||||
if (!clip || format !== "gif") { gifEstimate = null; return }
|
||||
try {
|
||||
gifEstimate = await api.estimateGifParams({
|
||||
format: "gif",
|
||||
fps,
|
||||
target_bytes: Math.round(targetMB * 1_048_576),
|
||||
gif_budget_mode: gifBudgetMode,
|
||||
gif_dither: gifDither,
|
||||
gif_colors: gifColors,
|
||||
clip_width: clip.width,
|
||||
clip_height: clip.height,
|
||||
duration_secs: trimmedDuration,
|
||||
})
|
||||
} catch {
|
||||
gifEstimate = null
|
||||
}
|
||||
}
|
||||
|
||||
// Debounced reactive estimate: any change to the inputs re-estimates
|
||||
// ~150 ms after the last change. Cancels in-flight when inputs change again.
|
||||
$effect(() => {
|
||||
// Touch every input so the effect re-runs on any of them changing.
|
||||
void phase; void clip; void format; void fps; void targetMB
|
||||
void gifBudgetMode; void gifDither; void gifColors
|
||||
void trimStart; void trimEnd
|
||||
if (phase !== "editing" || !clip) return
|
||||
if (gifEstimateTimer !== null) clearTimeout(gifEstimateTimer)
|
||||
gifEstimateTimer = window.setTimeout(() => { void refreshGifEstimate() }, 150)
|
||||
return () => {
|
||||
if (gifEstimateTimer !== null) { clearTimeout(gifEstimateTimer); gifEstimateTimer = null }
|
||||
}
|
||||
})
|
||||
|
||||
let previewDims = $derived.by(() => {
|
||||
if (!clip) return ""
|
||||
if (format === "gif") {
|
||||
const colorFactor = Math.sqrt(gifColors / 256)
|
||||
const bpf = 0.2 * colorFactor
|
||||
const requestedFps = fps
|
||||
const aspect = clip.height === 0 ? 16 / 9 : clip.width / clip.height
|
||||
|
||||
if (gifBudgetMode === "resolution") {
|
||||
const maxW = Math.min(clip.width, 1280)
|
||||
const w = Math.max(120, maxW)
|
||||
const h = Math.round(w / aspect)
|
||||
const pixelsPerFrame = w * h
|
||||
const bytesPerFrame = pixelsPerFrame * bpf
|
||||
const maxFrames = Math.max(1, Math.floor((targetMB * 1_048_576) / bytesPerFrame))
|
||||
const minFps = Math.max(1, Math.round(maxFrames / trimmedDuration))
|
||||
const effectiveFps = Math.max(1, Math.min(requestedFps, minFps))
|
||||
const w2 = w & ~1
|
||||
const h2 = Math.round(w2 / aspect) & ~1
|
||||
return `${w2}x${h2} @ ${effectiveFps}fps`
|
||||
} else if (gifBudgetMode === "framerate") {
|
||||
const frames = Math.max(1, requestedFps * trimmedDuration)
|
||||
const budget = (targetMB * 1_048_576) / (frames * bpf)
|
||||
const w = Math.sqrt(budget * aspect)
|
||||
const w2 = Math.min(clip.width, Math.max(120, Math.round(w))) & ~1
|
||||
const h2 = Math.round(w2 / aspect) & ~1
|
||||
return `${w2}x${h2}`
|
||||
} else {
|
||||
const framesAtFull = Math.max(1, requestedFps * trimmedDuration)
|
||||
const budgetAtFull = (targetMB * 1_048_576) / (framesAtFull * bpf)
|
||||
const wAtFull = Math.sqrt(budgetAtFull * aspect)
|
||||
const scale = wAtFull < clip.width ? Math.sqrt(wAtFull / clip.width) : 1
|
||||
const w2 = Math.max(60, Math.round(clip.width * scale)) & ~1
|
||||
const h2 = Math.round(w2 / aspect) & ~1
|
||||
const effectiveFps = Math.max(1, Math.min(requestedFps, Math.round(requestedFps * scale)))
|
||||
return `${w2}x${h2} @ ${effectiveFps}fps`
|
||||
}
|
||||
return gifEstimate ? gifEstimate.dims_label : "computing..."
|
||||
}
|
||||
return `${clip.width}x${clip.height}`
|
||||
})
|
||||
@@ -112,10 +122,11 @@
|
||||
let unlistenHotkey: (() => void) | null = null
|
||||
let unlistenProgress: (() => void) | null = null
|
||||
let unlistenAudio: (() => void) | null = null
|
||||
let unlistenAudioRecovered: (() => void) | null = null
|
||||
let unlistenOverlayClosed: (() => void) | null = null
|
||||
|
||||
void (async () => {
|
||||
const [overlayClosed, hotkey, progress, audio] = await Promise.all([
|
||||
const [overlayClosed, hotkey, progress, audio, audioRecovered] = await Promise.all([
|
||||
listen("overlay-closed", () => { useFrame = false }),
|
||||
api.onHotkey((kind) => {
|
||||
if (kind === "start" && phase === "idle") void startRec()
|
||||
@@ -132,11 +143,13 @@
|
||||
api.onAudioFailed((msg) => {
|
||||
audioWarning = msg || "audio capture failed - audio will not be recorded"
|
||||
}),
|
||||
listen("audio-recovered", () => { audioWarning = null }),
|
||||
])
|
||||
unlistenOverlayClosed = overlayClosed
|
||||
unlistenHotkey = hotkey
|
||||
unlistenProgress = progress
|
||||
unlistenAudio = audio
|
||||
unlistenAudioRecovered = audioRecovered
|
||||
|
||||
try {
|
||||
config = await api.getConfig()
|
||||
@@ -152,6 +165,7 @@
|
||||
unlistenHotkey?.()
|
||||
unlistenProgress?.()
|
||||
unlistenAudio?.()
|
||||
unlistenAudioRecovered?.()
|
||||
unlistenOverlayClosed?.()
|
||||
}
|
||||
})
|
||||
@@ -220,6 +234,17 @@
|
||||
} catch (e) { errMsg = String(e) }
|
||||
}
|
||||
|
||||
async function retryAudio() {
|
||||
if (retryingAudio) return
|
||||
retryingAudio = true
|
||||
try {
|
||||
await api.restartAudioCapture()
|
||||
// On success, the audio-recovered listener clears audioWarning.
|
||||
// On failure, onAudioFailed re-fires with the new error message.
|
||||
} catch (e) { errMsg = String(e) }
|
||||
finally { retryingAudio = false }
|
||||
}
|
||||
|
||||
async function browseOutput() {
|
||||
const ext = format === "gif" ? "gif" : format === "webm" ? "webm" : "mp4"
|
||||
const picked = await save({ defaultPath: outputPath, filters: [{ name: format.toUpperCase(), extensions: [ext] }] })
|
||||
@@ -322,74 +347,25 @@
|
||||
|
||||
function tick() { elapsedTimer = window.setInterval(() => { elapsed += 0.1 }, 100) }
|
||||
function clearTick() { if (elapsedTimer !== null) { clearInterval(elapsedTimer); elapsedTimer = null } }
|
||||
function minMB(s: number): number { return Math.max(0.1, Math.max(50_000, s * 50_000) / 1_048_576) }
|
||||
function maxMB(s: number): number { return Math.min(200, Math.max(10, s * 5)) }
|
||||
// Minimum target file size (MB) for a clip of `s` seconds.
|
||||
// Hard floor of 0.1 MB; otherwise scale ~50 KB/sec with a 50 KB absolute floor.
|
||||
function minMB(s: number): number {
|
||||
const perSecBytes = s * 50_000
|
||||
const floorBytes = 50_000
|
||||
return Math.max(0.1, Math.max(floorBytes, perSecBytes) / 1_048_576)
|
||||
}
|
||||
// Maximum target file size (MB) for a clip of `s` seconds.
|
||||
// Capped at 200 MB; floor of 10 MB; otherwise scale 5 MB/sec.
|
||||
function maxMB(s: number): number {
|
||||
return Math.min(200, Math.max(10, s * 5))
|
||||
}
|
||||
|
||||
// Trim drag
|
||||
let trackEl: HTMLDivElement | null = $state(null)
|
||||
// Trim state is lifted here so the Preview component can read it
|
||||
// (to swap to the raw frame during drag) and the parent can debounce
|
||||
// exports that depend on the values.
|
||||
let dragging: 'start' | 'end' | null = $state(null)
|
||||
let trimPreviewPath: string | null = $state(null)
|
||||
let trimPreviewBust: number = $state(0)
|
||||
let lastTrimPreview = 0
|
||||
|
||||
function pointerToSecs(e: PointerEvent): number {
|
||||
if (!trackEl || !clip) return 0
|
||||
const rect = trackEl.getBoundingClientRect()
|
||||
const x = e.clientX - rect.left
|
||||
const ratio = Math.max(0, Math.min(1, x / rect.width))
|
||||
return ratio * clip.duration_secs
|
||||
}
|
||||
|
||||
async function updateTrimPreview(secs: number) {
|
||||
const now = Date.now()
|
||||
if (now - lastTrimPreview < 100) return // 10Hz max
|
||||
lastTrimPreview = now
|
||||
try {
|
||||
trimPreviewPath = await api.renderRawPreview(secs)
|
||||
trimPreviewBust = Date.now()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
function startDrag(which: 'start' | 'end', e: PointerEvent) {
|
||||
dragging = which
|
||||
const el = e.currentTarget as HTMLElement
|
||||
el.setPointerCapture(e.pointerId)
|
||||
// Show raw frame at current trim position
|
||||
void updateTrimPreview(which === 'start' ? trimStart : trimEnd)
|
||||
}
|
||||
|
||||
function onDrag(e: PointerEvent) {
|
||||
if (!dragging || !clip) return
|
||||
const secs = pointerToSecs(e)
|
||||
if (dragging === 'start') {
|
||||
trimStart = Math.min(secs, trimEnd - 0.1)
|
||||
} else {
|
||||
trimEnd = Math.max(secs, trimStart + 0.1)
|
||||
}
|
||||
// Update raw preview as user drags
|
||||
void updateTrimPreview(secs)
|
||||
}
|
||||
|
||||
function endDrag(e: PointerEvent) {
|
||||
const el = e.currentTarget as HTMLElement
|
||||
el.releasePointerCapture(e.pointerId)
|
||||
dragging = null
|
||||
// Switch back to compressed preview
|
||||
trimPreviewPath = null
|
||||
void refreshPreview()
|
||||
}
|
||||
|
||||
function onTrackClick(e: PointerEvent) {
|
||||
if (!clip || !trackEl) return
|
||||
const secs = pointerToSecs(e)
|
||||
const distToStart = Math.abs(secs - trimStart)
|
||||
const distToEnd = Math.abs(secs - trimEnd)
|
||||
if (distToStart < distToEnd) {
|
||||
trimStart = Math.min(secs, trimEnd - 0.1)
|
||||
} else {
|
||||
trimEnd = Math.max(secs, trimStart + 0.1)
|
||||
}
|
||||
}
|
||||
|
||||
// Reactivity
|
||||
$effect(() => {
|
||||
@@ -540,7 +516,10 @@
|
||||
<svg width="12" height="12" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round">
|
||||
<path d="M7 1L13 12H1L7 1z"/><line x1="7" y1="5" x2="7" y2="8"/><circle cx="7" cy="10.5" r="0.5" fill="currentColor"/>
|
||||
</svg>
|
||||
{audioWarning}
|
||||
<span>{audioWarning}</span>
|
||||
<button class="audio-retry" onclick={retryAudio} disabled={retryingAudio}>
|
||||
{retryingAudio ? "Retrying" : "Retry"}
|
||||
</button>
|
||||
</div>
|
||||
{:else if config?.capture.capture_audio}
|
||||
<div class="audio-ok">
|
||||
@@ -580,113 +559,35 @@
|
||||
</div>
|
||||
|
||||
<!-- Preview -->
|
||||
{#if dragging && trimPreviewPath}
|
||||
<div class="preview-box">
|
||||
<img src={convertFileSrc(trimPreviewPath) + "?t=" + trimPreviewBust} alt="preview frame" class="preview-img"/>
|
||||
<div class="preview-loading">original</div>
|
||||
</div>
|
||||
{:else if previewPath}
|
||||
<div class="preview-box">
|
||||
<img src={convertFileSrc(previewPath) + "?t=" + previewCacheBust} alt="preview frame" class="preview-img"/>
|
||||
{#if previewLoading}<div class="preview-loading">rendering</div>{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="preview-box empty">
|
||||
<span class="preview-placeholder">preview</span>
|
||||
</div>
|
||||
{/if}
|
||||
<Preview
|
||||
{previewPath}
|
||||
{previewLoading}
|
||||
{previewCacheBust}
|
||||
{trimPreviewPath}
|
||||
{trimPreviewBust}
|
||||
{dragging}
|
||||
/>
|
||||
|
||||
<!-- Trim timeline -->
|
||||
<div class="trim-block">
|
||||
<div class="trim-labels">
|
||||
<span class="mono">{trimStart.toFixed(2)}s</span>
|
||||
<span class="trim-kept">{trimmedDuration.toFixed(2)}s kept</span>
|
||||
<span class="mono">{trimEnd.toFixed(2)}s</span>
|
||||
</div>
|
||||
<div
|
||||
class="trim-track"
|
||||
bind:this={trackEl}
|
||||
onpointerdown={onTrackClick}
|
||||
role="none"
|
||||
>
|
||||
<div class="trim-range" style="left:{(trimStart/clip.duration_secs)*100}%; right:{(1-trimEnd/clip.duration_secs)*100}%"></div>
|
||||
<div
|
||||
class="trim-handle trim-start"
|
||||
style="left:{(trimStart/clip.duration_secs)*100}%"
|
||||
role="slider"
|
||||
aria-label="trim start"
|
||||
aria-valuemin={0}
|
||||
aria-valuemax={trimEnd - 0.1}
|
||||
aria-valuenow={trimStart}
|
||||
tabindex="0"
|
||||
onpointerdown={(e) => startDrag('start', e)}
|
||||
onpointermove={onDrag}
|
||||
onpointerup={endDrag}
|
||||
onkeydown={(e) => {
|
||||
if (!clip) return
|
||||
const step = e.shiftKey ? 0.5 : 0.05
|
||||
if (e.key === 'ArrowLeft') { trimStart = Math.max(0, trimStart - step); e.preventDefault() }
|
||||
else if (e.key === 'ArrowRight') { trimStart = Math.min(trimEnd - 0.1, trimStart + step); e.preventDefault() }
|
||||
}}
|
||||
></div>
|
||||
<div
|
||||
class="trim-handle trim-end"
|
||||
style="left:{(trimEnd/clip.duration_secs)*100}%"
|
||||
role="slider"
|
||||
aria-label="trim end"
|
||||
aria-valuemin={trimStart + 0.1}
|
||||
aria-valuemax={clip.duration_secs}
|
||||
aria-valuenow={trimEnd}
|
||||
tabindex="0"
|
||||
onpointerdown={(e) => startDrag('end', e)}
|
||||
onpointermove={onDrag}
|
||||
onpointerup={endDrag}
|
||||
onkeydown={(e) => {
|
||||
if (!clip) return
|
||||
const step = e.shiftKey ? 0.5 : 0.05
|
||||
if (e.key === 'ArrowLeft') { trimEnd = Math.max(trimStart + 0.1, trimEnd - step); e.preventDefault() }
|
||||
else if (e.key === 'ArrowRight') { trimEnd = Math.min(clip.duration_secs, trimEnd + step); e.preventDefault() }
|
||||
}}
|
||||
></div>
|
||||
</div>
|
||||
<!-- Screen reader alternative: these range inputs mirror the drag handle positions. -->
|
||||
<input type="range" min="0" max={clip.duration_secs} step="0.05" value={trimStart}
|
||||
oninput={(e) => { const v = parseFloat((e.currentTarget as HTMLInputElement).value); trimStart = Math.min(v, trimEnd - 0.1) }}
|
||||
class="sr-only" aria-label="trim start seconds" />
|
||||
<input type="range" min="0" max={clip.duration_secs} step="0.05" value={trimEnd}
|
||||
oninput={(e) => { const v = parseFloat((e.currentTarget as HTMLInputElement).value); trimEnd = Math.max(v, trimStart + 0.1) }}
|
||||
class="sr-only" aria-label="trim end seconds" />
|
||||
</div>
|
||||
<TrimPanel
|
||||
{clip}
|
||||
bind:trimStart
|
||||
bind:trimEnd
|
||||
bind:dragging
|
||||
bind:trimPreviewPath
|
||||
bind:trimPreviewBust
|
||||
onAfterChange={refreshPreview}
|
||||
/>
|
||||
|
||||
<!-- GIF frames -->
|
||||
{#if format === "gif" && (thumbnails.length > 0 || loadingThumbs)}
|
||||
<div class="frames-block">
|
||||
<div class="frames-head">
|
||||
<span class="section-title">Frames</span>
|
||||
{#if deletedFrames.size > 0}
|
||||
<button class="text-btn" onclick={clearDeleted}>Clear ({deletedFrames.size})</button>
|
||||
{/if}
|
||||
</div>
|
||||
{#if loadingThumbs}
|
||||
<p class="frames-hint">extracting...</p>
|
||||
{:else}
|
||||
<div class="frames-strip">
|
||||
{#each thumbnails as path, idx}
|
||||
<button
|
||||
class="frame-thumb"
|
||||
class:del={deletedFrames.has(idx)}
|
||||
onclick={() => toggleThumb(idx)}
|
||||
aria-pressed={deletedFrames.has(idx)}
|
||||
aria-label="frame {idx+1} - {deletedFrames.has(idx) ? 'deleted, click to restore' : 'click to delete'}"
|
||||
title={deletedFrames.has(idx) ? "restore" : "delete"}
|
||||
>
|
||||
<img src={convertFileSrc(path)} alt="" loading="lazy" />
|
||||
<span class="frame-idx">{idx+1}</span>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<FramesStrip
|
||||
{thumbnails}
|
||||
{deletedFrames}
|
||||
loading={loadingThumbs}
|
||||
onToggle={toggleThumb}
|
||||
onClear={clearDeleted}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -711,54 +612,12 @@
|
||||
</div>
|
||||
|
||||
{#if format === "gif"}
|
||||
<div class="control-group">
|
||||
<span class="section-title">Budget priority</span>
|
||||
<div class="fmt-bar">
|
||||
{#each (["resolution", "framerate", "balanced"] as const) as m}
|
||||
<button
|
||||
class="fmt-chip"
|
||||
class:active={gifBudgetMode === m}
|
||||
onclick={() => { gifBudgetMode = m }}
|
||||
>{m === "resolution" ? "Resolution" : m === "framerate" ? "Framerate" : "Balanced"}</button>
|
||||
{/each}
|
||||
</div>
|
||||
<p class="estimate">
|
||||
{gifBudgetMode === "resolution" ? "Keeps resolution high, may reduce FPS" :
|
||||
gifBudgetMode === "framerate" ? "Keeps FPS high, may reduce resolution" :
|
||||
"Balances resolution and FPS"}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<span class="section-title">Colors</span>
|
||||
<div class="control-head">
|
||||
<input
|
||||
type="range"
|
||||
class="styled-range"
|
||||
min={2}
|
||||
max={256}
|
||||
step={1}
|
||||
bind:value={gifColors}
|
||||
onchange={refreshPreview}
|
||||
/>
|
||||
<span class="mono" style="min-width:32px;text-align:right">{gifColors}</span>
|
||||
</div>
|
||||
<p class="estimate">{gifColors <= 32 ? "Low - small file, posterized" : gifColors <= 128 ? "Medium - balanced" : "High - full color"}</p>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<span class="section-title">Dithering</span>
|
||||
<div class="fmt-bar">
|
||||
{#each (["floyd_steinberg", "bayer", "none"] as const) as d}
|
||||
<button
|
||||
class="fmt-chip"
|
||||
class:active={gifDither === d}
|
||||
onclick={() => { gifDither = d; refreshPreview() }}
|
||||
>{d === "floyd_steinberg" ? "Floyd-Steinberg" : d === "bayer" ? "Bayer" : "None"}</button>
|
||||
{/each}
|
||||
</div>
|
||||
<p class="estimate">{gifDither === "floyd_steinberg" ? "Smooth gradients, slightly larger" : gifDither === "bayer" ? "Patterned, smaller file" : "No dithering, smallest file"}</p>
|
||||
</div>
|
||||
<GifControls
|
||||
bind:budgetMode={gifBudgetMode}
|
||||
bind:dither={gifDither}
|
||||
bind:colors={gifColors}
|
||||
onChange={refreshPreview}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<!-- FPS + Audio -->
|
||||
@@ -1126,6 +985,21 @@
|
||||
font-size: 12px;
|
||||
color: var(--err);
|
||||
}
|
||||
.audio-warn > span { flex: 1; }
|
||||
.audio-retry {
|
||||
background: transparent;
|
||||
border: 1px solid var(--err-border);
|
||||
color: var(--err);
|
||||
padding: 3px 10px;
|
||||
border-radius: var(--r-sm);
|
||||
font-family: var(--sans);
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: background 80ms, border-color 80ms;
|
||||
}
|
||||
.audio-retry:hover:not(:disabled) { background: var(--err); color: #fff; }
|
||||
.audio-retry:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
|
||||
.audio-ok {
|
||||
display: flex;
|
||||
@@ -1234,113 +1108,7 @@
|
||||
.fmt-chip:hover { color: var(--text-2); }
|
||||
.fmt-chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
|
||||
|
||||
/* Preview */
|
||||
.preview-box {
|
||||
position: relative;
|
||||
border-radius: var(--r-sm);
|
||||
overflow: hidden;
|
||||
background: var(--bg-2);
|
||||
border: 1px solid var(--border);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
aspect-ratio: 16 / 9;
|
||||
}
|
||||
.preview-box.empty { aspect-ratio: 16 / 9; }
|
||||
.preview-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
display: block;
|
||||
}
|
||||
.preview-placeholder {
|
||||
font-size: 11px;
|
||||
color: var(--text-4);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
}
|
||||
.preview-loading {
|
||||
position: absolute; inset: 0;
|
||||
background: rgba(0,0,0,0.5);
|
||||
display: grid; place-items: center;
|
||||
font-size: 11px;
|
||||
color: var(--text-3);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
/* Trim */
|
||||
.trim-block { display: flex; flex-direction: column; gap: 8px; }
|
||||
.trim-track {
|
||||
position: relative;
|
||||
height: 4px;
|
||||
background: var(--bg-3);
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.trim-range {
|
||||
position: absolute; top: 0; bottom: 0;
|
||||
background: var(--accent);
|
||||
border-radius: 2px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.trim-handle {
|
||||
position: absolute; top: 50%; transform: translate(-50%, -50%);
|
||||
width: 12px; height: 22px;
|
||||
background: var(--accent);
|
||||
border-radius: var(--r-sm);
|
||||
cursor: ew-resize;
|
||||
z-index: 1;
|
||||
touch-action: none;
|
||||
}
|
||||
.trim-handle:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-glow); }
|
||||
.trim-labels {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 11px;
|
||||
color: var(--text-3);
|
||||
font-family: var(--mono);
|
||||
}
|
||||
.trim-kept { color: var(--accent); }
|
||||
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
|
||||
|
||||
/* Frames */
|
||||
.frames-block { display: flex; flex-direction: column; gap: 8px; }
|
||||
.frames-head { display: flex; justify-content: space-between; align-items: center; }
|
||||
.frames-hint { margin: 0; font-size: 11px; color: var(--text-3); }
|
||||
.frames-strip {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
.frames-strip::-webkit-scrollbar { height: 3px; }
|
||||
.frames-strip::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }
|
||||
|
||||
.frame-thumb {
|
||||
flex: 0 0 auto;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
border: 1px solid transparent;
|
||||
border-radius: var(--r-sm);
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
transition: border-color 80ms;
|
||||
}
|
||||
.frame-thumb img { display: block; width: 64px; height: auto; border-radius: 2px; }
|
||||
.frame-thumb:hover { border-color: var(--accent); }
|
||||
.frame-thumb.del img { opacity: 0.2; filter: grayscale(1); }
|
||||
.frame-thumb.del { border-color: var(--err); }
|
||||
.frame-idx {
|
||||
position: absolute; bottom: 2px; right: 3px;
|
||||
font-family: var(--mono); font-size: 9px;
|
||||
color: var(--text-3);
|
||||
background: rgba(0,0,0,0.6);
|
||||
padding: 0 3px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* Right panel controls */
|
||||
/* Preview (Trim, Frames, GifControls own their styles in their components) */
|
||||
.control-group { display: flex; flex-direction: column; gap: 8px; }
|
||||
.control-head {
|
||||
display: flex;
|
||||
@@ -1505,18 +1273,6 @@
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
.text-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--accent);
|
||||
cursor: pointer;
|
||||
font-size: 11px;
|
||||
font-family: var(--sans);
|
||||
padding: 0;
|
||||
transition: color 80ms;
|
||||
}
|
||||
.text-btn:hover { color: var(--accent-hover); }
|
||||
|
||||
/* ---- Exporting ---- */
|
||||
.exporting {
|
||||
flex: 1;
|
||||
|
||||
Reference in New Issue
Block a user