summaryrefslogtreecommitdiff
path: root/indra/newview/lljoystickbutton.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2009-11-16 11:05:33 -0500
committerLoren Shih <seraph@lindenlab.com>2009-11-16 11:05:33 -0500
commit95cbf689f343ba4c0c352993273b5bb20812e36c (patch)
treedabc2ffc10bc027da8c60168e0190a0da98b5722 /indra/newview/lljoystickbutton.cpp
parent59eb2815bfea9b0a826e006090d0fef80ae1f6b8 (diff)
parent6f52f1e502cf030ceb4e14963fdda1021ea33023 (diff)
merge
--HG-- branch : avatar-pipeline
Diffstat (limited to 'indra/newview/lljoystickbutton.cpp')
-rw-r--r--indra/newview/lljoystickbutton.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp
index bd6702a0b2..d7eaad94f0 100644
--- a/indra/newview/lljoystickbutton.cpp
+++ b/indra/newview/lljoystickbutton.cpp
@@ -134,16 +134,31 @@ void LLJoystick::updateSlop()
return;
}
+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)
+ return TRUE;
+ return FALSE;
+}
BOOL LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask)
{
//llinfos << "joystick mouse down " << x << ", " << y << llendl;
+ bool handles = false;
- mLastMouse.set(x, y);
- mFirstMouse.set(x, y);
+ if(handles = pointInCircle(x, y))
+ {
+ mLastMouse.set(x, y);
+ mFirstMouse.set(x, y);
+ mMouseDownTimer.reset();
+ handles = LLButton::handleMouseDown(x, y, mask);
+ }
- mMouseDownTimer.reset();
- return LLButton::handleMouseDown(x, y, mask);
+ return handles;
}