fix: ruler click playhead update using available props onStop+onPlayPause
This commit is contained in:
+5
-15
@@ -5858,23 +5858,13 @@ const beatSec = 60.0 / (parseInt(bpm) || 120);
|
|||||||
const clickBeat = x / pixelsPerBeat;
|
const clickBeat = x / pixelsPerBeat;
|
||||||
const clickTime = clickBeat * beatSec;
|
const clickTime = clickBeat * beatSec;
|
||||||
if (clickTime >= 0) {
|
if (clickTime >= 0) {
|
||||||
setSubTabs(prev => prev.map(s => s.id === st.id ? { ...s, currentTime: clickTime } : s));
|
setSubTabs(prev => prev.map(s => s.id === st.id ? { ...s, currentTime: clickTime, isPlaying: false } : s));
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
setSubTabs(prev => prev.map(s => s.id === st.id ? { ...s, currentTime: clickTime } : s));
|
onStop();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
stopAllPlayback();
|
setSubTabs(prev => prev.map(s => s.id === st.id ? { ...s, currentTime: clickTime } : s));
|
||||||
const sub = subTabs.find(s2 => s2.id === st.id);
|
onPlayPause();
|
||||||
if (sub) {
|
}, 40);
|
||||||
const ctx = getAudioContext();
|
|
||||||
startOffsetTimeRef.current = clickTime;
|
|
||||||
startAudioTimeRef.current = ctx.currentTime;
|
|
||||||
startBufferOffsetRef.current = clickTime * (sub.speed || 1.0);
|
|
||||||
schedulePianoRollMidi(sub, clickTime);
|
|
||||||
startSubTabPlayback(sub, clickTime);
|
|
||||||
setSubTabs(prev => prev.map(s => s.id === st.id ? { ...s, currentTime: clickTime, isPlaying: true } : s));
|
|
||||||
animationFrameIdRef.current = requestAnimationFrame(updatePlayhead);
|
|
||||||
}
|
|
||||||
}, 20);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.ctrlKey || e.metaKey) {
|
if (e.ctrlKey || e.metaKey) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user