Loading pcbnew/tools/edit_tool.cpp +6 −17 Original line number Original line Diff line number Diff line Loading @@ -143,14 +143,11 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent ) if( m_dragging ) if( m_dragging ) { { wxPoint movement = wxPoint( m_cursor.x, m_cursor.y ) - wxPoint movement = wxPoint( m_cursor.x, m_cursor.y ) - static_cast<BOARD_ITEM*>( selection.items.GetPickedItem( 0 ) )->GetPosition(); selection.Item<BOARD_ITEM>( 0 )->GetPosition(); // Drag items to the current cursor position // Drag items to the current cursor position for( unsigned int i = 0; i < selection.items.GetCount(); ++i ) for( unsigned int i = 0; i < selection.items.GetCount(); ++i ) { selection.Item<BOARD_ITEM>( i )->Move( movement ); BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.items.GetPickedItem( i ) ); item->Move( movement + m_offset ); } updateRatsnest( true ); updateRatsnest( true ); } } Loading @@ -160,9 +157,9 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent ) editFrame->OnModify(); editFrame->OnModify(); editFrame->SaveCopyInUndoList( selection.items, UR_CHANGED ); editFrame->SaveCopyInUndoList( selection.items, UR_CHANGED ); // Update dragging offset (distance between cursor and the first dragged item) // Set the current cursor position to the first dragged item origin, so the m_offset = static_cast<BOARD_ITEM*>( selection.items.GetPickedItem( 0 ) )->GetPosition() - // movement vector could be computed later wxPoint( m_cursor.x, m_cursor.y ); m_cursor = VECTOR2I( selection.Item<BOARD_ITEM>( 0 )->GetPosition() ); m_dragging = true; m_dragging = true; } } Loading Loading @@ -312,10 +309,6 @@ int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent ) updateRatsnest( m_dragging ); updateRatsnest( m_dragging ); // Update dragging offset (distance between cursor and the first dragged item) m_offset = static_cast<BOARD_ITEM*>( selection.items.GetPickedItem( 0 ) )->GetPosition() - rotatePoint; if( m_dragging ) if( m_dragging ) selection.group->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); selection.group->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); else else Loading Loading @@ -366,10 +359,6 @@ int EDIT_TOOL::Flip( TOOL_EVENT& aEvent ) updateRatsnest( m_dragging ); updateRatsnest( m_dragging ); // Update dragging offset (distance between cursor and the first dragged item) m_offset = static_cast<BOARD_ITEM*>( selection.items.GetPickedItem( 0 ) )->GetPosition() - flipPoint; if( m_dragging ) if( m_dragging ) selection.group->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); selection.group->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); else else Loading Loading @@ -502,7 +491,7 @@ wxPoint EDIT_TOOL::getModificationPoint( const SELECTION_TOOL::SELECTION& aSelec { { if( aSelection.Size() == 1 ) if( aSelection.Size() == 1 ) { { return static_cast<BOARD_ITEM*>( aSelection.items.GetPickedItem( 0 ) )->GetPosition() - m_offset; return aSelection.Item<BOARD_ITEM>( 0 )->GetPosition(); } } else else { { Loading pcbnew/tools/edit_tool.h +0 −3 Original line number Original line Diff line number Diff line Loading @@ -98,9 +98,6 @@ private: ///> Flag determining if anything is being dragged right now ///> Flag determining if anything is being dragged right now bool m_dragging; bool m_dragging; ///> Offset from the dragged item's center (anchor) wxPoint m_offset; ///> Last cursor position (needed for getModificationPoint() to avoid changes ///> Last cursor position (needed for getModificationPoint() to avoid changes ///> of edit reference point). ///> of edit reference point). VECTOR2I m_cursor; VECTOR2I m_cursor; Loading Loading
pcbnew/tools/edit_tool.cpp +6 −17 Original line number Original line Diff line number Diff line Loading @@ -143,14 +143,11 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent ) if( m_dragging ) if( m_dragging ) { { wxPoint movement = wxPoint( m_cursor.x, m_cursor.y ) - wxPoint movement = wxPoint( m_cursor.x, m_cursor.y ) - static_cast<BOARD_ITEM*>( selection.items.GetPickedItem( 0 ) )->GetPosition(); selection.Item<BOARD_ITEM>( 0 )->GetPosition(); // Drag items to the current cursor position // Drag items to the current cursor position for( unsigned int i = 0; i < selection.items.GetCount(); ++i ) for( unsigned int i = 0; i < selection.items.GetCount(); ++i ) { selection.Item<BOARD_ITEM>( i )->Move( movement ); BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.items.GetPickedItem( i ) ); item->Move( movement + m_offset ); } updateRatsnest( true ); updateRatsnest( true ); } } Loading @@ -160,9 +157,9 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent ) editFrame->OnModify(); editFrame->OnModify(); editFrame->SaveCopyInUndoList( selection.items, UR_CHANGED ); editFrame->SaveCopyInUndoList( selection.items, UR_CHANGED ); // Update dragging offset (distance between cursor and the first dragged item) // Set the current cursor position to the first dragged item origin, so the m_offset = static_cast<BOARD_ITEM*>( selection.items.GetPickedItem( 0 ) )->GetPosition() - // movement vector could be computed later wxPoint( m_cursor.x, m_cursor.y ); m_cursor = VECTOR2I( selection.Item<BOARD_ITEM>( 0 )->GetPosition() ); m_dragging = true; m_dragging = true; } } Loading Loading @@ -312,10 +309,6 @@ int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent ) updateRatsnest( m_dragging ); updateRatsnest( m_dragging ); // Update dragging offset (distance between cursor and the first dragged item) m_offset = static_cast<BOARD_ITEM*>( selection.items.GetPickedItem( 0 ) )->GetPosition() - rotatePoint; if( m_dragging ) if( m_dragging ) selection.group->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); selection.group->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); else else Loading Loading @@ -366,10 +359,6 @@ int EDIT_TOOL::Flip( TOOL_EVENT& aEvent ) updateRatsnest( m_dragging ); updateRatsnest( m_dragging ); // Update dragging offset (distance between cursor and the first dragged item) m_offset = static_cast<BOARD_ITEM*>( selection.items.GetPickedItem( 0 ) )->GetPosition() - flipPoint; if( m_dragging ) if( m_dragging ) selection.group->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); selection.group->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); else else Loading Loading @@ -502,7 +491,7 @@ wxPoint EDIT_TOOL::getModificationPoint( const SELECTION_TOOL::SELECTION& aSelec { { if( aSelection.Size() == 1 ) if( aSelection.Size() == 1 ) { { return static_cast<BOARD_ITEM*>( aSelection.items.GetPickedItem( 0 ) )->GetPosition() - m_offset; return aSelection.Item<BOARD_ITEM>( 0 )->GetPosition(); } } else else { { Loading
pcbnew/tools/edit_tool.h +0 −3 Original line number Original line Diff line number Diff line Loading @@ -98,9 +98,6 @@ private: ///> Flag determining if anything is being dragged right now ///> Flag determining if anything is being dragged right now bool m_dragging; bool m_dragging; ///> Offset from the dragged item's center (anchor) wxPoint m_offset; ///> Last cursor position (needed for getModificationPoint() to avoid changes ///> Last cursor position (needed for getModificationPoint() to avoid changes ///> of edit reference point). ///> of edit reference point). VECTOR2I m_cursor; VECTOR2I m_cursor; Loading