summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
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);