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

@@ -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(