-
Notifications
You must be signed in to change notification settings - Fork 4
feat(editor): the EOF profile's wheel adjusts sustain and fret — the mouse half of the EOF port #347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat(editor): the EOF profile's wheel adjusts sustain and fret — the mouse half of the EOF port #347
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| /* | ||
| * The EOF wheel grammar — the mouse half of the EOF port (EOF-PROFILE-POLICY.md). | ||
| * | ||
| * EOF_hotkeys.txt mouse lines, and where each lands: | ||
| * Mouse scroll wheel = Adjust sustain length → MATCH (this suite) | ||
| * Ctrl + scroll wheel = Increment/decrement fret → MATCH (this suite) | ||
| * Left click = Select note (whole strum) → MATCH (chord default, pinned below) | ||
| * Right click = Add/remove note → MATCH (eofEdit default, pinned below) | ||
| * Middle click = Open pro guitar note box → ADAPTED (middle-drag stays pan; | ||
| * the N key / double-click reach the same note box) | ||
| * | ||
| * _editorEofWheelActionPure is the real decision function mouse.js dispatches | ||
| * from — driven here directly (never stubbed), with every guard exercised on | ||
| * both sides per the repo's stateful-wiring test rules. | ||
| * | ||
| * Run: node tests/eof_wheel.test.mjs | ||
| */ | ||
| import assert from 'node:assert'; | ||
| import { | ||
| _editorDefaultChordSelectBehaviorPure, _editorDefaultRightClickBehaviorPure, | ||
| _editorEofWheelActionPure, _editorShortcutRowsPure, | ||
| } from '../src/shortcuts.js'; | ||
|
|
||
| let pass = 0, fail = 0; | ||
| function t(name, fn) { | ||
| try { fn(); pass++; console.log(' ok ' + name); } | ||
| catch (e) { fail++; console.error(' FAIL ' + name + ': ' + e.message); } | ||
| } | ||
|
|
||
| const wheel = (dy, m = {}) => ({ | ||
| deltaY: dy, deltaX: m.dx || 0, | ||
| ctrlKey: !!m.ctrl, metaKey: !!m.meta, shiftKey: !!m.shift, altKey: !!m.alt, | ||
| }); | ||
| const CTX = { profile: 'eof', tempoMapMode: false, partsViewMode: false, drumEditMode: false, selCount: 2 }; | ||
| const act = (e, over = {}) => _editorEofWheelActionPure(e, { ...CTX, ...over }); | ||
|
|
||
| t('plain wheel maps to sustain — up lengthens, down shortens (EOF wheel-up = lengthen)', () => { | ||
| assert.strictEqual(act(wheel(-120)), 'lengthenSustain'); | ||
| assert.strictEqual(act(wheel(120)), 'shortenSustain'); | ||
| }); | ||
|
|
||
| t('Ctrl+wheel maps to fret — up increments, down decrements; Meta counts as Ctrl', () => { | ||
| assert.strictEqual(act(wheel(-120, { ctrl: true })), 'fretUp'); | ||
| assert.strictEqual(act(wheel(120, { ctrl: true })), 'fretDown'); | ||
| assert.strictEqual(act(wheel(-120, { meta: true })), 'fretUp'); | ||
| }); | ||
|
|
||
| t('only the EOF profile gets the grammar — every other profile falls through', () => { | ||
| for (const profile of ['feedback', 'logical', 'cableton', undefined]) { | ||
| assert.strictEqual(act(wheel(-120), { profile }), null, `profile=${profile}`); | ||
| assert.strictEqual(act(wheel(-120, { ctrl: true }), { profile }), null, `ctrl profile=${profile}`); | ||
| } | ||
| }); | ||
|
|
||
| t('note mode only — tempo map, Tracks overview, and the drum grid keep their wheel', () => { | ||
| assert.strictEqual(act(wheel(-120), { tempoMapMode: true }), null); | ||
| assert.strictEqual(act(wheel(-120), { partsViewMode: true }), null); | ||
| assert.strictEqual(act(wheel(-120), { drumEditMode: true }), null); | ||
| }); | ||
|
|
||
| t('no selection → null (falls through to pan; a bare wheel never edits)', () => { | ||
| assert.strictEqual(act(wheel(-120), { selCount: 0 }), null); | ||
| assert.strictEqual(act(wheel(-120, { ctrl: true }), { selCount: 0 }), null); | ||
| }); | ||
|
|
||
| t('Shift and Alt keep their existing meanings (pan / roll lane-stretch)', () => { | ||
| assert.strictEqual(act(wheel(-120, { shift: true })), null); | ||
| assert.strictEqual(act(wheel(-120, { alt: true })), null); | ||
| }); | ||
|
|
||
| t('horizontal-dominant swipes and zero deltas fall through', () => { | ||
| assert.strictEqual(act(wheel(-10, { dx: 80 })), null, 'horizontal swipe'); | ||
| assert.strictEqual(act(wheel(0)), null, 'no vertical delta'); | ||
| }); | ||
|
|
||
| t('the reference mouse defaults hold: right-click adds/removes, a click grabs the strum', () => { | ||
| // EOF's other two mouse verbs ride the existing profile defaults — pinned | ||
| // so a default change breaks this suite, not just runtime behaviour. | ||
| assert.strictEqual(_editorDefaultRightClickBehaviorPure('eof'), 'eofEdit'); | ||
| assert.strictEqual(_editorDefaultChordSelectBehaviorPure('eof'), 'chord'); | ||
| assert.strictEqual(_editorDefaultRightClickBehaviorPure('feedback'), 'context', 'other profiles keep context menus'); | ||
| }); | ||
|
|
||
| t('the panel advertises the wheel beside the keys in the EOF profile only', () => { | ||
| const eofRows = Object.fromEntries(_editorShortcutRowsPure('eof').map(r => [r.id, r.key])); | ||
| assert.strictEqual(eofRows.shortenSustain, '[ / Wheel down'); | ||
| assert.strictEqual(eofRows.lengthenSustain, '] / Wheel up'); | ||
| assert.strictEqual(eofRows.fretUp, 'Ctrl++ / Ctrl+Wheel up'); | ||
| assert.strictEqual(eofRows.fretDown, 'Ctrl+- / Ctrl+Wheel down'); | ||
| const fbRows = Object.fromEntries(_editorShortcutRowsPure('feedback').map(r => [r.id, r.key])); | ||
| assert.strictEqual(fbRows.shortenSustain, '[', 'FeedBack display untouched'); | ||
| assert.strictEqual(fbRows.fretUp, 'Ctrl++', 'FeedBack display untouched'); | ||
| }); | ||
|
|
||
| console.log(`\n${pass} passed, ${fail} failed`); | ||
| process.exit(fail ? 1 : 0); |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.