Fixed relative coordinates reset when a tool forces the cursor position
Fixes: lp:1759044 * https://bugs.launchpad.net/kicad/+bug/1759044
This commit is contained in:
parent
482fd866b3
commit
143d580596
|
@ -835,6 +835,15 @@ std::string TOOL_MANAGER::GetClipboard() const
|
|||
}
|
||||
|
||||
|
||||
KIGFX::VC_SETTINGS TOOL_MANAGER::GetCurrentToolVC() const
|
||||
{
|
||||
if( TOOL_STATE* active = GetCurrentToolState() )
|
||||
return active->vcSettings;
|
||||
|
||||
return m_viewControls->GetSettings();
|
||||
}
|
||||
|
||||
|
||||
TOOL_ID TOOL_MANAGER::MakeToolId( const std::string& aToolName )
|
||||
{
|
||||
static int currentId;
|
||||
|
|
|
@ -366,6 +366,12 @@ public:
|
|||
*/
|
||||
std::string GetClipboard() const;
|
||||
|
||||
/**
|
||||
* Returns the view controls settings for the current tool or the general settings if there is
|
||||
* no active tool.
|
||||
*/
|
||||
KIGFX::VC_SETTINGS& GetCurrentToolVC() const;
|
||||
|
||||
private:
|
||||
typedef std::pair<TOOL_EVENT_LIST, TOOL_STATE_FUNC> TRANSITION;
|
||||
|
||||
|
|
|
@ -751,7 +751,11 @@ int PCBNEW_CONTROL::GridResetOrigin( const TOOL_EVENT& aEvent )
|
|||
// Miscellaneous
|
||||
int PCBNEW_CONTROL::ResetCoords( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
|
||||
auto vcSettings = m_toolMgr->GetCurrentToolVC();
|
||||
|
||||
// Use either the active tool forced cursor position or the general settings
|
||||
VECTOR2I cursorPos = vcSettings.m_forceCursorPosition ? vcSettings.m_forcedPosition :
|
||||
getViewControls()->GetCursorPosition();
|
||||
|
||||
m_frame->GetScreen()->m_O_Curseur = wxPoint( cursorPos.x, cursorPos.y );
|
||||
m_frame->UpdateStatusBar();
|
||||
|
|
Loading…
Reference in New Issue