more keyboard events and help info

This commit is contained in:
Ruben van de Ven 2022-05-03 10:00:12 +02:00
parent 666b91b3c7
commit da7c5700d6
2 changed files with 48 additions and 2 deletions

View File

@ -261,9 +261,11 @@
width: 100px; /* as wide as audio controls only */
overflow: hidden;
white-space: nowrap;
left: -50px;
}
.audioconfig:hover{
width: auto;
left: 0px;
}
.audioconfig select, .audioconfig input{
margin:10px;
@ -280,6 +282,37 @@
background: white;
display: block;
}
.help{
position: absolute;
right: 0;
top:10px;
left:70px;
margin:0;
padding:0;
display: flex;
flex-direction: row;
flex-wrap: wrap;
font-size: 8pt;
}
.help li{
display: inline-block;
color: gray;
margin-right:10px;
flex-grow: 1;
}
.help .key{
padding:5px;
background-color: aliceblue;
border: solid 1px black;
color:black;
border-radius: 4px;
}
#interface:not(.selected-annotation) .help .esc1{
display: none;
}
#interface.selected-annotation .help .esc2{
display: none;
}
</style>
<link rel="stylesheet" href="assets/nouislider-15.5.0.css">
@ -288,6 +321,16 @@
<body>
<div id='interface'>
<ul class="help">
<li><span class='key'>Space</span> play/pause</li>
<li><span class='key'>Shift</span> + <span class='key'>&RightArrow;</span> Skip 1s</li>
<li><span class='key'>Shift</span> + <span class='key'>Ctrl</span> + <span class='key'>&RightArrow;</span> Skip 10s</li>
<li><span class='key'>i / o</span> set in/out-point</li>
<li><span class='key'>Shift</span> + <span class='key'>i / o</span> Jump to in/out-point</li>
<li><span class='key'>&LeftArrow; / &RightArrow;</span> Shift selected point 1s</li>
<li><span class='key'>PgUp/Dwn</span> Shift selected point 10s</li>
<li class="esc"><span class='key'>Esc</span> <span class='esc1'>Deselect annotation</span><span class="esc2">reset in & out-points</span></li>
</ul>
</div>
<script src="assets/nouislider-15.5.0.js"></script>
<script src="assets/wNumb-1.2.0.min.js"></script>

View File

@ -525,6 +525,7 @@ class Annotator extends EventTarget {
'max': sliderMax,
},
keyboardDefaultStep: (sliderMax - sliderMin) / 1000,
keyboardPageMultiplier: 10, // page up/down 10s
tooltips: [
this.formatter,
this.formatter
@ -664,13 +665,15 @@ class Annotator extends EventTarget {
if (ev.key == 'ArrowLeft' && ev.shiftKey) {
const p = this._paused;
console.log(p);
this.scrubTo(this._currentTimeMs - 1000);
const diff = ev.ctrlKey ? 10000 : 1000;
this.scrubTo(this._currentTimeMs - diff);
if (!p) { console.log('play!'); this.play(); } // scrubTo() causes a pause();
}
if (ev.key == 'ArrowRight' && ev.shiftKey) {
const p = this._paused;
console.log(p);
this.scrubTo(this._currentTimeMs + 1000);
const diff = ev.ctrlKey ? 10000 : 1000;
this.scrubTo(this._currentTimeMs + diff);
if (!p) { console.log('play!'); this.play(); } // scrubTo() causes a pause();
}
});