diff options
author | Mnikolenko ProductEngine <mnikolenko@productengine.com> | 2016-03-21 17:58:39 +0200 |
---|---|---|
committer | Mnikolenko ProductEngine <mnikolenko@productengine.com> | 2016-03-21 17:58:39 +0200 |
commit | ca1d7da5718a4ad40856fe404ce89690da984f15 (patch) | |
tree | 9a10615235fc0dab6be3cddbbc72c19eb324f976 /indra/newview | |
parent | 18cd32443a552e4f115d1b2913f262b385766cdf (diff) |
MAINT-3171 Alt-clicking while moving mouse can move the camera significantly
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llviewerwindow.cpp | 35 | ||||
-rwxr-xr-x | indra/newview/llviewerwindow.h | 3 |
2 files changed, 36 insertions, 2 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index d3416ec5fc..50329d8576 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1037,7 +1037,16 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) { - BOOL down = TRUE; + mAllowMouseDragging = FALSE; + if (!mMouseDownTimer.getStarted()) + { + mMouseDownTimer.start(); + } + else + { + mMouseDownTimer.reset(); + } + BOOL down = TRUE; return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down); } @@ -1056,7 +1065,11 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { - BOOL down = FALSE; + if (mMouseDownTimer.getStarted()) + { + mMouseDownTimer.stop(); + } + BOOL down = FALSE; return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down); } @@ -1288,6 +1301,22 @@ void LLViewerWindow::handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask } } +void LLViewerWindow::handleMouseDragged(LLWindow *window, LLCoordGL pos, MASK mask) +{ + if (mMouseDownTimer.getStarted()) + { + if (mMouseDownTimer.getElapsedTimeF32() > 0.1) + { + mAllowMouseDragging = TRUE; + mMouseDownTimer.stop(); + } + } + if(mAllowMouseDragging || !LLToolCamera::getInstance()->hasMouseCapture()) + { + handleMouseMove(window, pos, mask); + } +} + void LLViewerWindow::handleMouseLeave(LLWindow *window) { // Note: we won't get this if we have captured the mouse. @@ -1617,6 +1646,8 @@ LLViewerWindow::LLViewerWindow(const Params& p) mMiddleMouseDown(FALSE), mRightMouseDown(FALSE), mMouseInWindow( FALSE ), + mAllowMouseDragging(TRUE), + mMouseDownTimer(), mLastMask( MASK_NONE ), mToolStored( NULL ), mHideCursorPermanent( FALSE ), diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index d34e76f6f6..ad06f00234 100755 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -193,6 +193,7 @@ public: /*virtual*/ BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); /*virtual*/ LLWindowCallbacks::DragNDropResult handleDragNDrop(LLWindow *window, LLCoordGL pos, MASK mask, LLWindowCallbacks::DragNDropAction action, std::string data); void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask); + void handleMouseDragged(LLWindow *window, LLCoordGL pos, MASK mask); /*virtual*/ void handleMouseLeave(LLWindow *window); /*virtual*/ void handleResize(LLWindow *window, S32 x, S32 y); /*virtual*/ void handleFocus(LLWindow *window); @@ -463,6 +464,8 @@ private: BOOL mMouseInWindow; // True if the mouse is over our window or if we have captured the mouse. BOOL mFocusCycleMode; + BOOL mAllowMouseDragging; + LLFrameTimer mMouseDownTimer; typedef std::set<LLHandle<LLView> > view_handle_set_t; view_handle_set_t mMouseHoverViews; |