From 649f51af8bb1874c4638ed6257d7012e8784a63c Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 13 Jul 2026 12:28:23 +0300 Subject: [PATCH 1/3] feat: make timeline /monitor panes resizeable --- app.js | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++- index.html | 4 +++- style.css | 21 ++++++++++++++++++-- 3 files changed, 77 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index d0962a7d2..b29193379 100644 --- a/app.js +++ b/app.js @@ -2822,9 +2822,63 @@ window.addEventListener("keydown", (e) => { else if ((e.ctrlKey || e.metaKey) && (k === "y" || k === "Y")) { e.preventDefault(); redo(); } }); -window.addEventListener("resize", () => { state.dirtyTimeline = true; }); +window.addEventListener("resize", () => { state.dirtyTimeline = true; clampTimelineHeight(); }); + +/* ── Resizable upper / timeline split ── */ +const TL_H_KEY = "fablecut-timeline-h"; +const TL_H_MIN = 180; +const UPPER_MIN = 140; +function availableTimelineMax() { + const app = $("app").getBoundingClientRect(); + const topbar = document.querySelector(".topbar")?.getBoundingClientRect(); + const topbarH = topbar ? topbar.height : 46; + const split = 6; + const gaps = 18; // three 6px flex gaps between four children + return Math.floor(app.height - topbarH - UPPER_MIN - split - gaps); +} +function setTimelineHeight(px) { + const h = clamp(Math.round(px), TL_H_MIN, Math.max(TL_H_MIN, availableTimelineMax())); + $("app").style.setProperty("--timeline-h", h + "px"); + state.dirtyTimeline = true; + return h; +} +function clampTimelineHeight() { + const cur = $("timelinePanel")?.getBoundingClientRect().height; + if (cur) setTimelineHeight(cur); +} +function initPanelSplit() { + const handle = $("splitUpperTimeline"); + const tl = $("timelinePanel"); + if (!handle || !tl) return; + const saved = parseFloat(localStorage.getItem(TL_H_KEY)); + if (saved > 0) setTimelineHeight(saved); + else setTimelineHeight(tl.getBoundingClientRect().height || window.innerHeight * 0.32); + + handle.addEventListener("pointerdown", (e) => { + if (e.button !== 0) return; + e.preventDefault(); + handle.setPointerCapture(e.pointerId); + handle.classList.add("dragging"); + document.body.classList.add("resizing-panels"); + const y0 = e.clientY; + const h0 = tl.getBoundingClientRect().height; + const onMove = (ev) => setTimelineHeight(h0 - (ev.clientY - y0)); + const onUp = () => { + handle.releasePointerCapture(e.pointerId); + handle.classList.remove("dragging"); + document.body.classList.remove("resizing-panels"); + handle.removeEventListener("pointermove", onMove); + handle.removeEventListener("pointerup", onUp); + localStorage.setItem(TL_H_KEY, String(Math.round(tl.getBoundingClientRect().height))); + state.dirtyTimeline = true; + }; + handle.addEventListener("pointermove", onMove); + handle.addEventListener("pointerup", onUp); + }); +} /* ── Boot ── */ +initPanelSplit(); buildTrackDOM(); rebuildClips(); renderBin(); diff --git a/index.html b/index.html index 56b3bb5f4..28254dc3b 100644 --- a/index.html +++ b/index.html @@ -92,8 +92,10 @@ + + -
+
diff --git a/style.css b/style.css index 88da1a072..ebe77acc4 100644 --- a/style.css +++ b/style.css @@ -20,7 +20,25 @@ body { color: var(--text); font: 13px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; } -.app { display: grid; grid-template-rows: 46px minmax(0, 1fr) minmax(230px, 38%); height: 100vh; gap: 6px; padding: 6px; } +.app { + display: flex; flex-direction: column; height: 100vh; gap: 6px; padding: 6px; +} +.topbar { flex: 0 0 46px; } +.upper { flex: 1 1 0; min-height: 140px; min-width: 0; } +.timeline-panel { + flex: 0 0 var(--timeline-h, 32vh); min-height: 180px; overflow: hidden; +} +.v-split { + flex: 0 0 6px; cursor: ns-resize; position: relative; z-index: 5; + border-radius: 3px; +} +.v-split::after { + content: ""; position: absolute; left: 18%; right: 18%; top: 2px; height: 2px; + border-radius: 1px; background: var(--border); transition: background .15s; +} +.v-split:hover::after, .v-split.dragging::after { background: var(--accent); } +body.resizing-panels { cursor: ns-resize !important; } +body.resizing-panels * { cursor: ns-resize !important; user-select: none !important; } .hidden { display: none !important; } .dim { color: var(--dim); } .flex-spacer { flex: 1; } @@ -167,7 +185,6 @@ input[type=range] { accent-color: var(--accent); height: 18px; } .kf-btn.has { color: #ffd166; border-color: #ffd16666; } /* ── Timeline ── */ -.timeline-panel { overflow: hidden; } .timeline-toolbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); } .tiny-label { font-size: 11px; } #zoomSlider { width: 130px; } From fd902ed7c7e1764fecbf748e6e952ab1ad1f0f25 Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 13 Jul 2026 12:32:31 +0300 Subject: [PATCH 2/3] feat: restore the default layout on resize handle double click --- app.js | 12 +++++++++++- index.html | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index b29193379..12ecfe170 100644 --- a/app.js +++ b/app.js @@ -2842,6 +2842,12 @@ function setTimelineHeight(px) { state.dirtyTimeline = true; return h; } +function resetTimelineHeight() { + const h = setTimelineHeight(window.innerHeight * 0.32); + localStorage.removeItem(TL_H_KEY); + state.dirtyTimeline = true; + return h; +} function clampTimelineHeight() { const cur = $("timelinePanel")?.getBoundingClientRect().height; if (cur) setTimelineHeight(cur); @@ -2852,7 +2858,7 @@ function initPanelSplit() { if (!handle || !tl) return; const saved = parseFloat(localStorage.getItem(TL_H_KEY)); if (saved > 0) setTimelineHeight(saved); - else setTimelineHeight(tl.getBoundingClientRect().height || window.innerHeight * 0.32); + else resetTimelineHeight(); handle.addEventListener("pointerdown", (e) => { if (e.button !== 0) return; @@ -2875,6 +2881,10 @@ function initPanelSplit() { handle.addEventListener("pointermove", onMove); handle.addEventListener("pointerup", onUp); }); + handle.addEventListener("dblclick", (e) => { + e.preventDefault(); + resetTimelineHeight(); + }); } /* ── Boot ── */ diff --git a/index.html b/index.html index 28254dc3b..b85783c5a 100644 --- a/index.html +++ b/index.html @@ -92,7 +92,7 @@
- +
From 503eb38d0c411f5661a888a1546cad84c68be921 Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 13 Jul 2026 13:07:43 +0300 Subject: [PATCH 3/3] feat: add track height buttons with three predefined sizes --- app.js | 68 ++- index.html | 8 + style.css | 1191 ++++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 1083 insertions(+), 184 deletions(-) diff --git a/app.js b/app.js index 12ecfe170..97ba9a86a 100644 --- a/app.js +++ b/app.js @@ -16,6 +16,14 @@ const TRACKS = [ { id: "A2", kind: "audio", h: 42, color: "#5a9e3a" }, { id: "A3", kind: "audio", h: 42, color: "#4a8a2f" }, ]; +/* Three timeline density presets. L matches the original track heights (with thumbs). + S is compact solid-color rows; M is in between. */ +const TRACK_SIZE_PRESETS = { + s: { thumbs: false, h: { V4: 26, V3: 26, V2: 26, V1: 26, A1: 22, A2: 22, A3: 22 } }, + m: { thumbs: true, h: { V4: 36, V3: 36, V2: 44, V1: 44, A1: 32, A2: 32, A3: 32 } }, + l: { thumbs: true, h: { V4: 44, V3: 44, V2: 58, V1: 58, A1: 42, A2: 42, A3: 42 } }, +}; +const TRACK_SIZE_KEY = "fablecut-track-size"; const RULER_H = 26; const SNAP_PX = 8; const MIN_DUR = 0.05; @@ -128,6 +136,7 @@ const state = { time: 0, playing: false, pps: 60, snap: true, selId: null, // primary selection (drives the inspector) selIds: new Set(), // full multi-selection (includes selId) + trackSize: "l", // s | m | l — timeline track density preset connected: false, exporting: false, rendering: false, // fast (server/ffmpeg) export in progress guides: false, // safe-area overlay on the monitor @@ -834,7 +843,7 @@ function rebuildClips() { div.style.left = c.start * state.pps + "px"; div.style.width = Math.max(8, c.duration * state.pps) + "px"; let inner = ""; - if (c.kind === "video") { + if (c.kind === "video" && trackSizeShowsThumbs()) { const thumb = runtime.mediaAux.get(c.mediaId)?.thumb; if (thumb) inner += `
`; } @@ -2751,6 +2760,11 @@ els.btnSnap.addEventListener("click", () => { state.snap = !state.snap; els.btnSnap.classList.toggle("on", state.snap); }); +$("btnLayoutReset").addEventListener("click", restoreDefaultLayout); +$("trackSizeGroup").addEventListener("click", (e) => { + const b = e.target.closest("[data-track-size]"); + if (b) setTrackSize(b.dataset.trackSize); +}); els.binTabs.addEventListener("click", (e) => { const b = e.target.closest("[data-tab]"); if (b) setBinTab(b.dataset.tab); @@ -2842,12 +2856,57 @@ function setTimelineHeight(px) { state.dirtyTimeline = true; return h; } +/* Tall enough for the toolbar + ruler + every track row (no vertical overflow). */ +function defaultTimelineHeight() { + const tracksH = TRACKS.reduce((s, t) => s + t.h, 0); + const toolbar = document.querySelector(".timeline-toolbar"); + const toolbarH = toolbar ? toolbar.getBoundingClientRect().height : 40; + return tracksH + RULER_H + toolbarH + 8; +} function resetTimelineHeight() { - const h = setTimelineHeight(window.innerHeight * 0.32); + const h = setTimelineHeight(defaultTimelineHeight()); localStorage.removeItem(TL_H_KEY); state.dirtyTimeline = true; return h; } +function trackSizeShowsThumbs() { + return !!(TRACK_SIZE_PRESETS[state.trackSize] || TRACK_SIZE_PRESETS.l).thumbs; +} +function syncTrackSizeButtons() { + const group = $("trackSizeGroup"); + if (!group) return; + for (const b of group.querySelectorAll("[data-track-size]")) + b.classList.toggle("on", b.dataset.trackSize === state.trackSize); + document.body.classList.toggle("track-size-s", state.trackSize === "s"); + document.body.classList.toggle("track-size-m", state.trackSize === "m"); + document.body.classList.toggle("track-size-l", state.trackSize === "l"); +} +function applyTrackHeights() { + const preset = TRACK_SIZE_PRESETS[state.trackSize] || TRACK_SIZE_PRESETS.l; + for (const t of TRACKS) { + if (preset.h[t.id] != null) t.h = preset.h[t.id]; + } +} +/* Switch S/M/L track density, rebuild the timeline, and grow/shrink the pane + so every track fits without a vertical scrollbar. */ +function setTrackSize(size, { persist = true, fitPane = true } = {}) { + if (!TRACK_SIZE_PRESETS[size]) size = "l"; + state.trackSize = size; + applyTrackHeights(); + if (persist) localStorage.setItem(TRACK_SIZE_KEY, size); + syncTrackSizeButtons(); + buildTrackDOM(); + state.dirtyTimeline = true; + rebuildClips(); + if (fitPane) { + const h = setTimelineHeight(defaultTimelineHeight()); + localStorage.setItem(TL_H_KEY, String(h)); + } +} +function restoreDefaultLayout() { + setTrackSize("l", { persist: true, fitPane: false }); + resetTimelineHeight(); +} function clampTimelineHeight() { const cur = $("timelinePanel")?.getBoundingClientRect().height; if (cur) setTimelineHeight(cur); @@ -2856,6 +2915,11 @@ function initPanelSplit() { const handle = $("splitUpperTimeline"); const tl = $("timelinePanel"); if (!handle || !tl) return; + const savedSize = localStorage.getItem(TRACK_SIZE_KEY); + if (TRACK_SIZE_PRESETS[savedSize]) state.trackSize = savedSize; + applyTrackHeights(); + syncTrackSizeButtons(); + const saved = parseFloat(localStorage.getItem(TL_H_KEY)); if (saved > 0) setTimelineHeight(saved); else resetTimelineHeight(); diff --git a/index.html b/index.html index b85783c5a..46370c56f 100644 --- a/index.html +++ b/index.html @@ -17,6 +17,14 @@
Untitled Project
+ + + + + + + +
diff --git a/style.css b/style.css index ebe77acc4..3ab8e6810 100644 --- a/style.css +++ b/style.css @@ -13,288 +13,1115 @@ --track-h-video: 58px; --track-h-audio: 42px; } -* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; } -html, body { height: 100%; overflow: hidden; } + +* { + box-sizing: border-box; + margin: 0; + padding: 0; + user-select: none; +} + +html, +body { + height: 100%; + overflow: hidden; +} + body { background: var(--bg); color: var(--text); font: 13px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; } + .app { - display: flex; flex-direction: column; height: 100vh; gap: 6px; padding: 6px; + display: flex; + flex-direction: column; + height: 100vh; + gap: 6px; + padding: 6px; +} + +.topbar { + flex: 0 0 46px; +} + +.upper { + flex: 1 1 0; + min-height: 140px; + min-width: 0; } -.topbar { flex: 0 0 46px; } -.upper { flex: 1 1 0; min-height: 140px; min-width: 0; } + .timeline-panel { - flex: 0 0 var(--timeline-h, 32vh); min-height: 180px; overflow: hidden; + flex: 0 0 var(--timeline-h, 400px); + min-height: 180px; + overflow: hidden; } + .v-split { - flex: 0 0 6px; cursor: ns-resize; position: relative; z-index: 5; + flex: 0 0 6px; + cursor: ns-resize; + position: relative; + z-index: 5; border-radius: 3px; } + .v-split::after { - content: ""; position: absolute; left: 18%; right: 18%; top: 2px; height: 2px; - border-radius: 1px; background: var(--border); transition: background .15s; -} -.v-split:hover::after, .v-split.dragging::after { background: var(--accent); } -body.resizing-panels { cursor: ns-resize !important; } -body.resizing-panels * { cursor: ns-resize !important; user-select: none !important; } -.hidden { display: none !important; } -.dim { color: var(--dim); } -.flex-spacer { flex: 1; } + content: ""; + position: absolute; + left: 18%; + right: 18%; + top: 2px; + height: 2px; + border-radius: 1px; + background: var(--border); + transition: background .15s; +} + +.v-split:hover::after, +.v-split.dragging::after { + background: var(--accent); +} + +body.resizing-panels { + cursor: ns-resize !important; +} + +body.resizing-panels * { + cursor: ns-resize !important; + user-select: none !important; +} + +.hidden { + display: none !important; +} + +.dim { + color: var(--dim); +} + +.flex-spacer { + flex: 1; +} + /* Visually hidden but still activatable (file picker via