diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-18 16:16:33 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-18 16:16:33 +0100 |
| commit | e6605b8d30d1e284f317313421e8f46af48640e6 (patch) | |
| tree | 8491219681e185bfd0468862ed6205f491af8465 /tools/mq_editor | |
| parent | 24a0b0aeb7d789918fd5fb1591a71f30afda1830 (diff) | |
fix(mq_editor): apply coupled anchor drag to freqCurve in viewer canvas
Same P0↔P1 / P3↔P2 coupling as the amp editor, now for the frequency
bezier dragged in the main spectrogram viewer.
handoff(Claude): freq curve coupled drag fixed
Diffstat (limited to 'tools/mq_editor')
| -rw-r--r-- | tools/mq_editor/viewer.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/mq_editor/viewer.js b/tools/mq_editor/viewer.js index 2575cac..c99d344 100644 --- a/tools/mq_editor/viewer.js +++ b/tools/mq_editor/viewer.js @@ -563,7 +563,13 @@ class SpectrogramViewer { if (this.selectedPartial >= 0 && this.selectedPartial < this.partials.length) { const ptIdx = this.hitTestControlPoint(x, y, this.partials[this.selectedPartial]); if (ptIdx >= 0) { - this.dragState = { pointIndex: ptIdx }; + const curve = this.partials[this.selectedPartial].freqCurve; + let companionOff = null; + if (ptIdx === 0) + companionOff = { dt: curve.t1 - curve.t0, dv: curve.v1 - curve.v0 }; + else if (ptIdx === 3) + companionOff = { dt: curve.t2 - curve.t3, dv: curve.v2 - curve.v3 }; + this.dragState = { pointIndex: ptIdx, companionOff }; canvas.style.cursor = 'grabbing'; e.preventDefault(); return; @@ -585,6 +591,11 @@ class SpectrogramViewer { const i = this.dragState.pointIndex; partial.freqCurve['t' + i] = t; partial.freqCurve['v' + i] = v; + if (this.dragState.companionOff) { + const off = this.dragState.companionOff; + if (i === 0) { partial.freqCurve.t1 = t + off.dt; partial.freqCurve.v1 = v + off.dv; } + else { partial.freqCurve.t2 = t + off.dt; partial.freqCurve.v2 = v + off.dv; } + } this.render(); e.preventDefault(); return; |
