Fix pitch input being overwritten while user is typing
edUpdateNotePanel() resets pitchInput.value on every call, but it runs on every edDraw() — including from requestAnimationFrame during preview, mouse events, and a 30ms setTimeout(edResize) loop. This caused any typed characters to be immediately overwritten. Now skip overwriting INPUT/SELECT values when that element has focus, so the user can freely type a new pitch like "A4" without it snapping back to the old value. https://claude.ai/code/session_01TLvDyKzUQekd9hzFuEJ5YX
This commit is contained in:
+13
-6
@@ -4998,14 +4998,21 @@ function edUpdateNotePanel(){
|
||||
}
|
||||
panel.style.display="block";
|
||||
var m=edMelody[edSelected];
|
||||
// Pitch input
|
||||
// Pitch input — skip overwrite when user is actively typing in it
|
||||
var pitchInput=document.getElementById("ed-note-pitch");
|
||||
pitchInput.value=m.f?edFreqToNote(m.f):"";
|
||||
// Duration dropdown
|
||||
if(document.activeElement!==pitchInput){
|
||||
pitchInput.value=m.f?edFreqToNote(m.f):"";
|
||||
}
|
||||
// Duration dropdown — skip if focused
|
||||
var durSel=document.getElementById("ed-note-dur");
|
||||
durSel.value=edDurSecToName(m.d||0);
|
||||
// Lane dropdown
|
||||
document.getElementById("ed-note-lane").value=m.l;
|
||||
if(document.activeElement!==durSel){
|
||||
durSel.value=edDurSecToName(m.d||0);
|
||||
}
|
||||
// Lane dropdown — skip if focused
|
||||
var laneEl=document.getElementById("ed-note-lane");
|
||||
if(document.activeElement!==laneEl){
|
||||
laneEl.value=m.l;
|
||||
}
|
||||
// Info line
|
||||
var info="t="+m.t.toFixed(3)+"s";
|
||||
if(m.f)info+=" | freq="+m.f.toFixed(1)+"Hz";
|
||||
|
||||
Reference in New Issue
Block a user