From c763b0088ededfa3056684c2a1b9cad3d7b6208f Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 14 Mar 2021 17:44:01 +0100 Subject: [PATCH] Fix some issues in drawing_stackup_table_tool.cpp --- pcbnew/tools/drawing_stackup_table_tool.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pcbnew/tools/drawing_stackup_table_tool.cpp b/pcbnew/tools/drawing_stackup_table_tool.cpp index 80b2cea289..789aae7bcd 100644 --- a/pcbnew/tools/drawing_stackup_table_tool.cpp +++ b/pcbnew/tools/drawing_stackup_table_tool.cpp @@ -25,7 +25,6 @@ #include "drawing_tool.h" #include "pcb_actions.h" #include -#include #include #include #include @@ -38,8 +37,6 @@ #include #include #include -#include -#include #include using SCOPED_DRAW_MODE = SCOPED_SET_RESET; @@ -497,6 +494,8 @@ std::vector DRAWING_TOOL::DrawBoardCharacteristics( return objects; } +#include + int DRAWING_TOOL::InteractivePlaceWithPreview( const TOOL_EVENT& aEvent, std::vector aItems, std::vector aPreview, LSET* aLayers ) { @@ -585,18 +584,20 @@ int DRAWING_TOOL::InteractivePlaceWithPreview( const TOOL_EVENT& aEvent, std::ve } else if( evt->IsClick( BUT_LEFT ) ) { - if( aLayers != NULL ) { PCB_LAYER_ID targetLayer = frame()->SelectOneLayer( - PCB_LAYER_ID::PCB_LAYER_ID_COUNT, *aLayers, wxPoint( pos.x, pos.y ) ); + PCB_LAYER_ID::PCB_LAYER_ID_COUNT, + *aLayers, wxGetMousePosition() ); view()->ClearPreview(); - if( targetLayer == PCB_LAYER_ID::PCB_LAYER_ID_COUNT ) + if( targetLayer == PCB_LAYER_ID::UNDEFINED_LAYER ) { + // The user did not pick any layer. + m_frame->PopTool( tool ); cancelled = true; - break; // The user did not pick any layer. + break; } for( auto item : aItems )