- Remove structural quality gates task and references from task-27 roadmap. - Remove structural-gates-adjacent work from scripts/positioning cleanup context, including check-main-lines adjustments. - Archive completed backlog tasks 11 and 27.7 by moving them to completed directory. - Finish task-27.5 module split by moving/anonymizing anki-integration and renderer positioning files into their dedicated directories and updating paths.
2.4 KiB
id, title, status, assignee, created_date, updated_date, labels, milestone, dependencies, references, priority
| id | title | status | assignee | created_date | updated_date | labels | milestone | dependencies | references | priority | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TASK-11 | Break up the applyInvisibleSubtitleLayoutFromMpvMetrics mega function | Done | 2026-02-11 08:21 | 2026-02-16 01:34 |
|
Codebase Clarity & Composability |
|
|
medium |
Description
In renderer.ts (around lines 865-1075), applyInvisibleSubtitleLayoutFromMpvMetrics is a 211-line function with up to 5 levels of nesting. It handles OSD scaling calculations, platform-specific font compensation (macOS vs Linux), DPR calculations, ASS alignment tag interpretation (\an tags), baseline compensation, line-height fixes, font property application, and transform origin — all interleaved.
Extract into focused helpers:
calculateOsdScale(metrics, renderAreaHeight)— pure scaling mathcalculateSubtitlePosition(metrics, scale, alignment)— ASS \an tag interpretation + positioningapplyPlatformFontCompensation(style, platform)— macOS kerning/size adjustmentsapplySubtitleStyle(element, computedStyle)— DOM style application
This can be done independently of or as part of TASK-6 (renderer split).
Acceptance Criteria
- #1 No single function exceeds ~50 lines in the positioning logic
- #2 Helper functions are pure where possible (take inputs, return outputs)
- #3 Platform-specific branches isolated into dedicated helpers
- #4 Invisible overlay positioning still works correctly on Linux and macOS
Implementation Notes
Helpers were split so positioning math, base layout, and typography/vertical handling are no longer in one monolith; see src/renderer/positioning/invisible-layout.ts and peer files.
Applied as part of TASK-27.5 with helper extraction: moved mpv subtitle layout orchestration to invisible-layout.ts and extracted metric/base/style helpers into invisible-layout-metrics.ts and invisible-layout-helpers.ts.
Final Summary
Decomposition of applyInvisibleSubtitleLayoutFromMpvMetrics completed as part of TASK-27.5: function body split into metric/layout/typography helpers and small coordinator preserved. Manual validation completed by user; behavior remains stable.