diff options
author | Steve Bennetts <steve@lindenlab.com> | 2009-11-13 12:21:53 -0800 |
---|---|---|
committer | Steve Bennetts <steve@lindenlab.com> | 2009-11-13 12:21:53 -0800 |
commit | b964f3bccaf744ec719e7dff132a77801a419f2b (patch) | |
tree | f5f09ad1904cbf87878d5f6e9f34acbdb64975e2 /indra/newview/lljoystickbutton.cpp | |
parent | ce397569bf40b5fe6e80eb0e302bf47b709f3e54 (diff) | |
parent | b3b608b2a8e0678a86c86f3506d6424d4834be20 (diff) |
Merge from product-engine
Diffstat (limited to 'indra/newview/lljoystickbutton.cpp')
-rw-r--r-- | indra/newview/lljoystickbutton.cpp | 23 |
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; } |