summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-06-01 15:34:21 +0100
committerGraham Linden <graham@lindenlab.com>2018-06-01 15:34:21 +0100
commit37e8fd20c3823482f3a15b4bfd544f7847070db8 (patch)
treeb31e3a1ef86431cda7703621f779b38a98c14a3e /indra/llui
parent64302d3000b69b31e72eb6a3bd8a981c80cb88de (diff)
parentbd84cbfa11fbe2b3aa5ceba5978841310488b8e4 (diff)
Merge to 5.1.6
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llmultislider.cpp30
-rw-r--r--indra/llui/llmultislider.h1
-rw-r--r--indra/llui/llmultisliderctrl.h4
3 files changed, 26 insertions, 9 deletions
diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp
index 93045a6578..5cfe79267f 100644
--- a/indra/llui/llmultislider.cpp
+++ b/indra/llui/llmultislider.cpp
@@ -210,6 +210,19 @@ void LLMultiSlider::setCurSlider(const std::string& name)
}
}
+F32 LLMultiSlider::getSliderValueFromX(S32 xpos) const
+{
+ S32 left_edge = mThumbWidth / 2;
+ S32 right_edge = getRect().getWidth() - (mThumbWidth / 2);
+
+ xpos += mMouseOffset;
+ xpos = llclamp(xpos, left_edge, right_edge);
+
+ F32 t = F32(xpos - left_edge) / (right_edge - left_edge);
+
+ return((t * (mMaxValue - mMinValue)) + mMinValue);
+}
+
void LLMultiSlider::resetCurSlider()
{
mCurSlider = LLStringUtil::null;
@@ -359,14 +372,15 @@ BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask)
{
if( gFocusMgr.getMouseCapture() == this )
{
- S32 left_edge = mThumbWidth/2;
- S32 right_edge = getRect().getWidth() - (mThumbWidth/2);
-
- x += mMouseOffset;
- x = llclamp( x, left_edge, right_edge );
-
- F32 t = F32(x - left_edge) / (right_edge - left_edge);
- setCurSliderValue(t * (mMaxValue - mMinValue) + mMinValue );
+// S32 left_edge = mThumbWidth/2;
+// S32 right_edge = getRect().getWidth() - (mThumbWidth/2);
+//
+// x += mMouseOffset;
+// x = llclamp( x, left_edge, right_edge );
+//
+// F32 t = F32(x - left_edge) / (right_edge - left_edge);
+// setCurSliderValue(t * (mMaxValue - mMinValue) + mMinValue );
+ setCurSliderValue(getSliderValueFromX(x));
onCommit();
getWindow()->setCursor(UI_CURSOR_ARROW);
diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h
index 927063a5fd..0177597da2 100644
--- a/indra/llui/llmultislider.h
+++ b/indra/llui/llmultislider.h
@@ -72,6 +72,7 @@ public:
virtual ~LLMultiSlider();
void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE);
F32 getSliderValue(const std::string& name) const;
+ F32 getSliderValueFromX(S32 xpos) const;
const std::string& getCurSlider() const { return mCurSlider; }
F32 getCurSliderValue() const { return getSliderValue(mCurSlider); }
diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h
index 84378ff7b2..5c4777ebd0 100644
--- a/indra/llui/llmultisliderctrl.h
+++ b/indra/llui/llmultisliderctrl.h
@@ -74,7 +74,7 @@ protected:
public:
virtual ~LLMultiSliderCtrl();
- F32 getSliderValue(const std::string& name) const;
+ F32 getSliderValue(const std::string& name) const { return mMultiSlider->getSliderValue(name); }
void setSliderValue(const std::string& name, F32 v, BOOL from_event = FALSE);
virtual void setValue(const LLSD& value );
@@ -99,6 +99,8 @@ public:
void setMaxValue(F32 max_value) {mMultiSlider->setMaxValue(max_value);}
void setIncrement(F32 increment) {mMultiSlider->setIncrement(increment);}
+ F32 getSliderValueFromX(S32 x) const { return mMultiSlider->getSliderValueFromX(x); }
+
/// for adding and deleting sliders
const std::string& addSlider();
const std::string& addSlider(F32 val);