Allow for setting control schemes based on the preview type #701
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #700
Preview exports a "setControllerType" function that just sets its "controlsType" to a string.
The onKeydown event is changed to a switch case that defaults to the default controls as they are now. But if the controlsType matches a switch it will pass the event to a different function which can set the controls slightly differently.
In this case we stop listening for the space key and left and right arrows for "vid"eos. This lets the video playback pan left and right with the arrow keys and pause and start with spacebar, as most default video players work.
This makes adding new control schemes easy for each preview-TYPE.js.
I do think adding a "?" somewhere on the preview screen that allows for a snippet about what the controls for this preview are would be helpful... For example it's unlikely users would find out that "." and "," can be used in the video preview to skip to the next and previous video.
It should also be configurable by the main config.json to allow turning on and off the controls ( even setting them?? ) because technically now a dir with images and videos will change controls depending on the media shown.
Lastly maybe the best approach would have just been to change the default controls to slightly less common keys!