Commit 7a0d8239 authored by NiranV's avatar NiranV
Browse files

Changed: Improved responsiveness of small scale mouse movements for camera movement.

Fixed: Camera only being able to jump large distances when zoomed in and moving the mouse ever so slightly. Make the camera scale its movement with zoom level.
parent 4eb7c9d6
......@@ -63,7 +63,7 @@ BOOL gCameraBtnZoom = TRUE;
BOOL gCameraBtnOrbit = FALSE;
BOOL gCameraBtnPan = FALSE;
const S32 SLOP_RANGE = 4;
const S32 SLOP_RANGE = 1;
//BD - Right Click Steering
const S32 SLOP_RANGE_RIGHT = 24;
......@@ -398,7 +398,10 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
{
S32 dx = gViewerWindow->getCurrentMouseDX();
S32 dy = gViewerWindow->getCurrentMouseDY();
//BD - Scale our camera movement according to our camera zoom to make finer movements
// while zoomed in.
F32 zoom_factor = llclamp(LLViewerCamera::getInstance()->getView(), 0.2f, 1.f);
// //BD - Third Person Steering
if (hasMouseCapture() && mValidClickPoint ||
(gAgentCamera.mThirdPersonSteeringMode &&
......@@ -456,7 +459,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
// Orbit tool
if (hasMouseCapture())
{
const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthScaled();
const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthScaled() * zoom_factor;
if (dx != 0)
{
......@@ -492,7 +495,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
F32 dist = (F32) camera_to_focus.normVec();
// Fudge factor for pan
F32 meters_per_pixel = 3.f * dist / gViewerWindow->getWorldViewWidthScaled();
F32 meters_per_pixel = 3.f * dist / gViewerWindow->getWorldViewWidthScaled() * zoom_factor;
if (dx != 0)
{
......@@ -514,7 +517,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
if (hasMouseCapture())
{
const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthScaled();
const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthScaled() * zoom_factor;
if (dx != 0)
{
......@@ -569,7 +572,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
F32 dist = (F32)camera_to_focus.normVec();
// Fudge factor for pan
F32 meters_per_pixel = 3.f * dist / gViewerWindow->getWorldViewWidthScaled();
F32 meters_per_pixel = 3.f * dist / gViewerWindow->getWorldViewWidthScaled() * zoom_factor;
if (dx != 0)
{
......@@ -587,7 +590,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
}
else
{
const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthScaled();
const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthScaled() * zoom_factor;
if (dx != 0)
{
......
......@@ -3813,7 +3813,9 @@ void LLViewerWindow::updateMouseDelta()
fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds.value()*amount,1.f);
fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds.value()*amount,1.f);
mCurrentMouseDelta.set(ll_round(fdx), ll_round(fdy));
//BD - Do not round our mouse delta, it will result in ignoring all 1-2 pixel movements entirely.
//mCurrentMouseDelta.set(ll_round(fdx), ll_round(fdy));
mCurrentMouseDelta.set(fdx, fdy);
mouse_vel.setVec(fdx,fdy);
}
else
......
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