diff --git a/templates/index.html b/templates/index.html index aef94ba..798bdad 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1085,6 +1085,16 @@
+ +
+
+
+ + +
+
+
+
@@ -1099,7 +1109,7 @@
- ← Povleci rdeče ročaje · Klik na valove = skoči (bel črtnik) · Enter = play/pause od pozicije + ← Klik = bel črtnik · Enter = play (postavi ▼ trikotnik kjer si bil) · "Postavi IN/OUT" = handle skoči na trikotnik
@@ -1112,8 +1122,8 @@
- - + +
@@ -1154,6 +1164,17 @@ let trimEnd = endInit; let dragging = null; // 'left' / 'right' / null + // Marker state — kje je bil zadnji play (loči levi/desni) + let markerInTime = startInit; // pozicija zelenega trikotnika + let markerOutTime = endInit; // pozicija rdečega trikotnika + const markerInEl = document.getElementById("marker-in"); + const markerOutEl = document.getElementById("marker-out"); + + function renderMarkers() { + if (markerInEl) markerInEl.style.left = `calc(${pctOfStr(markerInTime, videoDuration)}% - 7px)`; + if (markerOutEl) markerOutEl.style.left = `calc(${pctOfStr(markerOutTime, videoDuration)}% - 7px)`; + } + function pctOf(t) { return (t / videoDuration) * 100; } @@ -1269,6 +1290,7 @@ trimScroll.scrollLeft = Math.max(0, scrollTarget); } renderTrim(); + renderMarkers(); }, 50); } @@ -1288,6 +1310,17 @@ e.preventDefault(); if (video) { if (video.paused) { + // Pred play-em: postavi trikotnik na trenutno pozicijo + // Loči levi/desni glede na bližino handle-jev + const t = video.currentTime; + const distToLeft = Math.abs(t - trimStart); + const distToRight = Math.abs(t - trimEnd); + if (distToLeft <= distToRight) { + markerInTime = t; + } else { + markerOutTime = t; + } + renderMarkers(); video.play().catch(() => {}); } else { video.pause(); @@ -1317,12 +1350,25 @@ }); } + // "⤴ Začetek" gumb = premakni LEVI handle na zelen trikotnik (commit IN) + // "↪ Konec" gumb = premakni DESNI handle na rdeč trikotnik (commit OUT) window.seekEditVideo = function(which) { if (!video) return; - const t = which === "start" ? trimStart : trimEnd; - video.currentTime = t; if (which === "start") { - video.play(); + // Commit IN: levi handle skoči na zelen trikotnik + if (markerInTime < trimEnd - 1) { + trimStart = markerInTime; + renderTrim(); + // Skoči na to pozicijo + video.currentTime = trimStart; + } + } else { + // Commit OUT: desni handle skoči na rdeč trikotnik + if (markerOutTime > trimStart + 1) { + trimEnd = markerOutTime; + renderTrim(); + video.currentTime = trimEnd; + } } }; @@ -1400,6 +1446,7 @@ const ro = new ResizeObserver(() => { renderTrim(); renderPlayhead(); + renderMarkers(); }); ro.observe(trimBar); @@ -1408,6 +1455,7 @@ requestAnimationFrame(() => { renderTrim(); renderPlayhead(); + renderMarkers(); // Nastavi 1x kot aktiven gumb applyZoom(1); console.log("[EditModal] after renderTrim", {