On Sat, 2012-11-10 at 17:24 -0500, Younes Manton wrote: > Because dragging is implemented as a simulated 1x1 block selection, > there's no way to pick out and drag a single item when multiple items > overlap. > > Currently the drag hotkey handler checks to see how many items are > under the mouse, let's the user select one via a popup menu if there > are more than one, and then throws that info away because it sets up a > 1x1 block selection. The block selection finds all all items under the > cursor, and you end up dragging them all instead of the item you > wanted. > > > This patch fixes that in the block selection code by checking if this > is currently a simulated drag (block command == drag and current > item != null) and returning the currently selected item, rather than > testing everything under the cursor and returning multiple items. This > seemed like the most straight-forward way to fix the issue and still > keep dragging as a simulated block selection.
Hi, any comment on this? Here's the patch inline if it makes it easier to discuss/review. # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: [email protected] # target_branch: http://bazaar.launchpad.net/~kicad-testing-\ # committers/kicad/testing/ # testament_sha1: c2edb073e933f0f73b12632957291457bbe726cc # timestamp: 2012-11-04 17:01:21 -0500 # message: Fix drag when single item is selected # base_revision_id: [email protected] # # Begin patch === modified file 'eeschema/sch_screen.cpp' --- eeschema/sch_screen.cpp 2012-09-28 17:47:41 +0000 +++ eeschema/sch_screen.cpp 2012-11-04 21:55:05 +0000 @@ -862,13 +862,23 @@ area.SetSize( m_BlockLocate.GetSize() ); area.Normalize(); - for( SCH_ITEM* item = m_drawList.begin(); item != NULL; item = item->Next() ) - { - // An item is picked if its bounding box intersects the reference area. - if( item->HitTest( area ) ) + // If it's a drag and we have a current item, this is a simulated drag + // and we already know which item the user intended. + if ( m_BlockLocate.GetCommand() == BLOCK_DRAG && GetCurItem() != NULL ) + { + picker.SetItem( GetCurItem() ); + m_BlockLocate.PushItem( picker ); + } + else + { + for( SCH_ITEM* item = m_drawList.begin(); item != NULL; item = item->Next() ) { - picker.SetItem( item ); - m_BlockLocate.PushItem( picker ); + // An item is picked if its bounding box intersects the reference area. + if( item->HitTest( area ) ) + { + picker.SetItem( item ); + m_BlockLocate.PushItem( picker ); + } } } # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIH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5Cr/hfevMOQTEyzLIU9lXlrkvBgs1bg ZbQOBe21WRzr/DPqf2O7NLOoutdrruky1NjzcY/0wAM0QVj2XBMsypjDolsi7rwAsXf1b/Jv8L3m Ad9F81Kfg3Szdl3VuOZpIVH19fr9Qtf0ec+lc3YEmFR37CMTiMDA1fethXALh94WONvWHJ13Ujn3 pqu7Bu4zEbVEzlzvDGcYn77tUohHQxtD4O9zJHLnV7LN/QmQRT9gT6hG8KwrHeQmVZ0y1sQ2xzl7 VCNf8k4S9qBhl9zdqWHcNELxGrNditdkQsIQIdg0PxrgQg9PcuQqqRcEgdolU4CC7XLlJQKnJzJl XPitKw2IX4t2zDZ2y9QmpIGWTlb4/b90ux8l57qhdG5mTx71wPeKrNbsFXBchbVupJ6OCma1EMdT 5o3XLGyUUX8oke2i6HZTvkSkvknJ/24xZM9Kp3pVh+sQcmyxvuxYY01QLQdQza4oRaaH74X/R7oS RGESMU5tUUvETKVbWmLKrPK4laDA5V0jBPvsXDbYgqVnIsu8zjheprMLIeMz/ImMoyCrJjf/Y3ja vC6wrDyXm3/xdyRThQkEcuE4YA== _______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

