From 8950b467f57f4dcd164626de19a019e440561ecf Mon Sep 17 00:00:00 2001 From: Mattk70 Date: Sun, 20 Oct 2024 15:51:38 +0100 Subject: [PATCH] Fixed setting Audio library location Fixed region error when zooming --- js/ui.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/js/ui.js b/js/ui.js index 4ca4fe9b..233774cf 100644 --- a/js/ui.js +++ b/js/ui.js @@ -555,16 +555,13 @@ function zoomSpec(direction) { } } // Keep playhead at same time in file - position = clamp((timeNow - bufferBegin) / windowLength, 0, 1); + position = (timeNow - bufferBegin) / windowLength; // adjust region start time to new window start time let region = getRegion(); if (region) { const duration = region.end - region.start; - region.start = region.start + (oldBufferBegin - bufferBegin); - region.end = region.start + duration; - const {start, end} = region; - if (start < 0 || start > windowLength || end > windowLength) region = undefined; - + region.start = (oldBufferBegin + region.start) - bufferBegin; + region.end = region.start + duration; } postBufferUpdate({ begin: bufferBegin, position: position, region: region, goToRegion: false }) } @@ -1426,11 +1423,11 @@ async function resultClick(e) { } const [file, start, end, sname, label] = row.getAttribute('name').split('|'); - if (row.classList.contains('table-active')){ - createRegion(start - bufferBegin, end - bufferBegin, label, true); - e.target.classList.contains('circle') && getSelectionResults(true); - return; - } + // if (row.classList.contains('table-active')){ + // createRegion(start - bufferBegin, end - bufferBegin, label, true); + // e.target.classList.contains('circle') && getSelectionResults(true); + // return; + // } // Search for results rows - Why??? while (!(row.classList.contains('nighttime') || @@ -3185,7 +3182,7 @@ function centreSpec(){ region.play() } } else { - //clearActive(); + resetRegions(); } fileLoaded = true; //if (activeRow) activeRow.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); @@ -4567,7 +4564,7 @@ DOM.gain.addEventListener('input', () => { if (! files.canceled) { const archiveFolder = files.filePaths[0]; config.archive.location = archiveFolder; - exploreLink.classList.contains('disabled') || + DOM.exploreLink.classList.contains('disabled') || document.getElementById('compress-and-organise').classList.remove('disabled'); document.getElementById('archive-location').value = archiveFolder; updatePrefs('config.json', config);