fix: right-click delete note no longer shows context menu
Set rightClickDragRef.erasedNote=true on delete. handleContextMenu checks and skips menu when true.
This commit is contained in:
@@ -4922,6 +4922,7 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, onClose, onUpdateNot
|
|||||||
pushToUndo(notes);
|
pushToUndo(notes);
|
||||||
setNotes(prev => prev.filter(n => n.id !== clickedNote.id));
|
setNotes(prev => prev.filter(n => n.id !== clickedNote.id));
|
||||||
setSelectedNoteIds(prev => prev.filter(id => id !== clickedNote.id));
|
setSelectedNoteIds(prev => prev.filter(id => id !== clickedNote.id));
|
||||||
|
rightClickDragRef.current.erasedNote = true;
|
||||||
showToast('Đã xóa nốt!', 'info');
|
showToast('Đã xóa nốt!', 'info');
|
||||||
} else {
|
} else {
|
||||||
rightClickDragRef.current = { active: true, startX: e.clientX, startY: e.clientY };
|
rightClickDragRef.current = { active: true, startX: e.clientX, startY: e.clientY };
|
||||||
@@ -5251,6 +5252,10 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, onClose, onUpdateNot
|
|||||||
|
|
||||||
const handleContextMenu = (e) => {
|
const handleContextMenu = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
if (rightClickDragRef.current.erasedNote) {
|
||||||
|
rightClickDragRef.current.erasedNote = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
const pos = { x: e.clientX, y: e.clientY, parentKey: null };
|
const pos = { x: e.clientX, y: e.clientY, parentKey: null };
|
||||||
scaleMenuOriginRef.current = { x: pos.x, y: pos.y };
|
scaleMenuOriginRef.current = { x: pos.x, y: pos.y };
|
||||||
setScaleMenuPos(pos);
|
setScaleMenuPos(pos);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user