summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelprimmediacontrols.cpp
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2020-03-20 16:34:57 +0200
committerMnikolenko Productengine <mnikolenko@productengine.com>2020-03-20 16:34:57 +0200
commite77e1ed8ca0a4ae34c642819fd089fa7daa67eb8 (patch)
treee7992a57de0e169a9cb676c892a4f6de482fde8d /indra/newview/llpanelprimmediacontrols.cpp
parent6c41ea62ceed90658c9d6ab6d51c5d66b8837d8c (diff)
SL-2222 FIXED Media Control still offers zoom out when already zoomed out
Diffstat (limited to 'indra/newview/llpanelprimmediacontrols.cpp')
-rw-r--r--indra/newview/llpanelprimmediacontrols.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index 3c74aed734..1e301af605 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -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()
{