kopia lustrzana https://github.com/mifi/lossless-cut
allow configure wheel sensitivity #254
rodzic
20fe9b5b6e
commit
4fab846bac
22
src/App.jsx
22
src/App.jsx
|
@ -190,10 +190,13 @@ const App = memo(() => {
|
||||||
useEffect(() => configStore.set('muted', muted), [muted]);
|
useEffect(() => configStore.set('muted', muted), [muted]);
|
||||||
const [autoSaveProjectFile, setAutoSaveProjectFile] = useState(configStore.get('autoSaveProjectFile'));
|
const [autoSaveProjectFile, setAutoSaveProjectFile] = useState(configStore.get('autoSaveProjectFile'));
|
||||||
useEffect(() => configStore.set('autoSaveProjectFile', autoSaveProjectFile), [autoSaveProjectFile]);
|
useEffect(() => configStore.set('autoSaveProjectFile', autoSaveProjectFile), [autoSaveProjectFile]);
|
||||||
|
const [wheelSensitivity, setWheelSensitivity] = useState(configStore.get('wheelSensitivity'));
|
||||||
|
useEffect(() => configStore.set('wheelSensitivity', wheelSensitivity), [wheelSensitivity]);
|
||||||
|
|
||||||
// Global state
|
// Global state
|
||||||
const [helpVisible, setHelpVisible] = useState(false);
|
const [helpVisible, setHelpVisible] = useState(false);
|
||||||
const [settingsVisible, setSettingsVisible] = useState(false);
|
const [settingsVisible, setSettingsVisible] = useState(false);
|
||||||
|
const [wheelTunerVisible, setWheelTunerVisible] = useState(false);
|
||||||
const [mifiLink, setMifiLink] = useState();
|
const [mifiLink, setMifiLink] = useState();
|
||||||
|
|
||||||
const videoRef = useRef();
|
const videoRef = useRef();
|
||||||
|
@ -1375,6 +1378,12 @@ const App = memo(() => {
|
||||||
/>
|
/>
|
||||||
), [autoExportExtraStreams]);
|
), [autoExportExtraStreams]);
|
||||||
|
|
||||||
|
const onWheelTunerRequested = useCallback(() => {
|
||||||
|
console.log('wat');
|
||||||
|
setSettingsVisible(false);
|
||||||
|
setWheelTunerVisible(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const renderSettings = useCallback(() => (
|
const renderSettings = useCallback(() => (
|
||||||
<Settings
|
<Settings
|
||||||
setOutputDir={setOutputDir}
|
setOutputDir={setOutputDir}
|
||||||
|
@ -1395,8 +1404,9 @@ const App = memo(() => {
|
||||||
renderOutFmt={renderOutFmt}
|
renderOutFmt={renderOutFmt}
|
||||||
AutoExportToggler={AutoExportToggler}
|
AutoExportToggler={AutoExportToggler}
|
||||||
renderCaptureFormatButton={renderCaptureFormatButton}
|
renderCaptureFormatButton={renderCaptureFormatButton}
|
||||||
|
onWheelTunerRequested={onWheelTunerRequested}
|
||||||
/>
|
/>
|
||||||
), [AutoExportToggler, askBeforeClose, autoMerge, autoSaveProjectFile, customOutDir, invertCutSegments, keyframeCut, renderCaptureFormatButton, renderOutFmt, timecodeShowFrames, setOutputDir]);
|
), [AutoExportToggler, askBeforeClose, autoMerge, autoSaveProjectFile, customOutDir, invertCutSegments, keyframeCut, renderCaptureFormatButton, renderOutFmt, timecodeShowFrames, setOutputDir, onWheelTunerRequested]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadMifiLink().then(setMifiLink);
|
loadMifiLink().then(setMifiLink);
|
||||||
|
@ -1649,6 +1659,7 @@ const App = memo(() => {
|
||||||
formatTimecode={formatTimecode}
|
formatTimecode={formatTimecode}
|
||||||
timelineHeight={timelineHeight}
|
timelineHeight={timelineHeight}
|
||||||
onZoomWindowStartTimeChange={setZoomWindowStartTime}
|
onZoomWindowStartTimeChange={setZoomWindowStartTime}
|
||||||
|
wheelSensitivity={wheelSensitivity}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TimelineControls
|
<TimelineControls
|
||||||
|
@ -1687,6 +1698,7 @@ const App = memo(() => {
|
||||||
setZoom={setZoom}
|
setZoom={setZoom}
|
||||||
invertCutSegments={invertCutSegments}
|
invertCutSegments={invertCutSegments}
|
||||||
setInvertCutSegments={setInvertCutSegments}
|
setInvertCutSegments={setInvertCutSegments}
|
||||||
|
toggleComfortZoom={toggleComfortZoom}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<RightMenu
|
<RightMenu
|
||||||
|
@ -1714,6 +1726,14 @@ const App = memo(() => {
|
||||||
onTogglePress={toggleSettings}
|
onTogglePress={toggleSettings}
|
||||||
renderSettings={renderSettings}
|
renderSettings={renderSettings}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{wheelTunerVisible && (
|
||||||
|
<div style={{ display: 'flex', alignItems: 'center', background: 'white', color: 'black', padding: 10, margin: 10, borderRadius: 10, width: '100%', maxWidth: 500, position: 'fixed', left: 0, bottom: bottomBarHeight, zIndex: 10 }}>
|
||||||
|
Scroll sensitivity
|
||||||
|
<input style={{ flexGrow: 1 }} type="range" min="0" max="1000" step="1" value={wheelSensitivity * 1000} onChange={e => setWheelSensitivity(e.target.value / 1000)} />
|
||||||
|
<Button height={20} intent="success" onClick={() => setWheelTunerVisible(false)}>Done</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Button, Table, SegmentedControl, Checkbox } from 'evergreen-ui';
|
||||||
const Settings = memo(({
|
const Settings = memo(({
|
||||||
setOutputDir, customOutDir, autoMerge, setAutoMerge, keyframeCut, setKeyframeCut, invertCutSegments, setInvertCutSegments,
|
setOutputDir, customOutDir, autoMerge, setAutoMerge, keyframeCut, setKeyframeCut, invertCutSegments, setInvertCutSegments,
|
||||||
autoSaveProjectFile, setAutoSaveProjectFile, timecodeShowFrames, setTimecodeShowFrames, askBeforeClose, setAskBeforeClose,
|
autoSaveProjectFile, setAutoSaveProjectFile, timecodeShowFrames, setTimecodeShowFrames, askBeforeClose, setAskBeforeClose,
|
||||||
renderOutFmt, AutoExportToggler, renderCaptureFormatButton,
|
renderOutFmt, AutoExportToggler, renderCaptureFormatButton, onWheelTunerRequested,
|
||||||
}) => {
|
}) => {
|
||||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||||
const Row = (props) => <Table.Row height="auto" paddingY={12} {...props} />;
|
const Row = (props) => <Table.Row height="auto" paddingY={12} {...props} />;
|
||||||
|
@ -116,6 +116,13 @@ const Settings = memo(({
|
||||||
</Table.TextCell>
|
</Table.TextCell>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
|
<Row>
|
||||||
|
<KeyCell>Scroll/wheel sensitivity</KeyCell>
|
||||||
|
<Table.TextCell>
|
||||||
|
<Button onClick={onWheelTunerRequested}>Change sensitivity</Button>
|
||||||
|
</Table.TextCell>
|
||||||
|
</Row>
|
||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<KeyCell>Ask for confirmation when closing app or file?</KeyCell>
|
<KeyCell>Ask for confirmation when closing app or file?</KeyCell>
|
||||||
<Table.TextCell>
|
<Table.TextCell>
|
||||||
|
|
|
@ -42,7 +42,7 @@ const Timeline = memo(({
|
||||||
zoom, neighbouringFrames, seekAbs, seekRel, duration, apparentCutSegments, zoomRel,
|
zoom, neighbouringFrames, seekAbs, seekRel, duration, apparentCutSegments, zoomRel,
|
||||||
setCurrentSegIndex, currentSegIndexSafe, invertCutSegments, inverseCutSegments, formatTimecode,
|
setCurrentSegIndex, currentSegIndexSafe, invertCutSegments, inverseCutSegments, formatTimecode,
|
||||||
waveform, shouldShowWaveform, shouldShowKeyframes, timelineHeight, thumbnails,
|
waveform, shouldShowWaveform, shouldShowKeyframes, timelineHeight, thumbnails,
|
||||||
onZoomWindowStartTimeChange, waveformEnabled, thumbnailsEnabled,
|
onZoomWindowStartTimeChange, waveformEnabled, thumbnailsEnabled, wheelSensitivity,
|
||||||
}) => {
|
}) => {
|
||||||
const timelineScrollerRef = useRef();
|
const timelineScrollerRef = useRef();
|
||||||
const timelineScrollerSkipEventRef = useRef();
|
const timelineScrollerSkipEventRef = useRef();
|
||||||
|
@ -148,11 +148,11 @@ const Timeline = memo(({
|
||||||
const { pixelX, pixelY } = normalizeWheel(e);
|
const { pixelX, pixelY } = normalizeWheel(e);
|
||||||
// console.log({ spinX, spinY, pixelX, pixelY });
|
// console.log({ spinX, spinY, pixelX, pixelY });
|
||||||
if (e.ctrlKey) {
|
if (e.ctrlKey) {
|
||||||
zoomRel(-pixelY / 10);
|
zoomRel(-pixelY * wheelSensitivity * 0.4);
|
||||||
} else {
|
} else {
|
||||||
seekRel((pixelX + pixelY) / 15);
|
seekRel((pixelX + pixelY) * wheelSensitivity * 0.2);
|
||||||
}
|
}
|
||||||
}, [seekRel, zoomRel]);
|
}, [seekRel, zoomRel, wheelSensitivity]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Hammer
|
<Hammer
|
||||||
|
|
|
@ -12,5 +12,6 @@ export default new Store({
|
||||||
askBeforeClose: false,
|
askBeforeClose: false,
|
||||||
muted: false,
|
muted: false,
|
||||||
autoSaveProjectFile: true,
|
autoSaveProjectFile: true,
|
||||||
|
wheelSensitivity: 0.2,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Ładowanie…
Reference in New Issue