Adjust macOS invisible subtitle vertical nudge

This commit is contained in:
2026-02-11 20:26:26 -08:00
parent f5129469c3
commit 2778476b58
2 changed files with 14 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ status: Done
assignee:
- codex
created_date: '2026-02-11 15:45'
updated_date: '2026-02-11 16:20'
updated_date: '2026-02-11 16:28'
labels:
- bug
- macos
@@ -40,5 +40,5 @@ Follow-up in progress after packaged app runtime showed fullscreen fallback beha
- Added `.asar` helper materialization to temp path so child process execution is possible if candidate path resolves inside asar.
- Added throttled tracker logging for helper execution failures to expose runtime errors without log spam.
- Updated Electron builder `extraResources` to ship `dist/scripts/get-mpv-window-macos` outside asar at `resources/scripts/get-mpv-window-macos`.
- Added macOS-only invisible subtitle vertical nudge (`+4px`) in renderer layout to align interactive subtitles with mpv glyph baseline after bounds fix.
- Added macOS-only invisible subtitle vertical nudge (`+5px`) in renderer layout to align interactive subtitles with mpv glyph baseline after bounds fix.
<!-- SECTION:NOTES:END -->

View File

@@ -1,6 +1,8 @@
import type { MpvSubtitleRenderMetrics, SubtitlePosition } from "../types";
import type { ModalStateReader, RendererContext } from "./context";
const INVISIBLE_MACOS_VERTICAL_NUDGE_PX = 5;
function clampYPercent(yPercent: number): number {
return Math.max(2, Math.min(80, yPercent));
}
@@ -365,6 +367,16 @@ export function createPositioningController(
ctx.dom.subtitleContainer.style.top = `${Math.max(0, currentTop - halfLeading)}px`;
}
}
if (ctx.platform.isMacOSPlatform) {
const currentBottom = parseFloat(ctx.dom.subtitleContainer.style.bottom);
if (Number.isFinite(currentBottom)) {
ctx.dom.subtitleContainer.style.bottom = `${Math.max(
0,
currentBottom + INVISIBLE_MACOS_VERTICAL_NUDGE_PX,
)}px`;
}
}
}
function applyInvisibleSubtitleLayoutFromMpvMetrics(