Merge fix-drag-unselected: arm drag from unselected bank_panel cell in one gesture
This commit is contained in:
+23
-10
@@ -2006,21 +2006,34 @@ void handleClick(int x, int y) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the pressed cell is already SELECTED and no modifier is held, arm a drag —
|
// Drag-arm disambiguation for plain (no ctrl, no shift) presses on a grid cell:
|
||||||
// the actual selection change is deferred to LBUTTONUP if no drag begins (so a
|
//
|
||||||
// plain click on a multi-selection can start a drag without collapsing it first).
|
// • Already-selected cell: defer the selection change to LBUTTONUP so a plain
|
||||||
// Otherwise apply the click immediately. This is the M5-multi-select-drag
|
// press on a multi-selection doesn't collapse it before we know whether a drag
|
||||||
// disambiguation: M5 has no cell drag; a drag here begins only from a selected
|
// will happen. Arm the drag with the current (multi-)selection as the payload
|
||||||
// cell past a movement threshold (see onMouseMove), so plain click/shift/ctrl
|
// candidate; only the caret moves immediately.
|
||||||
// multi-select is untouched.
|
//
|
||||||
|
// • Unselected cell: apply the plain-click selection immediately (collapses to
|
||||||
|
// the single pressed cell) THEN arm a drag from it — so the user can press-and-
|
||||||
|
// drag in one gesture without a prior selecting click. The selection is set
|
||||||
|
// before arming so that focusedSelectionIds() resolves the right payload when
|
||||||
|
// the threshold is crossed in onMouseMove.
|
||||||
|
//
|
||||||
|
// ctrl / shift presses are selection-only gestures — no drag arm in either case.
|
||||||
const bool onSelected = g_panel.selection.contains(hit);
|
const bool onSelected = g_panel.selection.contains(hit);
|
||||||
if (onSelected && !ctrlDown() && !shiftDown()) {
|
if (!ctrlDown() && !shiftDown()) {
|
||||||
|
if (!onSelected) {
|
||||||
|
// Commit the single-cell selection now so the drag payload is correct.
|
||||||
|
g_panel.selection = applyClick(g_panel.selection, hit, false, false, count);
|
||||||
|
g_panel.selItemCount = count;
|
||||||
|
} else {
|
||||||
|
// Move the caret to the pressed cell; defer collapsing multi-selection.
|
||||||
|
g_panel.selection.focus = hit;
|
||||||
|
}
|
||||||
g_panel.dragArmed = true;
|
g_panel.dragArmed = true;
|
||||||
g_panel.dragStartX = x;
|
g_panel.dragStartX = x;
|
||||||
g_panel.dragStartY = y;
|
g_panel.dragStartY = y;
|
||||||
g_panel.dragSourceRegion = reg;
|
g_panel.dragSourceRegion = reg;
|
||||||
// Keep the current (multi-)selection as the drag payload candidate.
|
|
||||||
g_panel.selection.focus = hit; // move the caret to the pressed cell
|
|
||||||
invalidatePanel();
|
invalidatePanel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user