fix: anchor locked marker review at start

This commit is contained in:
2026-07-04 20:52:27 +02:00
parent 36fc1b9591
commit fe95076195
2 changed files with 81 additions and 17 deletions
+31 -17
View File
@@ -2528,16 +2528,16 @@ class TimelineWidget(QWidget):
p.drawText(mx + 1, rh + 2, 13, 12,
Qt.AlignmentFlag.AlignCenter, str(num))
# ── scan mode cursor + playback line ─────────────────────────
# ── scan/locked playback line ────────────────────────────────
if self._scan_mode:
# Export cursor (dim)
p.setPen(QPen(QColor(255, 255, 255, 80), 1))
p.drawLine(x_start, rh, x_start, h)
# Playback position (bright green)
if self._play_pos is not None and self._play_pos >= 0:
px = int(self._time_to_x(self._play_pos))
p.setPen(QPen(QColor(80, 255, 80, 220), 2))
p.drawLine(px, rh, px, h)
if ((self._scan_mode or self._locked)
and self._play_pos is not None and self._play_pos >= 0):
px = int(self._time_to_x(self._play_pos))
p.setPen(QPen(QColor(80, 255, 80, 220), 2))
p.drawLine(px, rh, px, h)
# ── crop keyframe diamonds ────────────────────────────────────
if self._crop_keyframes and self._duration > 0:
@@ -5977,7 +5977,7 @@ class MainWindow(QMainWindow):
"<tr><td><b>Ctrl+Z</b></td><td>Undo last scan panel action</td></tr>"
"<tr><td><b>? / F1</b></td><td>This help</td></tr>"
"<tr><td colspan='2'><hr></td></tr>"
"<tr><td><b>Double-click marker</b></td><td>Enter overwrite mode (locked: jump to end of clip span)</td></tr>"
"<tr><td><b>Double-click marker</b></td><td>Enter overwrite mode (locked: review from start to end)</td></tr>"
"<tr><td><b>Right-click marker</b></td><td>Delete clip group</td></tr>"
"<tr><td><b>Click video / crop bar</b></td><td>Reposition portrait crop</td></tr>"
"<tr><td><b>Shift+drag scan region edge</b></td><td>Resize scan region</td></tr>"
@@ -7013,22 +7013,36 @@ class MainWindow(QMainWindow):
self._show_status(f"Deleted keyframe @ {format_time(time)}", 3000)
def _on_marker_clicked(self, start_time: float, output_path: str) -> None:
# In lock mode, move cursor to the end of this marker's span.
# In lock mode, keep the marker start anchored and scrub the playhead
# to the marker end so the highlighted zone matches what is reviewed.
if self._btn_lock.isChecked():
meta = self._db.get_by_output_path(output_path)
clip_count = meta["clip_count"] or self._spn_clips.value() if meta else self._spn_clips.value()
clip_dur = meta.get("clip_duration", self._clip_dur) if meta else self._clip_dur
spread = meta["spread"] or self._spn_spread.value() if meta else self._spn_spread.value()
next_pos = start_time + clip_dur + (clip_count - 1) * spread
self._cursor = next_pos
self._timeline.set_cursor(next_pos)
self._mpv.seek(next_pos)
self._lbl_time.setText(f"{format_time(next_pos)} / {format_time(self._mpv.get_duration())}")
clip_count = (
meta.get("clip_count") or self._spn_clips.value()
) if meta else self._spn_clips.value()
clip_dur = (
meta.get("clip_duration") or self._clip_dur
) if meta else self._clip_dur
spread = (
meta.get("spread") or self._spn_spread.value()
) if meta else self._spn_spread.value()
self._spn_clips.setValue(int(clip_count))
self._spn_clip_dur.setValue(float(clip_dur))
self._spn_spread.setValue(float(spread))
clip_span = float(clip_dur) + (int(clip_count) - 1) * float(spread)
dur = self._mpv.get_duration()
end_pos = min(start_time + clip_span, dur) if dur else start_time + clip_span
self._cursor = start_time
self._timeline.set_cursor(start_time)
self._timeline.set_clip_span(clip_span, float(clip_dur), float(spread))
self._timeline.set_play_position(end_pos)
self._mpv.seek(end_pos)
self._lbl_time.setText(f"{format_time(end_pos)} / {format_time(dur)}")
self._update_next_label()
self._preview_timer.start()
stem = os.path.splitext(os.path.basename(output_path))[0]
group_label = stem.rsplit("_", 1)[0]
self._show_status(f"Cursor → end of {group_label}", 3000)
self._show_status(f"Reviewing {group_label}: start locked, playhead at end", 3000)
return
self._cursor = start_time
self._timeline.set_cursor(start_time)