diff options
author | Eric M. Tulla (BigPapi) <tulla@lindenlab.com> | 2009-11-17 17:58:17 -0500 |
---|---|---|
committer | Eric M. Tulla (BigPapi) <tulla@lindenlab.com> | 2009-11-17 17:58:17 -0500 |
commit | 32178873564f86f0ab9ee06d485486fc9d609012 (patch) | |
tree | 4beae7908cbdd5e6af5241682110ac958b7c56ae /indra/newview/lljoystickbutton.cpp | |
parent | 064fb26092ac9f73f9d0301f1e214e27e8418839 (diff) | |
parent | 2365dbcd459b37942ddacbcb7010232113a126c1 (diff) |
Merge of viewer2 into avp
--HG--
branch : avatar-pipeline
Diffstat (limited to 'indra/newview/lljoystickbutton.cpp')
-rw-r--r-- | indra/newview/lljoystickbutton.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp index d7eaad94f0..0acc67ff5a 100644 --- a/indra/newview/lljoystickbutton.cpp +++ b/indra/newview/lljoystickbutton.cpp @@ -134,15 +134,17 @@ void LLJoystick::updateSlop() return; } -BOOL LLJoystick::pointInCircle(S32 x, S32 y) const +bool LLJoystick::pointInCircle(S32 x, S32 y) const { - //cnt is x and y coordinates of center of joystick circle, and also its radius, - //because area is not just rectangular, it's a square! - //Make sure to change method if this changes. - int cnt = this->getLocalRect().mTop/2; - if((x-cnt)*(x-cnt)+(y-cnt)*(y-cnt)<=cnt*cnt) + if(this->getLocalRect().mTop!=this->getLocalRect().mRight) + { + llwarns << "Joystick shape is not square"<<llendl; return TRUE; - return FALSE; + } + //center is x and y coordinates of center of joystick circle, and also its radius + int center = this->getLocalRect().mTop/2; + bool in_circle = (x - center) * (x - center) + (y - center) * (y - center) <= center * center; + return in_circle; } BOOL LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask) @@ -150,7 +152,7 @@ BOOL LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask) //llinfos << "joystick mouse down " << x << ", " << y << llendl; bool handles = false; - if(handles = pointInCircle(x, y)) + if(pointInCircle(x, y)) { mLastMouse.set(x, y); mFirstMouse.set(x, y); |