From 9b027628ef1a1addbe035482f13a6c6aa5d462c8 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 10 Oct 2018 15:59:38 +0200 Subject: [PATCH] Symbol editor: Fix usability issues of mirror and rotation commands Fix also mirrorX and mirrorY command to have the same behavior as the schematic editor Fixes: lp:1797090 https://bugs.launchpad.net/kicad/+bug/1797090 --- eeschema/libedit/lib_edit_frame.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/eeschema/libedit/lib_edit_frame.cpp b/eeschema/libedit/lib_edit_frame.cpp index 1054732d9d..bf3741d63e 100644 --- a/eeschema/libedit/lib_edit_frame.cpp +++ b/eeschema/libedit/lib_edit_frame.cpp @@ -1166,7 +1166,10 @@ void LIB_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent ) // Compute the rotation center and put it on grid: wxPoint rotationPoint = block.Centre(); rotationPoint = GetNearestGridPosition( rotationPoint ); - SetCrossHairPosition( rotationPoint ); + + // The Y axis orientation is bottom to top for symbol items. + // so change the Y coord value of the rotation center + rotationPoint.y = -rotationPoint.y; if( block.AppendUndo() ) ; // UR_LIBEDIT saves entire state, so no need to append anything more @@ -1183,12 +1186,11 @@ void LIB_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent ) } GetCanvas()->CallMouseCapture( nullptr, wxDefaultPosition, false ); + GetGalCanvas()->Refresh(); } else if( item ) { - wxPoint rotationPoint = item->GetBoundingBox().Centre(); - rotationPoint = GetNearestGridPosition( rotationPoint ); - SetCrossHairPosition( rotationPoint ); + wxPoint rotationPoint = item->GetPosition(); if( !item->InEditMode() ) SaveCopyInUndoList( part, UR_LIBEDIT ); @@ -1217,7 +1219,10 @@ void LIB_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent ) // Compute the mirror center and put it on grid. wxPoint mirrorPoint = block.Centre(); mirrorPoint = GetNearestGridPosition( mirrorPoint ); - SetCrossHairPosition( mirrorPoint ); + + // The Y axis orientation is bottom to top for symbol items. + // so change the Y coord value of the rotation center + mirrorPoint.y = -mirrorPoint.y; if( block.AppendUndo() ) ; // UR_LIBEDIT saves entire state, so no need to append anything more @@ -1231,27 +1236,28 @@ void LIB_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent ) { item = dynamic_cast( block.GetItem( ii ) ); - if( aEvent.GetId() == ID_LIBEDIT_MIRROR_X || aEvent.GetId() == ID_POPUP_MIRROR_X_BLOCK ) + if( aEvent.GetId() == ID_LIBEDIT_MIRROR_Y || aEvent.GetId() == ID_POPUP_MIRROR_Y_BLOCK ) item->MirrorHorizontal( mirrorPoint ); else item->MirrorVertical( mirrorPoint ); } m_canvas->CallMouseCapture( nullptr, wxDefaultPosition, false ); + GetGalCanvas()->Refresh(); } else if( item ) { - wxPoint mirrorPoint = item->GetBoundingBox().Centre(); - mirrorPoint = GetNearestGridPosition( mirrorPoint ); - SetCrossHairPosition( mirrorPoint ); + wxPoint mirrorPoint = item->GetPosition(); + mirrorPoint.y = -mirrorPoint.y; if( !item->InEditMode() ) SaveCopyInUndoList( part, UR_LIBEDIT ); - if( aEvent.GetId() == ID_LIBEDIT_MIRROR_X || aEvent.GetId() == ID_POPUP_MIRROR_X_BLOCK ) + if( aEvent.GetId() == ID_LIBEDIT_MIRROR_Y || aEvent.GetId() == ID_POPUP_MIRROR_Y_BLOCK ) item->MirrorHorizontal( mirrorPoint ); else item->MirrorVertical( mirrorPoint ); + OnModify(); if( !item->InEditMode() )