From 1b07c1d7fb5b6d3ce15083bc3dbb65a3f0ac8006 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Fri, 20 Nov 2009 17:49:52 -0800 Subject: Fix for DEV-43040 (Change media focus rules to be the same as alt-zoom). Added an optional reset_camera parameter to LLPanelPrimMediaControls ::resetZoomLevel(). Default is true, but if false it prevents the reset from moving the camera, and just resets the internal state for zoom tracking. Fixed zoom-related bugs in LLPanelPrimMediaControls::close() and LLPanelPrimMediaControls::onClickZoom(). Changed the zooming behavior in LLViewerMediaFocus to match the desired behavior. --- indra/newview/llpanelprimmediacontrols.cpp | 16 +++++++++++----- indra/newview/llpanelprimmediacontrols.h | 2 +- indra/newview/llviewermediafocus.cpp | 28 ++++++++++++++++++++++++---- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index aca0e1d5c7..529912929d 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -782,8 +782,8 @@ void LLPanelPrimMediaControls::onClickClose() void LLPanelPrimMediaControls::close() { + resetZoomLevel(true); LLViewerMediaFocus::getInstance()->clearFocus(); - resetZoomLevel(); setVisible(FALSE); } @@ -921,8 +921,11 @@ void LLPanelPrimMediaControls::onClickSkipForward() void LLPanelPrimMediaControls::onClickZoom() { focusOnTarget(); - - nextZoomLevel(); + + if(mCurrentZoom == ZOOM_NONE) + { + nextZoomLevel(); + } } void LLPanelPrimMediaControls::nextZoomLevel() @@ -941,12 +944,15 @@ void LLPanelPrimMediaControls::nextZoomLevel() updateZoom(); } -void LLPanelPrimMediaControls::resetZoomLevel() +void LLPanelPrimMediaControls::resetZoomLevel(bool reset_camera) { if(mCurrentZoom != ZOOM_NONE) { mCurrentZoom = ZOOM_NONE; - updateZoom(); + if(reset_camera) + { + updateZoom(); + } } } diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h index 54fc4e343f..accfb72a04 100644 --- a/indra/newview/llpanelprimmediacontrols.h +++ b/indra/newview/llpanelprimmediacontrols.h @@ -58,7 +58,7 @@ public: void updateShape(); bool isMouseOver(); void nextZoomLevel(); - void resetZoomLevel(); + void resetZoomLevel(bool reset_camera = true); void close(); LLHandle getHandle() const { return mPanelHandle; } diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp index 70a7d835a3..fd74c9c2fc 100644 --- a/indra/newview/llviewermediafocus.cpp +++ b/indra/newview/llviewermediafocus.cpp @@ -120,10 +120,20 @@ void LLViewerMediaFocus::setFocusFace(LLPointer objectp, S32 fac // We must do this before processing the media HUD zoom, or it may zoom to the wrong face. update(); - if(mMediaControls.get() && face_auto_zoom && ! parcel->getMediaPreventCameraZoom()) + if(mMediaControls.get()) { - mMediaControls.get()->resetZoomLevel(); - mMediaControls.get()->nextZoomLevel(); + if(face_auto_zoom && ! parcel->getMediaPreventCameraZoom()) + { + // Zoom in on this face + mMediaControls.get()->resetZoomLevel(); + mMediaControls.get()->nextZoomLevel(); + } + else + { + // Reset the controls' zoom level without moving the camera. + // This fixes the case where clicking focus between two non-autozoom faces doesn't change the zoom-out button back to a zoom-in button. + mMediaControls.get()->resetZoomLevel(false); + } } } else @@ -132,7 +142,8 @@ void LLViewerMediaFocus::setFocusFace(LLPointer objectp, S32 fac { if(mMediaControls.get()) { - mMediaControls.get()->resetZoomLevel(); + // Don't reset camera zoom by default, just tell the controls they're no longer controlling zoom. + mMediaControls.get()->resetZoomLevel(false); } } @@ -292,6 +303,15 @@ BOOL LLViewerMediaFocus::handleKey(KEY key, MASK mask, BOOL called_from_parent) if (key == KEY_ESCAPE) { + // Reset camera zoom in this case. + if(mFocusedImplID.notNull()) + { + if(mMediaControls.get()) + { + mMediaControls.get()->resetZoomLevel(true); + } + } + clearFocus(); } } -- cgit v1.2.3