summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelprimmediacontrols.cpp
diff options
context:
space:
mode:
authorDave Houlton <euclid@lindenlab.com>2020-09-22 22:22:21 +0000
committerDave Houlton <euclid@lindenlab.com>2020-09-22 22:22:21 +0000
commit364ba9978b42ca03c39ee63c23fc1378e410ca96 (patch)
treea5ebd2bd8a4d6e87f55d1be6f278b1807b53de0f /indra/newview/llpanelprimmediacontrols.cpp
parentb62d7c2f06fdaa91312fd6857d03748defe8b60f (diff)
parent86e7cc3d35e41a88b25175bafb5687e1864423d9 (diff)
Merged in DV497-merge-6.4.9 (pull request #312)
Merge 6.4.9 into DRTVWR-497
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 55c84815aa..2bd78f40ba 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())
{
// 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)
@@ -1141,7 +1144,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
@@ -1401,6 +1404,10 @@ bool LLPanelPrimMediaControls::shouldVolumeSliderBeVisible()
return mVolumeSliderVisible > 0;
}
+bool LLPanelPrimMediaControls::isZoomDistExceeding()
+{
+ return (gAgentCamera.getCameraPositionGlobal() - mZoomedCameraPos).normalize() >= EXCEEDING_ZOOM_DISTANCE;
+}
void LLPanelPrimMediaControls::clearFaceOnFade()
{