libedit: Fix inverted Y axis on move command

Also clean up some code formatting issues
This commit is contained in:
Ian McInerney 2019-08-15 20:32:19 +02:00 committed by Jeff Young
parent 92fe201c5b
commit 49dd5d838c
2 changed files with 7 additions and 5 deletions

View File

@ -141,14 +141,14 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
{ {
case LIB_PIN_T: case LIB_PIN_T:
{ {
item = pinTool->CreatePin( wxPoint( cursorPos.x, -cursorPos.y), part ); item = pinTool->CreatePin( wxPoint( cursorPos.x, -cursorPos.y ), part );
g_lastPinWeakPtr = item; g_lastPinWeakPtr = item;
break; break;
} }
case LIB_TEXT_T: case LIB_TEXT_T:
{ {
LIB_TEXT* text = new LIB_TEXT( part ); LIB_TEXT* text = new LIB_TEXT( part );
text->SetPosition( wxPoint( cursorPos.x, -cursorPos.y) ); text->SetPosition( wxPoint( cursorPos.x, -cursorPos.y ) );
text->SetTextSize( wxSize( m_frame->g_LastTextSize, m_frame->g_LastTextSize ) ); text->SetTextSize( wxSize( m_frame->g_LastTextSize, m_frame->g_LastTextSize ) );
text->SetTextAngle( m_frame->g_LastTextAngle ); text->SetTextAngle( m_frame->g_LastTextAngle );
@ -215,7 +215,7 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) ) else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{ {
static_cast<LIB_ITEM*>( item )->SetPosition( wxPoint( cursorPos.x, -cursorPos.y) ); static_cast<LIB_ITEM*>( item )->SetPosition( wxPoint( cursorPos.x, -cursorPos.y ) );
m_view->ClearPreview(); m_view->ClearPreview();
m_view->AddToPreview( item->Clone() ); m_view->AddToPreview( item->Clone() );
} }

View File

@ -159,7 +159,9 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
} }
else if( selection.Size() == 1 && m_frame->GetMoveWarpsCursor() ) else if( selection.Size() == 1 && m_frame->GetMoveWarpsCursor() )
{ {
m_anchorPos = lib_item->GetPosition(); wxPoint itemPos = lib_item->GetPosition();
m_anchorPos = wxPoint( itemPos.x, -itemPos.y );
getViewControls()->WarpCursor( m_anchorPos, true, true ); getViewControls()->WarpCursor( m_anchorPos, true, true );
m_cursor = m_anchorPos; m_cursor = m_anchorPos;
} }