mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 09:37:17 +00:00
Next Preset hotkeys
This commit is contained in:
parent
0c14b74d0d
commit
02aa688ed3
2 changed files with 11 additions and 6 deletions
|
|
@ -102,7 +102,9 @@ export function appendPresetFileList(fileList: FileList): Dispatchable {
|
|||
};
|
||||
}
|
||||
|
||||
export function selectNextPreset(): Dispatchable {
|
||||
export function selectNextPreset(
|
||||
transitionType: TransitionType = TransitionType.DEFAULT
|
||||
): Dispatchable {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const currentPresetIndex = Selectors.getCurrentPresetIndex(state);
|
||||
|
|
@ -110,7 +112,7 @@ export function selectNextPreset(): Dispatchable {
|
|||
return;
|
||||
}
|
||||
const nextPresetIndex = currentPresetIndex + 1;
|
||||
dispatch(requestPresetAtIndex(nextPresetIndex, TransitionType.DEFAULT));
|
||||
dispatch(requestPresetAtIndex(nextPresetIndex, transitionType));
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import GenWindow from "../GenWindow";
|
|||
import { WINDOWS } from "../../constants";
|
||||
import * as Selectors from "../../selectors";
|
||||
import * as Actions from "../../actionCreators";
|
||||
import { AppState, Dispatch } from "../../types";
|
||||
import { AppState, Dispatch, TransitionType } from "../../types";
|
||||
import Visualizer from "./Visualizer";
|
||||
|
||||
import "../../../css/milkdrop-window.css";
|
||||
|
|
@ -29,6 +29,7 @@ interface DispatchProps {
|
|||
togglePresetOverlay(): void;
|
||||
selectRandomPreset(): void;
|
||||
handlePresetDrop(e: React.DragEvent): void;
|
||||
selectNextPreset(transitionType?: TransitionType): void;
|
||||
}
|
||||
|
||||
interface OwnProps {
|
||||
|
|
@ -47,13 +48,13 @@ function Milkdrop(props: Props) {
|
|||
return props.onFocusedKeyDown(e => {
|
||||
switch (e.keyCode) {
|
||||
case 32: // spacebar
|
||||
// this._nextPreset(USER_PRESET_TRANSITION_SECONDS);
|
||||
props.selectNextPreset();
|
||||
break;
|
||||
case 8: // backspace
|
||||
// this._prevPreset(0);
|
||||
break;
|
||||
case 72: // H
|
||||
// this._nextPreset(0);
|
||||
props.selectNextPreset(TransitionType.IMMEDIATE);
|
||||
break;
|
||||
case 82: // R
|
||||
// this.props.presets.toggleRandomize();
|
||||
|
|
@ -138,7 +139,9 @@ const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({
|
|||
toggleDesktop: () => dispatch(Actions.toggleMilkdropDesktop()),
|
||||
togglePresetOverlay: () => dispatch(Actions.togglePresetOverlay()),
|
||||
selectRandomPreset: () => dispatch(Actions.selectRandomPreset()),
|
||||
handlePresetDrop: e => dispatch(Actions.handlePresetDrop(e))
|
||||
handlePresetDrop: e => dispatch(Actions.handlePresetDrop(e)),
|
||||
selectNextPreset: (transitionType?: TransitionType) =>
|
||||
dispatch(Actions.selectNextPreset(transitionType))
|
||||
});
|
||||
|
||||
export default connect(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue