mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-22 02:56:24 -07:00
Overlay 2.0 (#12)
This commit is contained in:
@@ -251,7 +251,6 @@ export function createJimakuModal(
|
||||
}
|
||||
|
||||
function openJimakuModal(): void {
|
||||
if (ctx.platform.isInvisibleLayer) return;
|
||||
if (ctx.state.jimakuModalOpen) return;
|
||||
|
||||
ctx.state.jimakuModalOpen = true;
|
||||
|
||||
@@ -66,7 +66,6 @@ export function createKikuModal(
|
||||
original: KikuDuplicateCardInfo;
|
||||
duplicate: KikuDuplicateCardInfo;
|
||||
}): void {
|
||||
if (ctx.platform.isInvisibleLayer) return;
|
||||
if (ctx.state.kikuModalOpen) return;
|
||||
|
||||
ctx.state.kikuModalOpen = true;
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
import type { RuntimeOptionApplyResult, RuntimeOptionState, RuntimeOptionValue } from '../../types';
|
||||
import type { ModalStateReader, RendererContext } from '../context';
|
||||
|
||||
type RuntimeOptionsListLike = Pick<HTMLUListElement, 'querySelector'>;
|
||||
|
||||
export function scrollActiveRuntimeOptionIntoView(list: RuntimeOptionsListLike): void {
|
||||
const active = list.querySelector('.runtime-options-item.active');
|
||||
if (!active) return;
|
||||
|
||||
const maybeScrollable = active as unknown as {
|
||||
scrollIntoView?: (options?: ScrollIntoViewOptions) => void;
|
||||
};
|
||||
if (typeof maybeScrollable.scrollIntoView !== 'function') return;
|
||||
|
||||
maybeScrollable.scrollIntoView({ block: 'nearest' });
|
||||
}
|
||||
|
||||
export function createRuntimeOptionsModal(
|
||||
ctx: RendererContext,
|
||||
options: {
|
||||
@@ -82,6 +96,8 @@ export function createRuntimeOptionsModal(
|
||||
|
||||
ctx.dom.runtimeOptionsList.appendChild(li);
|
||||
});
|
||||
|
||||
scrollActiveRuntimeOptionIntoView(ctx.dom.runtimeOptionsList);
|
||||
}
|
||||
|
||||
function updateRuntimeOptions(optionsList: RuntimeOptionState[]): void {
|
||||
@@ -162,8 +178,6 @@ export function createRuntimeOptionsModal(
|
||||
}
|
||||
|
||||
async function openRuntimeOptionsModal(): Promise<void> {
|
||||
if (ctx.platform.isInvisibleLayer) return;
|
||||
|
||||
const optionsList = await window.electronAPI.getRuntimeOptions();
|
||||
updateRuntimeOptions(optionsList);
|
||||
|
||||
|
||||
@@ -96,7 +96,6 @@ const OVERLAY_SHORTCUTS: Array<{
|
||||
{ key: 'openRuntimeOptions', label: 'Open runtime options' },
|
||||
{ key: 'openJimaku', label: 'Open jimaku' },
|
||||
{ key: 'toggleVisibleOverlayGlobal', label: 'Show/hide visible overlay' },
|
||||
{ key: 'toggleInvisibleOverlayGlobal', label: 'Show/hide invisible overlay' },
|
||||
];
|
||||
|
||||
function buildOverlayShortcutSections(shortcuts: RuntimeShortcutConfig): SessionHelpSection[] {
|
||||
|
||||
@@ -45,8 +45,6 @@ export function createSubsyncModal(
|
||||
}
|
||||
|
||||
function openSubsyncModal(payload: SubsyncManualPayload): void {
|
||||
if (ctx.platform.isInvisibleLayer) return;
|
||||
|
||||
ctx.state.subsyncSubmitting = false;
|
||||
ctx.dom.subsyncRunButton.disabled = false;
|
||||
ctx.state.subsyncSourceTracks = payload.sourceTracks;
|
||||
|
||||
Reference in New Issue
Block a user