From 44a7f6ab907139c28e833eff1a44c6b78b17d221 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Sun, 17 Apr 2011 17:28:12 -0300 Subject: [PATCH] window move improv --- src/framework/ui/uiwindow.cpp | 3 ++- src/framework/ui/uiwindow.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/framework/ui/uiwindow.cpp b/src/framework/ui/uiwindow.cpp index bcfbb4a8..74a71749 100644 --- a/src/framework/ui/uiwindow.cpp +++ b/src/framework/ui/uiwindow.cpp @@ -35,6 +35,7 @@ void UIWindow::onInputEvent(const InputEvent& event) headRect.setHeight(skin->getHeadHeight()); if(headRect.contains(event.mousePos)) { m_moving = true; + m_movingReference = event.mousePos - getRect().topLeft(); } } else if(event.type == EV_MOUSE_LUP) { if(m_moving) { @@ -42,7 +43,7 @@ void UIWindow::onInputEvent(const InputEvent& event) } } else if(event.type == EV_MOUSE_MOVE) { if(m_moving) { - moveTo(getRect().topLeft() + event.mouseMoved); + moveTo(event.mousePos - m_movingReference); } } } diff --git a/src/framework/ui/uiwindow.h b/src/framework/ui/uiwindow.h index 143798dc..04237e32 100644 --- a/src/framework/ui/uiwindow.h +++ b/src/framework/ui/uiwindow.h @@ -43,6 +43,7 @@ public: private: std::string m_title; bool m_moving; + Point m_movingReference; }; typedef boost::shared_ptr UIWindowPtr;