From 49dd5d838c0776e8b22f70ad98d66b7876583558 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Thu, 15 Aug 2019 20:32:19 +0200 Subject: [PATCH] libedit: Fix inverted Y axis on move command Also clean up some code formatting issues --- eeschema/tools/lib_drawing_tools.cpp | 6 +++--- eeschema/tools/lib_move_tool.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/eeschema/tools/lib_drawing_tools.cpp b/eeschema/tools/lib_drawing_tools.cpp index fa33d3ee8a..28b4ba4ee1 100644 --- a/eeschema/tools/lib_drawing_tools.cpp +++ b/eeschema/tools/lib_drawing_tools.cpp @@ -141,14 +141,14 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) { 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; break; } case LIB_TEXT_T: { 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->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() ) ) { - static_cast( item )->SetPosition( wxPoint( cursorPos.x, -cursorPos.y) ); + static_cast( item )->SetPosition( wxPoint( cursorPos.x, -cursorPos.y ) ); m_view->ClearPreview(); m_view->AddToPreview( item->Clone() ); } diff --git a/eeschema/tools/lib_move_tool.cpp b/eeschema/tools/lib_move_tool.cpp index 9f991c511e..80ec907c8e 100644 --- a/eeschema/tools/lib_move_tool.cpp +++ b/eeschema/tools/lib_move_tool.cpp @@ -43,7 +43,7 @@ LIB_MOVE_TOOL::LIB_MOVE_TOOL() : bool LIB_MOVE_TOOL::Init() { EE_TOOL_BASE::Init(); - + // // Add move actions to the selection tool menu // @@ -159,7 +159,9 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent ) } 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 ); m_cursor = m_anchorPos; }