fix(editor): rigid group-move — snap once, move the whole selection - #142
Merged
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds group-move snapping that anchors on the grabbed note, applies one clamped delta to the whole selection, and supports Alt-drag to bypass grid snapping. Also adds tests and a changelog note. ChangesGroup time delta snapping fix
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.44.1)screen.jsast-grep timed out on this file Comment |
Tester bug: "mass moving notes seem to have a limit, only a few of selected notes get moved." Root cause: the live move loop snapped each note's ABSOLUTE time independently (snapTime(origTime + dt) per note). With snap on (the default) a small group drag quantised every note to its own nearest grid line, so only notes already near a line crossed it - the rest snapped back and appeared not to move, and the selection's internal timing was silently destroyed. - @pure:group-time-delta: _groupTimeDeltaPure snaps the PRIMARY (grabbed) note's target ONCE, takes that as the single group delta, applies it uniformly to every selected note, and clamps it so the earliest note can't cross t=0. The whole group moves rigidly, snaps as a unit, and keeps its internal spacing. snapFn is injected (pure/testable). - onMouseDown records the grabbed note's time (primaryOrigTime); the move handler computes one snappedDt and applies origTimes[i] + snappedDt to every dragged note (keys + guitar-lane branches). - DAW-style grid unlock: hold Alt while dragging to move FREE of the grid (verified against Ableton's Alt / Logic's off-grid step). Only the time grid is bypassed - vertical stays semitone/string-quantized. Tests: tests/group_move_snap.test.js (6) - single-note snap unchanged, a group moves by one rigid delta with spacing kept, the delta anchors on the grabbed note (not note[0]), the t=0 clamp, snap-off raw delta, and the adversarial guards. All fail on main. Full JS suite green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013JgxKh99UAeQqmhzSc73tv Signed-off-by: ChrisBeWithYou <chris@rifflarr.local>
byrongamatos
force-pushed
the
fix/editor-group-move-snap
branch
from
July 9, 2026 07:46
5887b59 to
e2fa980
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Tester bug: "mass moving notes seem to have a limit, only a few of selected
notes get moved."
Root cause: the live move loop snapped each note's absolute time
independently (
snapTime(origTime + dt)per note). With snap on (the default),a small group drag quantised every note to its own nearest grid line — so only
the notes already near a line crossed it, the rest snapped back and appeared
not to move, and the selection's internal timing was silently destroyed.
How
_groupTimeDeltaPure(@pure:group-time-delta) snaps the primary(grabbed) note's target once, takes that as the single group delta,
applies it uniformly to every selected note, and clamps it so the earliest
note can't cross
t=0. The group moves rigidly, snaps as a unit, and keepsits internal spacing.
snapFnis injected (pure/testable).onMouseDownrecords the grabbed note's time (primaryOrigTime); the movehandler computes one
snappedDtand appliesorigTimes[i] + snappedDttoevery dragged note (keys + guitar-lane branches).
grid (verified against Ableton's Alt / Logic's off-grid step). Only the time
grid is bypassed — vertical stays semitone/string-quantized.
Tests
tests/group_move_snap.test.js(6) — single-note snap unchanged, a group movesby one rigid delta with spacing kept, the delta anchors on the grabbed note (not
note[0]), thet=0clamp, snap-off raw delta, and the adversarial guards. Allfail on
main. Full JS suite green (72/72).Summary by CodeRabbit
Bug Fixes
Tests
t=0, and snap-off (no-snapping) moves.