summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterhoverheight.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterhoverheight.cpp')
-rwxr-xr-xindra/newview/llfloaterhoverheight.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/indra/newview/llfloaterhoverheight.cpp b/indra/newview/llfloaterhoverheight.cpp
index 9efb168b55..2ac61efc0c 100755
--- a/indra/newview/llfloaterhoverheight.cpp
+++ b/indra/newview/llfloaterhoverheight.cpp
@@ -42,14 +42,16 @@ LLFloaterHoverHeight::LLFloaterHoverHeight(const LLSD& key) : LLFloater(key)
void LLFloaterHoverHeight::syncFromPreferenceSetting(void *user_data)
{
- LLVector3 offset = gSavedPerAccountSettings.getVector3("AvatarPosFinalOffset");
- F32 value = offset[2];
+ F32 value = gSavedPerAccountSettings.getF32("AvatarHoverOffsetZ");
LLFloaterHoverHeight *self = static_cast<LLFloaterHoverHeight*>(user_data);
LLSliderCtrl* sldrCtrl = self->getChild<LLSliderCtrl>("HoverHeightSlider");
sldrCtrl->setValue(value,FALSE);
+
if (isAgentAvatarValid())
{
+ LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z));
+ gAgentAvatarp->mHoverOffset = offset;
gAgentAvatarp->sendHoverHeight();
}
}
@@ -57,6 +59,8 @@ void LLFloaterHoverHeight::syncFromPreferenceSetting(void *user_data)
BOOL LLFloaterHoverHeight::postBuild()
{
LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider");
+ sldrCtrl->setMinValue(MIN_HOVER_Z);
+ sldrCtrl->setMaxValue(MAX_HOVER_Z);
sldrCtrl->setSliderMouseUpCallback(boost::bind(&LLFloaterHoverHeight::onFinalCommit,this));
sldrCtrl->setSliderEditorCommitCallback(boost::bind(&LLFloaterHoverHeight::onFinalCommit,this));
childSetCommitCallback("HoverHeightSlider", &LLFloaterHoverHeight::onSliderMoved, NULL);
@@ -64,13 +68,13 @@ BOOL LLFloaterHoverHeight::postBuild()
// Initialize slider from pref setting.
syncFromPreferenceSetting(this);
// Update slider on future pref changes.
- if (gSavedPerAccountSettings.getControl("AvatarPosFinalOffset"))
+ if (gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ"))
{
- gSavedPerAccountSettings.getControl("AvatarPosFinalOffset")->getCommitSignal()->connect(boost::bind(&syncFromPreferenceSetting, this));
+ gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ")->getCommitSignal()->connect(boost::bind(&syncFromPreferenceSetting, this));
}
else
{
- LL_WARNS() << "Control not found for AvatarPosFinalOffset" << LL_ENDL;
+ LL_WARNS() << "Control not found for AvatarHoverOffsetZ" << LL_ENDL;
}
return TRUE;
@@ -81,8 +85,7 @@ void LLFloaterHoverHeight::onSliderMoved(LLUICtrl* ctrl, void* userData)
{
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
F32 value = sldrCtrl->getValueF32();
- LLVector3 offset = gSavedPerAccountSettings.getVector3("AvatarPosFinalOffset");
- offset[2] = value;
+ LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z));
gAgentAvatarp->mHoverOffset = offset;
}
@@ -92,9 +95,7 @@ void LLFloaterHoverHeight::onFinalCommit()
{
LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider");
F32 value = sldrCtrl->getValueF32();
- LLVector3 offset = gSavedPerAccountSettings.getVector3("AvatarPosFinalOffset");
- offset[2] = value;
- gSavedPerAccountSettings.setVector3("AvatarPosFinalOffset",offset);
+ gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ",value);
}