summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelprimmediacontrols.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2020-09-28 22:29:19 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2020-09-28 22:29:19 +0300
commit1d458de94934d0d56cef15596d414f155db166a0 (patch)
tree8c835b12674ca0dab4214496974848c27babd139 /indra/newview/llpanelprimmediacontrols.cpp
parente9d50aeb3d1fa6b6251296f792d75cbc480f68fb (diff)
parentbac6652cdcd2d8333df04c3ebd3a6a7b752328b3 (diff)
Merge branch 'master' into DRTVWR-515-maint
# Conflicts: # indra/newview/llpanelprimmediacontrols.cpp
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 6bb213c0ef..c42cd6c6ba 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;
const S32 ADDR_LEFT_PAD = 3;
//
@@ -95,6 +96,7 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
mZoomObjectID(LLUUID::null),
mZoomObjectFace(0),
mVolumeSliderVisible(0),
+ mZoomedCameraPos(),
mWindowShade(NULL),
mHideImmediately(false),
mSecureURL(false),
@@ -258,7 +260,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();
@@ -309,7 +311,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)
@@ -1145,7 +1148,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
@@ -1405,6 +1408,10 @@ bool LLPanelPrimMediaControls::shouldVolumeSliderBeVisible()
return mVolumeSliderVisible > 0;
}
+bool LLPanelPrimMediaControls::isZoomDistExceeding()
+{
+ return (gAgentCamera.getCameraPositionGlobal() - mZoomedCameraPos).normalize() >= EXCEEDING_ZOOM_DISTANCE;
+}
void LLPanelPrimMediaControls::clearFaceOnFade()
{