mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-27 18:22:41 -08:00
fix(overlay): honor mpv subtitle binding config and tidy modal close
This commit is contained in:
@@ -135,6 +135,20 @@ test('dispatchMpvProtocolMessage enforces sub-visibility hidden when overlay sup
|
||||
});
|
||||
});
|
||||
|
||||
test('dispatchMpvProtocolMessage skips sub-visibility suppression when overlay binding is disabled', async () => {
|
||||
const { deps, state } = createDeps({
|
||||
shouldBindVisibleOverlayToMpvSubVisibility: () => false,
|
||||
isVisibleOverlayVisible: () => true,
|
||||
});
|
||||
|
||||
await dispatchMpvProtocolMessage(
|
||||
{ event: 'property-change', name: 'sub-visibility', data: 'yes' },
|
||||
deps,
|
||||
);
|
||||
|
||||
assert.equal(state.commands.length, 0);
|
||||
});
|
||||
|
||||
test('dispatchMpvProtocolMessage sets secondary subtitle track based on track list response', async () => {
|
||||
const { deps, state } = createDeps();
|
||||
|
||||
|
||||
@@ -220,7 +220,8 @@ export async function dispatchMpvProtocolMessage(
|
||||
} else if (msg.name === 'sub-visibility') {
|
||||
if (
|
||||
deps.isVisibleOverlayVisible() &&
|
||||
asBoolean(msg.data, false)
|
||||
asBoolean(msg.data, false) &&
|
||||
(deps.shouldBindVisibleOverlayToMpvSubVisibility?.() ?? true)
|
||||
) {
|
||||
deps.sendCommand({ command: ['set_property', 'sub-visibility', 'no'] });
|
||||
}
|
||||
|
||||
@@ -758,7 +758,10 @@ const restoreOverlayMpvSubtitles = createRestoreOverlayMpvSubtitlesHandler({
|
||||
});
|
||||
|
||||
function shouldSuppressMpvSubtitlesForOverlay(): boolean {
|
||||
return overlayManager.getVisibleOverlayVisible();
|
||||
return (
|
||||
overlayManager.getVisibleOverlayVisible() &&
|
||||
configDerivedRuntime.shouldBindVisibleOverlayToMpvSubVisibility()
|
||||
);
|
||||
}
|
||||
|
||||
function syncOverlayMpvSubtitleSuppression(): void {
|
||||
|
||||
@@ -232,16 +232,14 @@ export function createOverlayModalRuntimeService(
|
||||
const handleOverlayModalClosed = (modal: OverlayHostedModal): void => {
|
||||
if (!restoreVisibleOverlayOnModalClose.has(modal)) return;
|
||||
restoreVisibleOverlayOnModalClose.delete(modal);
|
||||
const modalWindow = deps.getModalWindow();
|
||||
if (restoreVisibleOverlayOnModalClose.size === 0) {
|
||||
clearPendingModalWindowReveal();
|
||||
notifyModalStateChange(false);
|
||||
}
|
||||
|
||||
const modalWindow = deps.getModalWindow();
|
||||
if (!modalWindow || modalWindow.isDestroyed()) return;
|
||||
if (restoreVisibleOverlayOnModalClose.size === 0) {
|
||||
if (modalWindow && !modalWindow.isDestroyed()) {
|
||||
modalWindow.hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const notifyOverlayModalOpened = (modal: OverlayHostedModal): void => {
|
||||
|
||||
Reference in New Issue
Block a user