1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-24 03:12:41 +01:00

fix types

This commit is contained in:
Mikael Finstad 2024-09-29 09:04:51 +02:00
parent f4cfe72b4b
commit 2452de6de5
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26
3 changed files with 9 additions and 5 deletions

View File

@ -11,7 +11,7 @@ import Switch from './Switch';
import useUserSettings from '../hooks/useUserSettings';
import { askForFfPath } from '../dialogs';
import { isMasBuild, isStoreBuild } from '../util';
import { LanguageKey, TimecodeFormat, langNames } from '../../../../types';
import { LanguageKey, ModifierKey, TimecodeFormat, langNames } from '../../../../types';
import styles from './Settings.module.css';
import Select from './Select';
@ -365,7 +365,7 @@ function Settings({
<Row>
<KeyCell>{t('Mouse wheel zoom modifier key')}</KeyCell>
<td>
<Select value={mouseWheelZoomModifierKey} onChange={(e) => setMouseWheelZoomModifierKey(e.target.value)}>
<Select value={mouseWheelZoomModifierKey} onChange={(e) => setMouseWheelZoomModifierKey(e.target.value as ModifierKey)}>
{Object.entries(getModifierKeyNames()).map(([key, values]) => (
<option key={key} value={key}>{values.join(' / ')}</option>
))}

View File

@ -2,6 +2,7 @@ import { WheelEventHandler, useCallback } from 'react';
import { t } from 'i18next';
import normalizeWheel from './normalizeWheel';
import { ModifierKey } from '../../../../types';
export const keyMap = {
ctrl: 'ctrlKey',
@ -17,10 +18,10 @@ export const getModifierKeyNames = () => ({
meta: [t('⌘ Cmd'), t('⊞ Win')],
});
export const getModifier = (key) => getModifierKeyNames()[key];
export const getModifier = (key: ModifierKey) => getModifierKeyNames()[key];
function useTimelineScroll({ wheelSensitivity, mouseWheelZoomModifierKey, invertTimelineScroll, zoomRel, seekRel }: {
wheelSensitivity: number, mouseWheelZoomModifierKey: string, invertTimelineScroll?: boolean | undefined, zoomRel: (a: number) => void, seekRel: (a: number) => void,
wheelSensitivity: number, mouseWheelZoomModifierKey: ModifierKey, invertTimelineScroll?: boolean | undefined, zoomRel: (a: number) => void, seekRel: (a: number) => void,
}) {
const onWheel = useCallback<WheelEventHandler<Element>>((e) => {
const { pixelX, pixelY } = normalizeWheel(e);

View File

@ -42,6 +42,9 @@ export type TimecodeFormat = 'timecodeWithDecimalFraction' | 'frameCount' | 'tim
export type AvoidNegativeTs = 'make_zero' | 'auto' | 'make_non_negative' | 'disabled';
export type ModifierKey = 'ctrl' | 'shift' | 'alt' | 'meta';
export interface Config {
captureFormat: CaptureFormat,
customOutDir: string | undefined,
@ -87,7 +90,7 @@ export interface Config {
customFfPath: string | undefined,
storeProjectInWorkingDir: boolean,
enableOverwriteOutput: boolean,
mouseWheelZoomModifierKey: string,
mouseWheelZoomModifierKey: ModifierKey,
captureFrameMethod: 'videotag' | 'ffmpeg',
captureFrameQuality: number,
captureFrameFileNameFormat: 'timestamp' | 'index',