summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-07-15 23:37:10 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-07-16 14:49:02 +0200
commit51ba2df1cb29d4343f92174da6dc8f36ba9152eb (patch)
treeda07db31d146438fb7b20e6b67a13f1dbdb88c9a
parent3cd7c0f6b6cdb8ebc6c72d2ffe1e0bc18968e27b (diff)
fdo#81182: Resizing glTF window affects camera position
Camera moves by click and drag, with checking the last mouse position we can make sure click was done inside the window before drag. Resizing can trigger drag event, but not click event. Change-Id: I9e8b70fcb4a0abf26e76e03cafd026f940eceb10
-rw-r--r--avmedia/source/opengl/oglwindow.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx
index dbb366215a53..d082aa9d24f4 100644
--- a/avmedia/source/opengl/oglwindow.cxx
+++ b/avmedia/source/opengl/oglwindow.cxx
@@ -19,7 +19,7 @@ OGLWindow::OGLWindow( glTFHandle& rHandle, OpenGLContext& rContext, Window& rEve
, m_rContext( rContext )
, m_rEventHandler( rEventHandlerParent )
, m_bVisible ( false )
- , m_aLastMousePos(Point())
+ , m_aLastMousePos(Point(0,0))
, m_bIsOrbitMode( false )
, m_fCameraDistance(0.0)
{
@@ -321,7 +321,7 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
m_rEventHandler.GrabFocus();
}
MouseEvent* pMouseEvt = (MouseEvent*)pEvent->GetData();
- if(pMouseEvt && pMouseEvt->IsLeft())
+ if(pMouseEvt && pMouseEvt->IsLeft() && m_aLastMousePos != Point(0,0))
{
const Point& aCurPos = pMouseEvt->GetPosPixel();
float fSensitivity = std::min(m_rHandle.viewport.width, m_rHandle.viewport.height);
@@ -353,6 +353,7 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
MouseEvent* pMouseEvt = (MouseEvent*)pEvent->GetData();
if(pMouseEvt && pMouseEvt->IsLeft() && pMouseEvt->GetClicks() == 1)
{
+ m_aLastMousePos = Point(0,0);
gltf_renderer_stop_rotate_model(&m_rHandle);
}
}