fix(instrument): stop Ctrl-before-click stealing a waveform mark grab from a coincident node

Ctrl held before mouse-down forced the node/toggle win over a smaller cap or
column regardless of area; now it defers to the ordinary smallest-area
arbitration like a plain click. Also amends product docs, VERIFICATION.md, and
adds sparse-material/narrow-overlay test fixtures.
This commit is contained in:
2026-08-03 16:07:49 -04:00
parent b7b7e88195
commit f91054276b
10 changed files with 117 additions and 15 deletions
+17 -5
View File
@@ -280,15 +280,27 @@ static void testAMissedCandidateNeverWinsOnADegenerateZeroArea() {
WaveformClaimant::kTab);
}
// A control-click has no tab/marker meaning (only the node's hard/smooth toggle answers it), so
// it resolves to the node whenever the node is in the running, even where a plain left-click at
// the same pixel would hand the tab or marker the win on area alone.
static void testControlClickAlwaysTakesTheNodeOverASmallerTabOrMarker() {
// A control-click has no tab/marker meaning (only the node's hard/smooth toggle answers it), but
// that must not let Ctrl steal a mark grab out from under the cursor: when a cap or column is
// ALSO in the running, control-click defers to the ordinary smallest-area arbitration exactly
// like a plain left-click would, so pressing Ctrl before or after the button gives the same
// answer. Only with no cap/column in the running at all does control-click claim the node
// outright regardless of area.
static void testControlClickDefersToACoincidentCapOrColumnLikeAPlainClick() {
const WaveformClaim node{true, kNodeArea};
const WaveformClaim smallerTab{true, 50}; // would beat the node on a plain left-click
CHECK(resolveWaveformClaim(node, smallerTab, WaveformClaim{}, SplineGesture::kLeft) ==
WaveformClaimant::kTab);
// Ctrl pressed before the click must not out-rank the cap that a plain click already gives
// the win — the exact regression this pins.
CHECK(resolveWaveformClaim(node, smallerTab, WaveformClaim{}, SplineGesture::kControlLeft) ==
WaveformClaimant::kTab);
const WaveformClaim smallerMarker{true, 80}; // still smaller than the node, no tab present
CHECK(resolveWaveformClaim(node, WaveformClaim{}, smallerMarker,
SplineGesture::kControlLeft) == WaveformClaimant::kMarker);
// No cap or column at all: control-click still claims the node outright, regardless of area
// — there is nothing else for it to defer to.
CHECK(resolveWaveformClaim(node, WaveformClaim{}, WaveformClaim{}, SplineGesture::kControlLeft) ==
WaveformClaimant::kNode);
// No node in the running: control-click has nothing to fall back to, so the tab still wins.
CHECK(resolveWaveformClaim(WaveformClaim{}, smallerTab, WaveformClaim{},
@@ -311,7 +323,7 @@ int main() {
testTabWinsAGenuineTabVersusMarkerTie();
testNoHitAnywhereFallsThroughToNone();
testAMissedCandidateNeverWinsOnADegenerateZeroArea();
testControlClickAlwaysTakesTheNodeOverASmallerTabOrMarker();
testControlClickDefersToACoincidentCapOrColumnLikeAPlainClick();
if (g_fail == 0) std::printf("spline_edit: all tests passed\n");
return g_fail == 0 ? 0 : 1;