summaryrefslogtreecommitdiff
path: root/indra/newview/lljoystickbutton.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lljoystickbutton.cpp')
-rw-r--r--indra/newview/lljoystickbutton.cpp153
1 files changed, 0 insertions, 153 deletions
diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp
index 9e1dc3a4b0..c2a1923dfe 100644
--- a/indra/newview/lljoystickbutton.cpp
+++ b/indra/newview/lljoystickbutton.cpp
@@ -53,7 +53,6 @@
static LLDefaultChildRegistry::Register<LLJoystickAgentSlide> r1("joystick_slide");
static LLDefaultChildRegistry::Register<LLJoystickAgentTurn> r2("joystick_turn");
static LLDefaultChildRegistry::Register<LLJoystickCameraRotate> r3("joystick_rotate");
-static LLDefaultChildRegistry::Register<LLJoystickCameraZoom> r4("joystick_zoom");
static LLDefaultChildRegistry::Register<LLJoystickCameraTrack> r5("joystick_track");
@@ -647,155 +646,3 @@ void LLJoystickCameraTrack::onHeldDown()
gAgentCamera.setPanDownKey(getOrbitRate());
}
}
-
-
-
-//-------------------------------------------------------------------------------
-// LLJoystickCameraZoom
-//-------------------------------------------------------------------------------
-
-LLJoystickCameraZoom::LLJoystickCameraZoom(const LLJoystickCameraZoom::Params& p)
-: LLJoystick(p),
- mInTop( FALSE ),
- mInBottom( FALSE ),
- mPlusInImage(p.plus_image),
- mMinusInImage(p.minus_image)
-{
-}
-
-BOOL LLJoystickCameraZoom::handleMouseDown(S32 x, S32 y, MASK mask)
-{
- BOOL handled = LLJoystick::handleMouseDown(x, y, mask);
-
- if( handled )
- {
- if (mFirstMouse.mY > getRect().getHeight() / 2)
- {
- mInitialQuadrant = JQ_UP;
- }
- else
- {
- mInitialQuadrant = JQ_DOWN;
- }
- }
- return handled;
-}
-
-
-void LLJoystickCameraZoom::onHeldDown()
-{
- updateSlop();
-
- const F32 FAST_RATE = 2.5f; // two and a half times the normal rate
-
- S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY;
-
- if (dy > mVertSlopFar)
- {
- // Zoom in fast
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitInKey(FAST_RATE);
- }
- else if (dy > mVertSlopNear)
- {
- // Zoom in slow
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitInKey(getOrbitRate());
- }
- else if (dy < -mVertSlopFar)
- {
- // Zoom out fast
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitOutKey(FAST_RATE);
- }
- else if (dy < -mVertSlopNear)
- {
- // Zoom out slow
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitOutKey(getOrbitRate());
- }
-}
-
-// Only used for drawing
-void LLJoystickCameraZoom::setToggleState( BOOL top, BOOL bottom )
-{
- mInTop = top;
- mInBottom = bottom;
-}
-
-void LLJoystickCameraZoom::draw()
-{
- if( mInTop )
- {
- mPlusInImage->draw(0,0);
- }
- else
- if( mInBottom )
- {
- mMinusInImage->draw(0,0);
- }
- else
- {
- getImageUnselected()->draw( 0, 0 );
- }
-}
-
-void LLJoystickCameraZoom::updateSlop()
-{
- mVertSlopNear = getRect().getHeight() / 4;
- mVertSlopFar = getRect().getHeight() / 2;
-
- mHorizSlopNear = getRect().getWidth() / 4;
- mHorizSlopFar = getRect().getWidth() / 2;
-
- // Compute initial mouse offset based on initial quadrant.
- // Place the mouse evenly between the near and far zones.
- switch (mInitialQuadrant)
- {
- case JQ_ORIGIN:
- mInitialOffset.set(0, 0);
- break;
-
- case JQ_UP:
- mInitialOffset.mX = 0;
- mInitialOffset.mY = (mVertSlopNear + mVertSlopFar) / 2;
- break;
-
- case JQ_DOWN:
- mInitialOffset.mX = 0;
- mInitialOffset.mY = - (mVertSlopNear + mVertSlopFar) / 2;
- break;
-
- case JQ_LEFT:
- mInitialOffset.mX = - (mHorizSlopNear + mHorizSlopFar) / 2;
- mInitialOffset.mY = 0;
- break;
-
- case JQ_RIGHT:
- mInitialOffset.mX = (mHorizSlopNear + mHorizSlopFar) / 2;
- mInitialOffset.mY = 0;
- break;
-
- default:
- llerrs << "LLJoystick::LLJoystick() - bad switch case" << llendl;
- break;
- }
-
- return;
-}
-
-
-F32 LLJoystickCameraZoom::getOrbitRate()
-{
- F32 time = getElapsedHeldDownTime();
- if( time < NUDGE_TIME )
- {
- F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME;
-// llinfos << "rate " << rate << " time " << time << llendl;
- return rate;
- }
- else
- {
- return 1;
- }
-}