mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-27 18:22:41 -08:00
1.6 KiB
1.6 KiB
id, title, status, assignee, created_date, labels, milestone, dependencies, references, priority
| id | title | status | assignee | created_date | labels | milestone | dependencies | references | priority | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TASK-11 | Break up the applyInvisibleSubtitleLayoutFromMpvMetrics mega function | To Do | 2026-02-11 08:21 |
|
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