diff options
| author | Graham Linden <graham@lindenlab.com> | 2018-06-01 15:34:21 +0100 |
|---|---|---|
| committer | Graham Linden <graham@lindenlab.com> | 2018-06-01 15:34:21 +0100 |
| commit | 37e8fd20c3823482f3a15b4bfd544f7847070db8 (patch) | |
| tree | b31e3a1ef86431cda7703621f779b38a98c14a3e /indra/llui/llmultislider.cpp | |
| parent | 64302d3000b69b31e72eb6a3bd8a981c80cb88de (diff) | |
| parent | bd84cbfa11fbe2b3aa5ceba5978841310488b8e4 (diff) | |
Merge to 5.1.6
Diffstat (limited to 'indra/llui/llmultislider.cpp')
| -rw-r--r-- | indra/llui/llmultislider.cpp | 30 |
1 files changed, 22 insertions, 8 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); |
