mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-13 08:12:54 -07:00
feat(overlay): add primary subtitle bar visibility modes
- Cycle `v` through `hidden | visible | hover` instead of a boolean toggle - Add `subtitleStyle.primaryDefaultMode` config with default `visible` - Carry primary mode independently from secondary in hot-reload payload - Add hover CSS: transparent until hovered, then fully visible - Show primary-specific OSD text on each mode change
This commit is contained in:
@@ -147,6 +147,7 @@ export function applySubtitleDomainConfig(context: ResolveContext): void {
|
||||
|
||||
if (isObject(src.subtitleStyle)) {
|
||||
const fallbackSubtitleStyleEnableJlpt = resolved.subtitleStyle.enableJlpt;
|
||||
const fallbackSubtitleStylePrimaryDefaultMode = resolved.subtitleStyle.primaryDefaultMode;
|
||||
const fallbackSubtitleStylePreserveLineBreaks = resolved.subtitleStyle.preserveLineBreaks;
|
||||
const fallbackSubtitleStyleAutoPauseVideoOnHover = resolved.subtitleStyle.autoPauseVideoOnHover;
|
||||
const fallbackSubtitleStyleAutoPauseVideoOnYomitanPopup =
|
||||
@@ -190,6 +191,24 @@ export function applySubtitleDomainConfig(context: ResolveContext): void {
|
||||
);
|
||||
}
|
||||
|
||||
const primaryDefaultMode = (src.subtitleStyle as { primaryDefaultMode?: unknown })
|
||||
.primaryDefaultMode;
|
||||
if (
|
||||
primaryDefaultMode === 'hidden' ||
|
||||
primaryDefaultMode === 'visible' ||
|
||||
primaryDefaultMode === 'hover'
|
||||
) {
|
||||
resolved.subtitleStyle.primaryDefaultMode = primaryDefaultMode;
|
||||
} else if (primaryDefaultMode !== undefined) {
|
||||
resolved.subtitleStyle.primaryDefaultMode = fallbackSubtitleStylePrimaryDefaultMode;
|
||||
warn(
|
||||
'subtitleStyle.primaryDefaultMode',
|
||||
primaryDefaultMode,
|
||||
resolved.subtitleStyle.primaryDefaultMode,
|
||||
'Expected hidden, visible, or hover.',
|
||||
);
|
||||
}
|
||||
|
||||
const preserveLineBreaks = asBoolean(
|
||||
(src.subtitleStyle as { preserveLineBreaks?: unknown }).preserveLineBreaks,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user