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.
meow-7.2.2
Monroe Linden 2009-11-20 17:49:52 -08:00
parent 8f451be20e
commit 1b07c1d7fb
3 changed files with 36 additions and 10 deletions

View File

@ -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();
}
}
}

View File

@ -58,7 +58,7 @@ public:
void updateShape();
bool isMouseOver();
void nextZoomLevel();
void resetZoomLevel();
void resetZoomLevel(bool reset_camera = true);
void close();
LLHandle<LLPanelPrimMediaControls> getHandle() const { return mPanelHandle; }

View File

@ -120,10 +120,20 @@ void LLViewerMediaFocus::setFocusFace(LLPointer<LLViewerObject> 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<LLViewerObject> 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();
}
}