From 94fabc0120a2d952e5c323a328c5be61bdaab851 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Sat, 28 Jan 2017 22:25:27 +0100 Subject: [PATCH] Implement help sheet (press H) --- README.md | 12 +----------- src/main.css | 45 ++++++++++++++++++++++++++++++++++++++------- src/renderer.jsx | 30 ++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index dd459d6f..d1f97b30 100644 --- a/README.md +++ b/README.md @@ -35,17 +35,7 @@ For more information about supported formats / codecs, see https://www.chromium. The original video files will not be modified. Instead it creates a lossless export in the same directory as the original file with from/to timestamps. Note that the cut is currently not precise around the cutpoints, so video before/after the nearest keyframe will be lost. EXIF data is preserved. ### Keyboard shortcuts -- SPACE, k Play/pause -- j Slow down video -- l Speed up video -- Seek backward 1 sec -- Seek forward 1 sec -- . (period) Tiny seek forward (1/60 sec) -- , (comma) Tiny seek backward (1/60 sec) -- i Mark in / cut start point -- o Mark out / cut end point -- e Export selection (in the same dir as the video) -- c Capture snapshot (in the same dir as the video) +Press h To show/hide list of shortcuts ## Development building / running diff --git a/src/main.css b/src/main.css index 541f995a..882fd181 100644 --- a/src/main.css +++ b/src/main.css @@ -116,11 +116,42 @@ input, button, textarea, :focus { } #drag-drop-field { - padding: 15vw 0; - border: 2vw dashed #252525; - color: #252525; - margin: 7vw; - font-size: 9vw; - text-align: center; - white-space: nowrap; + padding: 15vw 0; + border: 2vw dashed #252525; + color: #252525; + margin: 7vw; + font-size: 9vw; + text-align: center; + white-space: nowrap; +} + +.help-sheet { + background: #525252; + color: white; + padding: 1em 2em; + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + z-index: 10; +} + +.help-sheet h1 { + font-size: 1em; + text-transform: uppercase; +} + +.help-sheet kbd { + display: inline-block; + padding: 3px 5px; + font-size: 11px; + line-height: 10px; + color: #555; + vertical-align: middle; + background-color: #fcfcfc; + border: solid 1px #ccc; + border-bottom-color: #bbb; + border-radius: 3px; + box-shadow: inset 0 -1px 0 #bbb; } diff --git a/src/renderer.jsx b/src/renderer.jsx index 79f6dfdf..e1a71ad8 100644 --- a/src/renderer.jsx +++ b/src/renderer.jsx @@ -40,6 +40,29 @@ function shortStep(dir) { seekRel((1 / 60) * dir); } +function renderHelpSheet(visible) { + if (visible) { + return (
+

Keyboard shortcuts

+ +
); + } + + return undefined; +} class App extends React.Component { constructor(props) { @@ -113,6 +136,7 @@ class App extends React.Component { keyboardJs.bind('e', () => this.cutClick()); keyboardJs.bind('i', () => this.setCutStart()); keyboardJs.bind('o', () => this.setCutEnd()); + keyboardJs.bind('h', () => this.toggleHelp()); electron.ipcRenderer.send('renderer-ready'); } @@ -228,6 +252,10 @@ class App extends React.Component { }); } + toggleHelp() { + this.setState({ helpVisible: !this.state.helpVisible }); + } + render() { return (
{this.state.filePath ? undefined :
DROP VIDEO
} @@ -345,6 +373,8 @@ class App extends React.Component { onClick={() => this.capture()} />
+ + {renderHelpSheet(this.state.helpVisible)} ); } }