fix: Center search result on time slider to allow panning
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -627,8 +627,11 @@ function Menu({data, duration, setDuration, end, setEnd, slider, setSlider, subm
|
||||
|
||||
setDuration(bestDuration);
|
||||
|
||||
// Set the end of the window to be the end of the search result for simplicity
|
||||
const newEnd = resultEnd;
|
||||
// Center the result in the window to allow panning
|
||||
const resultCenterUnix = (result.start + result.end) / 2;
|
||||
const windowDurationSeconds = bestDuration.num * bestDuration.secs;
|
||||
const newEndUnix = resultCenterUnix + windowDurationSeconds / 2;
|
||||
const newEnd = moment.unix(newEndUnix);
|
||||
setEnd(newEnd);
|
||||
|
||||
// Calculate the new slider positions based on the new duration and end time
|
||||
|
||||
Reference in New Issue
Block a user