diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2009-11-23 15:53:49 +0000 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2009-11-23 15:53:49 +0000 |
commit | a434e32097ca59c19a7c38aeae6b1991272569df (patch) | |
tree | 34237f1926aee21a80f977e5b363a7c0a8592b21 /indra/newview/lltoolpie.cpp | |
parent | 21723e85677c69c4f78946d971bbf0e0c9cd37e5 (diff) | |
parent | 1b07c1d7fb5b6d3ce15083bc3dbb65a3f0ac8006 (diff) |
merge.
Diffstat (limited to 'indra/newview/lltoolpie.cpp')
-rw-r--r-- | indra/newview/lltoolpie.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 9c8fca3552..5ed8dc5fb9 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -209,6 +209,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback() // touch behavior down below... break; case CLICK_ACTION_SIT: + if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // agent not already sitting { handle_object_sit_or_stand(); @@ -252,7 +253,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback() selectionPropertiesReceived(); } } - return TRUE; + return TRUE; case CLICK_ACTION_PLAY: handle_click_action_play(); return TRUE; @@ -260,6 +261,29 @@ BOOL LLToolPie::pickLeftMouseDownCallback() // mClickActionObject = object; handle_click_action_open_media(object); return TRUE; + case CLICK_ACTION_ZOOM: + { + const F32 PADDING_FACTOR = 2.f; + LLViewerObject* object = gObjectList.findObject(mPick.mObjectID); + + if (object) + { + gAgent.setFocusOnAvatar(FALSE, ANIMATE); + + LLBBox bbox = object->getBoundingBoxAgent() ; + F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView()); + F32 distance = bbox.getExtentLocal().magVec() * PADDING_FACTOR / atan(angle_of_view); + + LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - bbox.getCenterAgent(); + obj_to_cam.normVec(); + + LLVector3d object_center_global = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent()); + gAgent.setCameraPosAndFocusGlobal(object_center_global + LLVector3d(obj_to_cam * distance), + object_center_global, + mPick.mObjectID ); + } + } + return TRUE; default: // nothing break; @@ -413,6 +437,9 @@ ECursorType cursor_from_object(LLViewerObject* object) cursor = UI_CURSOR_HAND; } break; + case CLICK_ACTION_ZOOM: + cursor = UI_CURSOR_TOOLZOOMIN; + break; case CLICK_ACTION_PLAY: case CLICK_ACTION_OPEN_MEDIA: cursor = cursor_from_parcel_media(click_action); @@ -551,6 +578,9 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) case CLICK_ACTION_BUY: case CLICK_ACTION_PAY: case CLICK_ACTION_OPEN: + case CLICK_ACTION_ZOOM: + case CLICK_ACTION_PLAY: + case CLICK_ACTION_OPEN_MEDIA: // Because these actions open UI dialogs, we won't change // the cursor again until the next hover and GL pick over // the world. Keep the cursor an arrow, assuming that |