From 9c619d8f4ed53bcb432adfa295ae42897136fb5c Mon Sep 17 00:00:00 2001 From: dsa-t Date: Tue, 7 Dec 2021 23:00:39 +0000 Subject: [PATCH] Allow some navigation tools when selecting Fixes https://gitlab.com/kicad/code/kicad/-/issues/9565 --- eeschema/tools/ee_selection_tool.cpp | 23 +++++++++++++++++++++++ pcbnew/tools/pcb_selection_tool.cpp | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 2a759e17fb..b44d6a5b74 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -1159,6 +1159,19 @@ void EE_SELECTION_TOOL::updateReferencePoint() } +// Some navigation actions are allowed in selectMultiple +const TOOL_ACTION* allowedActions[] = { &ACTIONS::panUp, &ACTIONS::panDown, + &ACTIONS::panLeft, &ACTIONS::panRight, + &ACTIONS::cursorUp, &ACTIONS::cursorDown, + &ACTIONS::cursorLeft, &ACTIONS::cursorRight, + &ACTIONS::cursorUpFast, &ACTIONS::cursorDownFast, + &ACTIONS::cursorLeftFast, &ACTIONS::cursorRightFast, + &ACTIONS::zoomIn, &ACTIONS::zoomOut, + &ACTIONS::zoomInCenter, &ACTIONS::zoomOutCenter, + &ACTIONS::zoomCenter, &ACTIONS::zoomFitScreen, + &ACTIONS::zoomFitObjects, nullptr }; + + bool EE_SELECTION_TOOL::selectMultiple() { bool cancelled = false; // Was the tool canceled while it was running? @@ -1301,6 +1314,16 @@ bool EE_SELECTION_TOOL::selectMultiple() break; // Stop waiting for events } + + // Allow some actions for navigation + for( int i = 0; allowedActions[i]; ++i ) + { + if( evt->IsAction( allowedActions[i] ) ) + { + evt->SetPassEvent(); + break; + } + } } getViewControls()->SetAutoPan( false ); diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index f248a97743..0b3384819f 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -770,6 +770,19 @@ bool PCB_SELECTION_TOOL::selectCursor( bool aForceSelect, CLIENT_SELECTION_FILTE } +// Some navigation actions are allowed in selectMultiple +const TOOL_ACTION* allowedActions[] = { &ACTIONS::panUp, &ACTIONS::panDown, + &ACTIONS::panLeft, &ACTIONS::panRight, + &ACTIONS::cursorUp, &ACTIONS::cursorDown, + &ACTIONS::cursorLeft, &ACTIONS::cursorRight, + &ACTIONS::cursorUpFast, &ACTIONS::cursorDownFast, + &ACTIONS::cursorLeftFast, &ACTIONS::cursorRightFast, + &ACTIONS::zoomIn, &ACTIONS::zoomOut, + &ACTIONS::zoomInCenter, &ACTIONS::zoomOutCenter, + &ACTIONS::zoomCenter, &ACTIONS::zoomFitScreen, + &ACTIONS::zoomFitObjects, nullptr }; + + bool PCB_SELECTION_TOOL::selectMultiple() { bool cancelled = false; // Was the tool cancelled while it was running? @@ -886,6 +899,16 @@ bool PCB_SELECTION_TOOL::selectMultiple() break; // Stop waiting for events } + + // Allow some actions for navigation + for( int i = 0; allowedActions[i]; ++i ) + { + if( evt->IsAction( allowedActions[i] ) ) + { + evt->SetPassEvent(); + break; + } + } } getViewControls()->SetAutoPan( false );