fix: K key re-jumping to same section instead of advancing
The forward-skip threshold was `cur + 0.5`, which is smaller than the preroll offset applied when landing on a section. After K placed the cursor at `s.start - preroll`, the next K press found the same section again because `s.start > (s.start - preroll) + 0.5` is true whenever preroll > 0.5. Using `cur + preroll` as the threshold ensures the current section's start is not > cur + preroll, so only the next section matches.
This commit is contained in:
@@ -925,7 +925,7 @@ document.addEventListener('keydown', e => {
|
|||||||
const cur = audio.currentTime;
|
const cur = audio.currentTime;
|
||||||
let jumped = false;
|
let jumped = false;
|
||||||
for (let i = 0; i < sections.length; i++) {
|
for (let i = 0; i < sections.length; i++) {
|
||||||
if (sections[i].start > cur + 0.5) {
|
if (sections[i].start > cur + preroll) {
|
||||||
const s = sections[i];
|
const s = sections[i];
|
||||||
audio.currentTime = Math.max(0, s.start - preroll);
|
audio.currentTime = Math.max(0, s.start - preroll);
|
||||||
setCutFields(activePlayerIdx, s.start, s.end);
|
setCutFields(activePlayerIdx, s.start, s.end);
|
||||||
|
|||||||
Reference in New Issue
Block a user