From f2788a3086b5c1a514f364a01047418486ca4d7b Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 30 Apr 2015 10:46:06 +0200 Subject: [PATCH] Corrected way of storing cursor coordinates for context --- common/tool/tool_manager.cpp | 4 +++- include/view/view_controls.h | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp index 68b2ad8070..6314e8eac0 100644 --- a/common/tool/tool_manager.cpp +++ b/common/tool/tool_manager.cpp @@ -594,6 +594,8 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent ) // Temporarily store the cursor position, so the tools could execute actions // using the point where the user has invoked a context menu + bool forcedCursor = m_viewControls->IsCursorPositionForced(); + VECTOR2D cursorPos = m_viewControls->GetCursorPosition(); m_viewControls->ForceCursorPosition( true, m_viewControls->GetCursorPosition() ); // Run update handlers @@ -609,7 +611,7 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent ) dispatchInternal( evt ); } - m_viewControls->ForceCursorPosition( false ); + m_viewControls->ForceCursorPosition( forcedCursor, cursorPos ); break; } diff --git a/include/view/view_controls.h b/include/view/view_controls.h index fddf6ad68f..7f8aef9cb2 100644 --- a/include/view/view_controls.h +++ b/include/view/view_controls.h @@ -152,7 +152,6 @@ public: */ virtual VECTOR2D GetCursorPosition() const = 0; - /** * Function ForceCursorPosition() * Places the cursor immediately at a given point. Mouse movement is ignored. @@ -182,6 +181,11 @@ public: m_cursorCaptured = aEnabled; } + inline bool IsCursorPositionForced() const + { + return m_forceCursorPosition; + } + protected: /// Sets center for VIEW, takes into account panning boundaries. void setCenter( const VECTOR2D& aCenter );