Don't attempt to move bitmaps from anchor point.
It works poorly for large bitmaps, and they're unlikely to have well-defined anchor points anyway. Fixes: lp:1787964 * https://bugs.launchpad.net/kicad/+bug/1787964
This commit is contained in:
parent
ab9288235c
commit
0167ff880c
|
@ -93,7 +93,7 @@ static void moveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the bitmap at it's new position.
|
// Draw the bitmap at it's new position.
|
||||||
image->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
|
image->SetPosition( aPanel->GetParent()->GetCrossHairPosition() - image->GetStoredPos() );
|
||||||
image->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
image->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +141,8 @@ SCH_BITMAP* SCH_EDIT_FRAME::CreateNewImage( wxDC* aDC )
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::MoveImage( SCH_BITMAP* aImageItem, wxDC* aDC )
|
void SCH_EDIT_FRAME::MoveImage( SCH_BITMAP* aImageItem, wxDC* aDC )
|
||||||
{
|
{
|
||||||
|
// 5.1 TODO: MoveImage(), moveBitmap() and abortMoveBitmap() are obsolete....
|
||||||
|
|
||||||
aImageItem->SetFlags( IS_MOVED );
|
aImageItem->SetFlags( IS_MOVED );
|
||||||
|
|
||||||
m_canvas->SetMouseCapture( moveBitmap, abortMoveBitmap );
|
m_canvas->SetMouseCapture( moveBitmap, abortMoveBitmap );
|
||||||
|
@ -149,10 +151,22 @@ void SCH_EDIT_FRAME::MoveImage( SCH_BITMAP* aImageItem, wxDC* aDC )
|
||||||
|
|
||||||
SetUndoItem( aImageItem );
|
SetUndoItem( aImageItem );
|
||||||
|
|
||||||
m_canvas->CrossHairOff( aDC );
|
if( aImageItem->IsMovableFromAnchorPoint() )
|
||||||
SetCrossHairPosition( aImageItem->GetPosition() );
|
{
|
||||||
m_canvas->MoveCursorToCrossHair();
|
SetCrossHairPosition( aImageItem->GetPosition() );
|
||||||
m_canvas->CrossHairOn( aDC );
|
m_canvas->MoveCursorToCrossHair();
|
||||||
|
aImageItem->SetStoredPos( wxPoint( 0,0 ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Round the point under the cursor to a multiple of the grid
|
||||||
|
wxPoint cursorpos = GetCrossHairPosition() - aImageItem->GetPosition();
|
||||||
|
wxPoint gridsize = GetScreen()->GetGridSize();
|
||||||
|
cursorpos.x = ( cursorpos.x / gridsize.x ) * gridsize.x;
|
||||||
|
cursorpos.y = ( cursorpos.y / gridsize.y ) * gridsize.y;
|
||||||
|
|
||||||
|
aImageItem->SetStoredPos( cursorpos );
|
||||||
|
}
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,13 @@ public:
|
||||||
m_pos += aMoveVector;
|
m_pos += aMoveVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtual function IsMovableFromAnchorPoint
|
||||||
|
* Return true for items which are moved with the anchor point at mouse cursor
|
||||||
|
* and false for items moved with no reference to anchor
|
||||||
|
* @return false for a bus entry
|
||||||
|
*/
|
||||||
|
bool IsMovableFromAnchorPoint() override { return false; }
|
||||||
|
|
||||||
void MirrorY( int aYaxis_position ) override;
|
void MirrorY( int aYaxis_position ) override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue