Fix offset issue when moving text.
This commit is contained in:
parent
d9d2822fe0
commit
e2ea9b772a
|
@ -1108,27 +1108,22 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas
|
|||
|
||||
wxPoint EDA_DRAW_FRAME::GetCrossHairPosition( bool aInvertY ) const
|
||||
{
|
||||
|
||||
// subject to change, borrow from old BASE_SCREEN for now.
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
VECTOR2I cursor = GetGalCanvas()->GetViewControls()->GetCursorPosition();
|
||||
|
||||
|
||||
return wxPoint( cursor.x, aInvertY ? -cursor.y : cursor.y );
|
||||
}
|
||||
else
|
||||
{
|
||||
BASE_SCREEN* screen = GetScreen(); // virtual call
|
||||
return screen->getCrossHairPosition( aInvertY );
|
||||
}
|
||||
VECTOR2I cursor = GetGalCanvas()->GetViewControls()->GetCursorPosition();
|
||||
return wxPoint( cursor.x, aInvertY ? -cursor.y : cursor.y );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid )
|
||||
{
|
||||
// While we're now a GAL canvas, we still have a pre-GAL toolset so some code is going
|
||||
// to look for the crosshair position in the BASE_SCREEN and some code is going to look
|
||||
// for it in the VIEW_CONTROLS. Better set it in both.
|
||||
|
||||
BASE_SCREEN* screen = GetScreen(); // virtual call
|
||||
screen->setCrossHairPosition( aPosition, GetGridOrigin(), aSnapToGrid );
|
||||
|
||||
wxPoint snappedPosition = screen->getCrossHairPosition( false );
|
||||
GetGalCanvas()->GetViewControls()->SetCrossHairCursorPosition( snappedPosition, false );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -459,10 +459,8 @@ void WX_VIEW_CONTROLS::SetCrossHairCursorPosition( const VECTOR2D& aPosition, bo
|
|||
BOX2I screen( VECTOR2I( 0, 0 ), screenSize );
|
||||
VECTOR2D screenPos = m_view->ToScreen( aPosition );
|
||||
|
||||
if( !screen.Contains( screenPos ) )
|
||||
{
|
||||
if( aWarpView && !screen.Contains( screenPos ) )
|
||||
m_view->SetCenter( aPosition );
|
||||
}
|
||||
|
||||
m_cursorPos = aPosition;
|
||||
}
|
||||
|
|
|
@ -387,7 +387,7 @@ void SCH_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
}
|
||||
|
||||
// Calling the general function on mouse changes (and pseudo key commands)
|
||||
GetParent()->GeneralControl( nullptr, wxPoint(0, 0), /*event.GetLogicalPosition( DC )*/ 0 );
|
||||
GetParent()->GeneralControl( nullptr, mousePos );
|
||||
|
||||
/*******************************/
|
||||
/* Control of block commands : */
|
||||
|
@ -604,6 +604,7 @@ void SCH_DRAW_PANEL::Refresh( bool aEraseBackground, const wxRect* aRect )
|
|||
EDA_DRAW_PANEL_GAL::Refresh( aEraseBackground, aRect );
|
||||
}
|
||||
|
||||
|
||||
void SCH_DRAW_PANEL::OnCharHook( wxKeyEvent& event )
|
||||
{
|
||||
event.Skip();
|
||||
|
@ -673,6 +674,7 @@ void SCH_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
|
|||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void SCH_DRAW_PANEL::onPaint( wxPaintEvent& aEvent )
|
||||
{
|
||||
if( m_painter )
|
||||
|
|
|
@ -785,7 +785,7 @@ void SCH_EDIT_FRAME::PrepareMoveItem( SCH_ITEM* aItem, wxDC* aDC )
|
|||
// (for instance large hierarchical sheets od componants can have
|
||||
// the anchor position outside the canvas)
|
||||
// these items return IsMovableFromAnchorPoint() == false
|
||||
// For these items, do not wrap the cursor
|
||||
// For these items, do not warp the cursor
|
||||
if( aItem->IsMovableFromAnchorPoint() )
|
||||
{
|
||||
SetCrossHairPosition( aItem->GetPosition() );
|
||||
|
|
Loading…
Reference in New Issue