Commit 454fe423 authored by Leeor Dicker's avatar Leeor Dicker

Fixes Issue #5.

- Current mouse coordinates are saved when the right mouse button is pressed.
- Mouse pointer 'warped' to saved coords when right mouse button released.
parent ee378548
......@@ -6,3 +6,4 @@
/proj/vc14/*.opendb
/data/editor.xml
/data/maps
/proj/vc14/.vs/Landlord/v14/*.suo
......@@ -487,6 +487,7 @@ void EditorState::onMouseDown(MouseButton button, int x, int y)
else if(button == BUTTON_RIGHT)
{
mRightButtonDown = true;
mSavedMouseCoords = mMouseCoords;
Utility<EventHandler>::get().mouseRelativeMode(true);
}
}
......@@ -516,6 +517,7 @@ void EditorState::onMouseUp(MouseButton button, int x, int y)
{
mRightButtonDown = false;
Utility<EventHandler>::get().mouseRelativeMode(false);
Utility<EventHandler>::get().warpMouse(mSavedMouseCoords.x(), mSavedMouseCoords.y()); // a bit hacky but does the job
}
Utility<EventHandler>::get().releaseMouse();
......
......@@ -114,6 +114,7 @@ private:
// PRIMITIVES
Point_2d mMouseCoords;
Point_2d mSavedMouseCoords;
Point_2df mScrollVector;
Rectangle_2d mSelectorRect;
Rectangle_2d mCellInspectRect;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment