v12: CC11 default = flat bar at default automation pos (no auto nodes); click add node, drag move, right-click remove
This commit is contained in:
+11
-23
@@ -9660,8 +9660,8 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, activeTracks, onClos
|
||||
// Co selection: chi ve curve cua note duoc chon
|
||||
if (!selectedNoteIds.includes(note.id)) return;
|
||||
} else {
|
||||
// KHONG co selection: CC11 dung chung cho tat ca notes da ve curve
|
||||
if (!(Array.isArray(note.expression_curve) && note.expression_curve.length > 0)) return;
|
||||
// KHONG co selection: CC11 dung chung cho tat ca notes; note chua ve
|
||||
// curve -> thanh ngang mac dinh (khong tu dong them node)
|
||||
}
|
||||
const x0 = (renderBeatOffset + note.start_beat) * pixelsPerBeat;
|
||||
const x1 = (renderBeatOffset + note.start_beat + (note.duration_beats || 1)) * pixelsPerBeat;
|
||||
@@ -10554,10 +10554,6 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, activeTracks, onClos
|
||||
const ratio = Math.max(0, Math.min(1, (beat - note.start_beat) / dur));
|
||||
const val = Math.max(0, Math.min(127, Math.round(((h - y) / h) * 127)));
|
||||
const curve = getCC11Curve(note).slice();
|
||||
// Curve rong -> khoi tao 2 node co dinh dau/cuoi note (graph thread)
|
||||
if (!curve.length) {
|
||||
curve.push({ position_ratio: 0, value: 127 }, { position_ratio: 1, value: 127 });
|
||||
}
|
||||
const x0 = (renderBeatOffset + note.start_beat) * pixelsPerBeat;
|
||||
const x1 = x0 + dur * pixelsPerBeat;
|
||||
const yOf = v => h - ((v / 127) * (h - 20) + 10);
|
||||
@@ -10583,8 +10579,7 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, activeTracks, onClos
|
||||
return;
|
||||
}
|
||||
const cur = curve[anchorIdx];
|
||||
// Node dau/cuoi co dinh: giu ratio 0/1, chi doi value
|
||||
curve[anchorIdx] = (cur.position_ratio <= 0.001 || cur.position_ratio >= 0.999) ? { position_ratio: cur.position_ratio, value: val } : { position_ratio: ratio, value: val };
|
||||
curve[anchorIdx] = { position_ratio: ratio, value: val };
|
||||
// Khong setNotes ngay: ve preview truc tiep, commit khi mouseup/mouseleave
|
||||
ccDragRef.current = { mode: 'cc11', active: true, noteIdx, noteId: note.id, anchorIdx, noteStart: note.start_beat, noteDur: dur, previewCurve: curve, shared };
|
||||
paintCC11Lane(note.id, curve);
|
||||
@@ -10615,8 +10610,6 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, activeTracks, onClos
|
||||
if (d < delDist) { delDist = d; delIdx = i; }
|
||||
});
|
||||
if (delIdx === -1 || delDist > 8) return;
|
||||
// Node dau/cuoi co dinh (graph thread) — khong cho xoa
|
||||
if (curve[delIdx].position_ratio <= 0.001 || curve[delIdx].position_ratio >= 0.999) return;
|
||||
curve.splice(delIdx, 1);
|
||||
commitCC11Curve(curve, selectedNoteIds.length === 0, noteIdx);
|
||||
};
|
||||
@@ -10703,20 +10696,15 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, activeTracks, onClos
|
||||
const curve = (drag.previewCurve || getCC11Curve(note)).slice();
|
||||
const idx = Math.min(drag.anchorIdx, curve.length - 1);
|
||||
const cur = curve[idx] || { position_ratio: ratio, value: val };
|
||||
if (cur.position_ratio <= 0.001 || cur.position_ratio >= 0.999) {
|
||||
// Node dau/cuoi co dinh: chi doi value, giu ratio 0/1
|
||||
curve[idx] = { position_ratio: cur.position_ratio, value: val };
|
||||
} else {
|
||||
// Node giua: doi ca ratio+value, clamp giua 2 node lan can
|
||||
let minR = 0, maxR = 1;
|
||||
for (let i = 0; i < curve.length; i++) {
|
||||
if (i === idx) continue;
|
||||
const r = curve[i].position_ratio;
|
||||
if (r < cur.position_ratio && r > minR) minR = r;
|
||||
if (r > cur.position_ratio && r < maxR) maxR = r;
|
||||
}
|
||||
curve[idx] = { position_ratio: Math.min(maxR, Math.max(minR, ratio)), value: val };
|
||||
// Drag node: doi ca ratio+value, clamp giua 2 node lan can
|
||||
let minR = 0, maxR = 1;
|
||||
for (let i = 0; i < curve.length; i++) {
|
||||
if (i === idx) continue;
|
||||
const r = curve[i].position_ratio;
|
||||
if (r < cur.position_ratio && r > minR) minR = r;
|
||||
if (r > cur.position_ratio && r < maxR) maxR = r;
|
||||
}
|
||||
curve[idx] = { position_ratio: Math.min(maxR, Math.max(minR, ratio)), value: val };
|
||||
drag.previewCurve = curve;
|
||||
paintCC11Lane(drag.noteId, curve);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user