DEV-42827: auto-hide media controls volume slider if neither it nor mute button has the mouse over it

Review #66
fade-out was going to be harder, but just making it visible/invisible turned out to be pretty easy
meow-7.2.2
Rick Pasetto 2009-12-16 15:03:21 -08:00
parent a9948da80a
commit e1b712a3a6
3 changed files with 20 additions and 6 deletions

View File

@ -96,7 +96,7 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
mTargetObjectNormal(LLVector3::zero),
mZoomObjectID(LLUUID::null),
mZoomObjectFace(0),
mVolumeSliderVisible(false)
mVolumeSliderVisible(0)
{
mCommitCallbackRegistrar.add("MediaCtrl.Close", boost::bind(&LLPanelPrimMediaControls::onClickClose, this));
mCommitCallbackRegistrar.add("MediaCtrl.Back", boost::bind(&LLPanelPrimMediaControls::onClickBack, this));
@ -116,6 +116,7 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
mCommitCallbackRegistrar.add("MediaCtrl.Volume", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeSlider, this));
mCommitCallbackRegistrar.add("MediaCtrl.ToggleMute", boost::bind(&LLPanelPrimMediaControls::onToggleMute, this));
mCommitCallbackRegistrar.add("MediaCtrl.ShowVolumeSlider", boost::bind(&LLPanelPrimMediaControls::showVolumeSlider, this));
mCommitCallbackRegistrar.add("MediaCtrl.HideVolumeSlider", boost::bind(&LLPanelPrimMediaControls::hideVolumeSlider, this));
mCommitCallbackRegistrar.add("MediaCtrl.SkipBack", boost::bind(&LLPanelPrimMediaControls::onClickSkipBack, this));
mCommitCallbackRegistrar.add("MediaCtrl.SkipForward", boost::bind(&LLPanelPrimMediaControls::onClickSkipForward, this));
@ -372,8 +373,8 @@ void LLPanelPrimMediaControls::updateShape()
mVolumeUpCtrl->setVisible(has_focus);
mVolumeDownCtrl->setVisible(has_focus);
mVolumeCtrl->setEnabled(has_focus);
mVolumeSliderCtrl->setEnabled(has_focus && mVolumeSliderVisible);
mVolumeSliderCtrl->setVisible(has_focus && mVolumeSliderVisible);
mVolumeSliderCtrl->setEnabled(has_focus && mVolumeSliderVisible > 0);
mVolumeSliderCtrl->setVisible(has_focus && mVolumeSliderVisible > 0);
mWhitelistIcon->setVisible(false);
mSecureLockIcon->setVisible(false);
@ -714,7 +715,7 @@ void LLPanelPrimMediaControls::draw()
setVisible(FALSE);
mClearFaceOnFade = false;
mVolumeSliderVisible = false;
mVolumeSliderVisible = 0;
mTargetImplID = LLUUID::null;
mTargetObjectID = LLUUID::null;
mTargetObjectFace = 0;
@ -1267,5 +1268,11 @@ void LLPanelPrimMediaControls::onToggleMute()
void LLPanelPrimMediaControls::showVolumeSlider()
{
mVolumeSliderVisible = true;
mVolumeSliderVisible++;
}
void LLPanelPrimMediaControls::hideVolumeSlider()
{
mVolumeSliderVisible--;
}

View File

@ -110,6 +110,7 @@ private:
void onCommitVolumeSlider();
void onToggleMute();
void showVolumeSlider();
void hideVolumeSlider();
static void onScrollUp(void* user_data);
static void onScrollUpHeld(void* user_data);
@ -204,7 +205,7 @@ private:
LLUUID mZoomObjectID;
S32 mZoomObjectFace;
bool mVolumeSliderVisible;
S32 mVolumeSliderVisible;
};
#endif // LL_PANELPRIMMEDIACONTROLS_H

View File

@ -399,6 +399,8 @@
function="MediaCtrl.ToggleMute" />
<button.mouseenter_callback
function="MediaCtrl.ShowVolumeSlider" />
<button.mouseleave_callback
function="MediaCtrl.HideVolumeSlider" />
</button>
<slider
orientation="vertical"
@ -414,6 +416,10 @@
volume="true">
<slider.commit_callback
function="MediaCtrl.Volume"/>
<slider.mouseenter_callback
function="MediaCtrl.ShowVolumeSlider" />
<slider.mouseleave_callback
function="MediaCtrl.HideVolumeSlider" />
</slider>
</layout_panel>
<panel