SL-2222 FIXED Media Control still offers zoom out when already zoomed out
parent
6c41ea62ce
commit
e77e1ed8ca
|
|
@ -73,6 +73,7 @@ bool get_hud_matrices(glh::matrix4f &proj, glh::matrix4f &model);
|
|||
const LLPanelPrimMediaControls::EZoomLevel LLPanelPrimMediaControls::kZoomLevels[] = { ZOOM_NONE, ZOOM_MEDIUM };
|
||||
const int LLPanelPrimMediaControls::kNumZoomLevels = 2;
|
||||
|
||||
const F32 EXCEEDING_ZOOM_DISTANCE = 0.5f;
|
||||
//
|
||||
// LLPanelPrimMediaControls
|
||||
//
|
||||
|
|
@ -93,6 +94,7 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
|
|||
mZoomObjectID(LLUUID::null),
|
||||
mZoomObjectFace(0),
|
||||
mVolumeSliderVisible(0),
|
||||
mZoomedCameraPos(),
|
||||
mWindowShade(NULL),
|
||||
mHideImmediately(false),
|
||||
mSecureURL(false),
|
||||
|
|
@ -256,7 +258,7 @@ void LLPanelPrimMediaControls::focusOnTarget()
|
|||
LLViewerMediaImpl* media_impl = getTargetMediaImpl();
|
||||
if(media_impl)
|
||||
{
|
||||
if(!media_impl->hasFocus())
|
||||
if (!media_impl->hasFocus() || isZoomDistExceeding())
|
||||
{
|
||||
// The current target doesn't have media focus -- focus on it.
|
||||
LLViewerObject* objectp = getTargetObject();
|
||||
|
|
@ -307,7 +309,8 @@ void LLPanelPrimMediaControls::updateShape()
|
|||
|
||||
bool can_navigate = parcel->getMediaAllowNavigate();
|
||||
bool enabled = false;
|
||||
bool is_zoomed = (mCurrentZoom != ZOOM_NONE) && (mTargetObjectID == mZoomObjectID) && (mTargetObjectFace == mZoomObjectFace);
|
||||
bool is_zoomed = (mCurrentZoom != ZOOM_NONE) && (mTargetObjectID == mZoomObjectID) && (mTargetObjectFace == mZoomObjectFace) && !isZoomDistExceeding();
|
||||
|
||||
// There is no such thing as "has_focus" being different from normal controls set
|
||||
// anymore (as of user feedback from bri 10/09). So we cheat here and force 'has_focus'
|
||||
// to 'true' (or, actually, we use a setting)
|
||||
|
|
@ -1117,7 +1120,7 @@ void LLPanelPrimMediaControls::updateZoom()
|
|||
if (zoom_padding > 0.0f)
|
||||
{
|
||||
// since we only zoom into medium for now, always set zoom_in constraint to true
|
||||
LLViewerMediaFocus::setCameraZoom(getTargetObject(), mTargetObjectNormal, zoom_padding, true);
|
||||
mZoomedCameraPos = LLViewerMediaFocus::setCameraZoom(getTargetObject(), mTargetObjectNormal, zoom_padding, true);
|
||||
}
|
||||
|
||||
// Remember the object ID/face we zoomed into, so we can update the zoom icon appropriately
|
||||
|
|
@ -1377,6 +1380,10 @@ bool LLPanelPrimMediaControls::shouldVolumeSliderBeVisible()
|
|||
return mVolumeSliderVisible > 0;
|
||||
}
|
||||
|
||||
bool LLPanelPrimMediaControls::isZoomDistExceeding()
|
||||
{
|
||||
return (gAgentCamera.getCameraPositionGlobal() - mZoomedCameraPos).normalize() >= EXCEEDING_ZOOM_DISTANCE;
|
||||
}
|
||||
|
||||
void LLPanelPrimMediaControls::clearFaceOnFade()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -118,6 +118,8 @@ private:
|
|||
void showVolumeSlider();
|
||||
void hideVolumeSlider();
|
||||
bool shouldVolumeSliderBeVisible();
|
||||
|
||||
bool isZoomDistExceeding();
|
||||
|
||||
static void onScrollUp(void* user_data);
|
||||
static void onScrollUpHeld(void* user_data);
|
||||
|
|
@ -182,6 +184,8 @@ private:
|
|||
F32 mZoomMediumPadding;
|
||||
F32 mZoomFarPadding;
|
||||
S32 mTopWorldViewAvoidZone;
|
||||
|
||||
LLVector3d mZoomedCameraPos;
|
||||
|
||||
LLUICtrl *mMediaPanelScroll;
|
||||
LLButton *mScrollUpCtrl;
|
||||
|
|
|
|||
|
|
@ -205,8 +205,9 @@ bool LLViewerMediaFocus::getFocus()
|
|||
}
|
||||
|
||||
// This function selects an ideal viewing distance based on the focused object, pick normal, and padding value
|
||||
void LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 normal, F32 padding_factor, bool zoom_in_only)
|
||||
LLVector3d LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 normal, F32 padding_factor, bool zoom_in_only)
|
||||
{
|
||||
LLVector3d camera_pos;
|
||||
if (object)
|
||||
{
|
||||
gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
|
||||
|
|
@ -254,7 +255,7 @@ void LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 normal,
|
|||
distance += depth * 0.5;
|
||||
|
||||
// Finally animate the camera to this new position and focal point
|
||||
LLVector3d camera_pos, target_pos;
|
||||
LLVector3d target_pos;
|
||||
// The target lookat position is the center of the selection (in global coords)
|
||||
target_pos = center;
|
||||
// Target look-from (camera) position is "distance" away from the target along the normal
|
||||
|
|
@ -287,7 +288,7 @@ void LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 normal,
|
|||
if (zoom_in_only &&
|
||||
(dist_vec_squared(gAgentCamera.getCameraPositionGlobal(), target_pos) < dist_vec_squared(camera_pos, target_pos)))
|
||||
{
|
||||
return;
|
||||
return camera_pos;
|
||||
}
|
||||
|
||||
gAgentCamera.setCameraPosAndFocusGlobal(camera_pos, target_pos, object->getID() );
|
||||
|
|
@ -298,6 +299,7 @@ void LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 normal,
|
|||
// If we have no object, focus back on the avatar.
|
||||
gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE);
|
||||
}
|
||||
return camera_pos;
|
||||
}
|
||||
void LLViewerMediaFocus::onFocusReceived()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public:
|
|||
|
||||
void update();
|
||||
|
||||
static void setCameraZoom(LLViewerObject* object, LLVector3 normal, F32 padding_factor, bool zoom_in_only = false);
|
||||
static LLVector3d setCameraZoom(LLViewerObject* object, LLVector3 normal, F32 padding_factor, bool zoom_in_only = false);
|
||||
static F32 getBBoxAspectRatio(const LLBBox& bbox, const LLVector3& normal, F32* height, F32* width, F32* depth);
|
||||
|
||||
bool isFocusedOnFace(LLPointer<LLViewerObject> objectp, S32 face);
|
||||
|
|
|
|||
Loading…
Reference in New Issue