feat(editor): group drag for a barline multi-selection (tempo PR 5b) - #230
Merged
byrongamatos merged 2 commits intoJul 12, 2026
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ChrisBeWithYou
force-pushed
the
feat/editor-tempo-multiselect
branch
from
July 12, 2026 20:06
393a2a0 to
f342417
Compare
Grabbing any pole in a Tempo Map multi-selection now drags the whole group by one offset, instead of only the single focused barline. - _tempoGroupDragClampPure: the group's Δt is clamped by the tightest headroom of any selected pole against its nearest UNSELECTED (fixed) downbeat ± MIN_MEASURE, so the group moves rigidly and can never cross a fixed neighbour or reorder the grid. Song start (0) / passed `duration` bound a pole with no fixed neighbour on that side. - _tempoApplyGroupDragPure: shifts every selected downbeat by the clamped Δt, then re-spaces each measure's interior proportionally between its (possibly moved) downbeats — a span between two selected poles rigid-shifts for free, an edge span re-spaces against its fixed outside pole, and a leading pickup / trailing tail rigid-shifts only when its bounding downbeat moved. Pure (never mutates the input). - Locked poles are dropped from the moving group: they stay put and act as fixed anchors; a status notes how many stayed. Locks defend hand-verified times, so excluding them is least surprising. - Wiring mirrors the single-pole drag: mousedown starts a 'tempo-group' drag when a multi-selection (2+) is grabbed by one of its poles; _tempoMapOnDragMove rebuilds from the original grid each move (no compounding); the shared _tempoMapOnDragEnd finalizes it as one undoable TempoMapCmd (equal-count invariant) — notes ride the grid. The selection is index-preserving, so it survives the drag. tests/tempo_group_drag.test.mjs (12 cases): clamp math both directions, fixed-pole-between-two-selected binding, rigid interior + edge re-space, pickup/tail shift, locked-pole exclusion, all-locked no-op, purity, and an exec -> undo -> redo round-trip that also checks a note rides. Fails on main (the pures don't exist). 116 JS green, lint 0-err. Verified live on the testbed: Ctrl+A -> drag a pole -> "Moved 105 barlines together." Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EBQCHCNA81E9tHmSDHSe2Q
ChrisBeWithYou
force-pushed
the
feat/editor-tempo-groupdrag
branch
from
July 12, 2026 20:11
74cb277 to
dfdce1b
Compare
This was referenced Jul 13, 2026
byrongamatos
added a commit
that referenced
this pull request
Jul 14, 2026
…230) (#258) * feat(editor): group drag for a barline multi-selection (tempo PR 5b) Grabbing any pole in a Tempo Map multi-selection now drags the whole group by one offset, instead of only the single focused barline. - _tempoGroupDragClampPure: the group's Δt is clamped by the tightest headroom of any selected pole against its nearest UNSELECTED (fixed) downbeat ± MIN_MEASURE, so the group moves rigidly and can never cross a fixed neighbour or reorder the grid. Song start (0) / passed `duration` bound a pole with no fixed neighbour on that side. - _tempoApplyGroupDragPure: shifts every selected downbeat by the clamped Δt, then re-spaces each measure's interior proportionally between its (possibly moved) downbeats — a span between two selected poles rigid-shifts for free, an edge span re-spaces against its fixed outside pole, and a leading pickup / trailing tail rigid-shifts only when its bounding downbeat moved. Pure (never mutates the input). - Locked poles are dropped from the moving group: they stay put and act as fixed anchors; a status notes how many stayed. Locks defend hand-verified times, so excluding them is least surprising. - Wiring mirrors the single-pole drag: mousedown starts a 'tempo-group' drag when a multi-selection (2+) is grabbed by one of its poles; _tempoMapOnDragMove rebuilds from the original grid each move (no compounding); the shared _tempoMapOnDragEnd finalizes it as one undoable TempoMapCmd (equal-count invariant) — notes ride the grid. The selection is index-preserving, so it survives the drag. tests/tempo_group_drag.test.mjs (12 cases): clamp math both directions, fixed-pole-between-two-selected binding, rigid interior + edge re-space, pickup/tail shift, locked-pole exclusion, all-locked no-op, purity, and an exec -> undo -> redo round-trip that also checks a note rides. Fails on main (the pures don't exist). 116 JS green, lint 0-err. Verified live on the testbed: Ctrl+A -> drag a pole -> "Moved 105 barlines together." Claude-Session: https://claude.ai/code/session_01EBQCHCNA81E9tHmSDHSe2Q * Prevent locked group drag fallthrough --------- Co-authored-by: ChrisBeWithYou <chris@rifflarr.local> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: byrongamatos <xasiklas@gmail.com>
This was referenced Jul 14, 2026
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
Tempo-track PR 5b (charrette arch 1, second half). Completes the barline-selection feature #226 (5a) started: after selecting multiple barlines, you can now drag the whole group at once by grabbing any pole in it — not just delete them. This is the natural way to nudge a whole passage's grid onto the recording.
Behaviour
TempoMapCmd, undoable as Move N barlines together).How
Two pure functions in
src/tempo.js:_tempoGroupDragClampPure(beats, selIdxs, deltaT, minGap, duration)— the whole-group clamp (tightest per-pole headroom against the nearest unselected downbeat)._tempoApplyGroupDragPure(beats, selIdxs, deltaT, minGap, duration)— shifts the selected downbeats, re-spaces every span's interior proportionally between its new endpoints, rigid-shifts a leading pickup / trailing tail when its bounding downbeat moved. Never mutates the input; drops locked poles from the group.Wiring mirrors the existing single-pole drag: a
mousedownon a pole that belongs to a 2+ selection starts atempo-groupdrag;_tempoMapOnDragMoverebuilds from the original grid each move (no compounding); the shared_tempoMapOnDragEndfinalises it as one equal-countTempoMapCmd. The multi-selection is index-preserving, so it survives the drag. (src/mouse.jsroutes the new drag type.)Verification
npm test— 116 pass. Newtests/tempo_group_drag.test.mjs(12 cases): clamp math both directions, a fixed pole between two selected ones binding both sides, rigid interior + edge re-space, pickup/tail shift, locked-pole exclusion, all-locked no-op, purity, and a full exec → undo → redo round-trip that also checks a note rides. Fails on main (the pures don't exist).npm run lint— 0 errors (3 pre-existing ratchet warnings).🤖 Generated with Claude Code