From e3924c12eea72f1108f31eea7ad930c01c5f15bb Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 6 Sep 2018 06:11:01 -0700 Subject: [PATCH] eeschema: Only allow dragging of draggable items When expanding the drag item to allow corners, we accidentally picked up other items in the list. This limits the items that can be dragged to only those that are explicitly in the draggable list. A side effect of this commit is that when converting from move to drag (with tab), items not in the draggable list will be left in place. Fixes: lp:1787966 * https://bugs.launchpad.net/kicad/+bug/1787966 --- eeschema/sch_screen.cpp | 3 ++- include/base_struct.h | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 8d8146b624..3158e9ffef 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -910,7 +910,8 @@ int SCH_SCREEN::UpdatePickList() for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() ) { // An item is picked if its bounding box intersects the reference area. - if( item->HitTest( area ) ) + if( item->HitTest( area ) && + ( !m_BlockLocate.IsDragging() || item->IsType( SCH_COLLECTOR::DraggableItems ) ) ) { picker.SetItem( item ); m_BlockLocate.PushItem( picker ); diff --git a/include/base_struct.h b/include/base_struct.h index 1176b2e639..636aa65925 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -254,6 +254,23 @@ public: void ClearFlags( STATUS_FLAGS aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; } STATUS_FLAGS GetFlags() const { return m_Flags; } + /** + * Function IsType + * Checks whether the item is one of the listed types + * @param aScanTypes List of item types + * @return true if the item type is contained in the list aScanTypes + */ + bool IsType( const KICAD_T aScanTypes[] ) + { + for( const KICAD_T* p = aScanTypes; *p != EOT; ++p ) + { + if( m_StructType == *p ) + return true; + } + + return false; + } + /** * Function SetForceVisible * is used to set and cleag force visible flag used to force the item to be drawn