diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2018-12-07 17:10:05 +0200 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2018-12-07 17:10:05 +0200 |
commit | 6762c4515a9b0f98164d6efd191abec5ca4dd211 (patch) | |
tree | 8f6f88ec54a3e09babb65c263dff1b53e2960051 | |
parent | d4fe87cca49162c978b4eacde880431977624874 (diff) |
SL-1894 When crossing regions altitude slider could misbehave
-rw-r--r-- | indra/llui/llmultislider.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llmultislider.h | 3 | ||||
-rw-r--r-- | indra/llui/llmultisliderctrl.cpp | 11 | ||||
-rw-r--r-- | indra/llui/llmultisliderctrl.h | 2 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.cpp | 10 |
5 files changed, 28 insertions, 6 deletions
diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 9a7b6f9f6b..ed93b3d44c 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -354,17 +354,17 @@ const std::string& LLMultiSlider::addSlider(F32 val) return mCurSlider; } -void LLMultiSlider::addSlider(F32 val, const std::string& name) +bool LLMultiSlider::addSlider(F32 val, const std::string& name) { F32 initVal = val; if(mValue.size() >= mMaxNumSliders) { - return; + return false; } bool foundOne = findUnusedValue(initVal); if(!foundOne) { - return; + return false; } // add a new thumb rect @@ -383,6 +383,8 @@ void LLMultiSlider::addSlider(F32 val, const std::string& name) // move the slider setSliderValue(mCurSlider, initVal, TRUE); + + return true; } bool LLMultiSlider::findUnusedValue(F32& initVal) diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 52c6d1ddef..50cf62e9c5 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -96,7 +96,7 @@ public: bool findUnusedValue(F32& initVal); const std::string& addSlider(); const std::string& addSlider(F32 val); - void addSlider(F32 val, const std::string& name); + bool addSlider(F32 val, const std::string& name); void deleteSlider(const std::string& name); void deleteCurSlider() { deleteSlider(mCurSlider); } void clear(); @@ -109,6 +109,7 @@ public: S32 getMaxNumSliders() { return mMaxNumSliders; } S32 getCurNumSliders() { return mValue.size(); } + F32 getOverlapThreshold() { return mOverlapThreshold; } bool canAddSliders() { return mValue.size() < mMaxNumSliders; } protected: diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index 972567ef9b..20e2b569f1 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -293,6 +293,17 @@ const std::string& LLMultiSliderCtrl::addSlider(F32 val) return name; } +bool LLMultiSliderCtrl::addSlider(F32 val, const std::string& name) +{ + bool res = mMultiSlider->addSlider(val, name); + if (res) + { + mCurValue = mMultiSlider->getCurSliderValue(); + updateText(); + } + return res; +} + void LLMultiSliderCtrl::deleteSlider(const std::string& name) { mMultiSlider->deleteSlider(name); diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index c370ebf505..75715d6043 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -112,6 +112,7 @@ public: /// for adding and deleting sliders const std::string& addSlider(); const std::string& addSlider(F32 val); + bool addSlider(F32 val, const std::string& name); void deleteSlider(const std::string& name); void deleteCurSlider() { deleteSlider(mMultiSlider->getCurSlider()); } @@ -120,6 +121,7 @@ public: S32 getMaxNumSliders() { return mMultiSlider->getMaxNumSliders(); } S32 getCurNumSliders() { return mMultiSlider->getCurNumSliders(); } + F32 getOverlapThreshold() { return mMultiSlider->getOverlapThreshold(); } bool canAddSliders() { return mMultiSlider->canAddSliders(); } void setLabel(const std::string& label) { if (mLabelBox) mLabelBox->setText(label); } diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 04f281a40c..7abb05b6fb 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -255,13 +255,19 @@ void LLPanelEnvironmentInfo::refresh() LLEnvironment::altitude_list_t altitudes = LLEnvironment::instance().getRegionAltitudes(); if (altitudes.size() > 0) { + LLMultiSliderCtrl *sld = getChild<LLMultiSliderCtrl>(SLD_ALTITUDES); + sld->clear(); + for (S32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; ++idx) { - LLMultiSliderCtrl *sld = getChild<LLMultiSliderCtrl>(SLD_ALTITUDES); - sld->setSliderValue(alt_sliders[idx], altitudes[idx+1], FALSE); + sld->addSlider(altitudes[idx + 1], alt_sliders[idx]); updateAltLabel(alt_labels[idx], idx + 2, altitudes[idx+1]); mAltitudes[alt_sliders[idx]] = AltitudeData(idx+1, idx, altitudes[idx+1]); } + if (sld->getCurNumSliders() != ALTITUDE_SLIDER_COUNT) + { + LL_WARNS("ENVPANEL") << "Failed to add altitude sliders!" << LL_ENDL; + } readjustAltLabels(); } |