Fix drag-drop review findings: unify teardown, gate FX-add on outside-panel, trim comments

This commit is contained in:
2026-07-30 06:56:20 -04:00
parent 875d5b4632
commit c91bf03ef4
4 changed files with 12 additions and 33 deletions
+2 -10
View File
@@ -327,13 +327,7 @@ void onMouseMove(int x, int y) {
// DoDragDrop runs its own modal loop and takes over mouse capture, so the internal
// drag must be fully wound down first.
if (GetCapture() == g_panel.hwnd) ReleaseCapture();
g_panel.dragArmed = false;
g_panel.dragging = false;
g_panel.dropKind = DropKind::None;
g_panel.dropBankId.clear();
g_panel.cardGesture = CardGesture::None;
g_panel.dragTargetSlot = -1;
g_panel.dragPrimaryId.clear();
resetDragState();
invalidatePanel();
initiateDragOut(g_panel.hwnd, paths); // COPY-ONLY; blocking on Windows
@@ -424,7 +418,7 @@ void onLBtnUp(int x, int y) {
const FxDropTarget fx = resolveFxDropTarget(sp.x, sp.y);
if (fx.valid()) dropTrack = fx.track;
}
if (dropTrack && singleCapture) {
if (!inside && dropTrack && singleCapture) {
const std::string sampleId = g_panel.dragSampleIds.front();
performInstrumentDrop(dropTrack, buildInstrumentDropPreset(sampleId));
// Read-only over the bank + arrange: the only mutations are the new FX instance +
@@ -440,8 +434,6 @@ void onLBtnUp(int x, int y) {
} else if (g == CardGesture::Replace) {
// Replace targets the OCCUPANT of the target slot with the single grabbed card.
const bool isBanks = g_panel.dragSourceRegion == Region::Banks;
RECT cr{};
GetClientRect(g_panel.hwnd, &cr);
const int w = cr.right - cr.left, h = cr.bottom - cr.top;
const RECT region = isBanks ? banksRegionRect(w, h) : poolRegionRect(w, h);
const RegionDisplay disp = regionDisplay(region, isBanks, g_panel.dragSourceRegion);
+2 -4
View File
@@ -320,10 +320,8 @@ struct PanelState {
// when the pointer is not over an FX button.
MediaTrack* instrumentDropTrack = nullptr;
// Latched once an OsDrag hand-off attempt for THIS gesture resolves to "cannot hand off"
// (empty/unresolvable payload, or the OS isn't ready) — skips re-running
// resolveDragPathsForOs (an fs::exists per sample) and the readiness probe on every
// subsequent move while the drag stays alive. Cleared by resetDragState.
// Latched once an OsDrag hand-off resolves "cannot hand off" for this gesture — skips
// re-running resolveDragPathsForOs (fs::exists per sample) each move. Cleared by resetDragState.
bool dragOsHandoffBlocked = false;
// Authoritative tail setting lives in ReaSamplerSession, not here; panel reads it for