mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-07-29 01:01:34 -07:00
feat(overlay): add primary subtitle bar visibility modes (#63)
- 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:
@@ -1,4 +1,4 @@
|
||||
import type { CompiledSessionBinding, ShortcutsConfig } from '../../types';
|
||||
import type { CompiledSessionBinding, PrimarySubMode, ShortcutsConfig } from '../../types';
|
||||
import type { RendererContext } from '../context';
|
||||
import {
|
||||
YOMITAN_POPUP_HIDDEN_EVENT,
|
||||
@@ -370,13 +370,17 @@ export function createKeyboardHandlers(
|
||||
}
|
||||
|
||||
function togglePrimarySubtitleBarVisibility(): void {
|
||||
const visible = !ctx.state.primarySubtitleBarVisible;
|
||||
ctx.state.primarySubtitleBarVisible = visible;
|
||||
if (visible) {
|
||||
ctx.dom.subtitleContainer.classList.remove('primary-sub-hidden');
|
||||
} else {
|
||||
ctx.dom.subtitleContainer.classList.add('primary-sub-hidden');
|
||||
}
|
||||
const modes: PrimarySubMode[] = ['hidden', 'visible', 'hover'];
|
||||
const currentIndex = modes.indexOf(ctx.state.primarySubtitleMode);
|
||||
const nextMode = modes[((currentIndex >= 0 ? currentIndex : 1) + 1) % modes.length]!;
|
||||
ctx.state.primarySubtitleMode = nextMode;
|
||||
ctx.dom.subtitleContainer.classList.remove(
|
||||
'primary-sub-hidden',
|
||||
'primary-sub-visible',
|
||||
'primary-sub-hover',
|
||||
);
|
||||
ctx.dom.subtitleContainer.classList.add(`primary-sub-${nextMode}`);
|
||||
window.electronAPI.sendMpvCommand(['show-text', `Primary subtitle: ${nextMode}`, '1500']);
|
||||
}
|
||||
|
||||
async function handleMarkWatched(): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user