summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-09-14 15:45:28 +0000
committerRider Linden <rider@lindenlab.com>2018-09-14 15:45:28 +0000
commit3dd286064e253097af696068940afe009acc0b2e (patch)
tree4a826c3f94f36ff849389976dd9c99d0551f8bb7
parent13efe74bc1fb993df569376a6081422d73f1ab1d (diff)
parent3988bc8d85e593926c16282d8bd5094060da654b (diff)
Merged in andreykproductengine/maint-eep (pull request #86)
SL-9653 Multy slider edge overlap cases Approved-by: Maxim Nikolenko <maximnproductengine@lindenlab.com>
-rw-r--r--indra/llui/llmultislider.cpp34
-rw-r--r--indra/newview/llenvironment.cpp9
2 files changed, 27 insertions, 16 deletions
diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp
index ef907e620e..c35b7c5496 100644
--- a/indra/llui/llmultislider.cpp
+++ b/indra/llui/llmultislider.cpp
@@ -177,13 +177,15 @@ void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from
// increment is our distance between points, use to eliminate round error
F32 threshold = mOverlapThreshold + (mIncrement / 4);
// If loop overlap is enabled, check if we overlap with points 'after' max value (project to lower)
- F32 loop_up_check = (mLoopOverlap && (value + threshold) > mMaxValue) ? (value + threshold - mMaxValue + mMinValue) : 0.0f;
+ F32 loop_up_check = (mLoopOverlap && (value + threshold) > mMaxValue) ? (value + threshold - mMaxValue + mMinValue) : mMinValue - 1.0f;
// If loop overlap is enabled, check if we overlap with points 'before' min value (project to upper)
- F32 loop_down_check = (mLoopOverlap && (value - threshold) < mMinValue) ? (value - threshold - mMinValue + mMaxValue) : 0.0f;
+ F32 loop_down_check = (mLoopOverlap && (value - threshold) < mMinValue) ? (value - threshold - mMinValue + mMaxValue) : mMaxValue + 1.0f;
- for(;mIt != mValue.endMap(); mIt++) {
-
- F32 testVal = (F32)mIt->second.asReal() - newValue;
+ for(;mIt != mValue.endMap(); mIt++)
+ {
+ F32 locationVal = (F32)mIt->second.asReal();
+ // Check nearby values
+ F32 testVal = locationVal - newValue;
if (testVal > -threshold
&& testVal < threshold
&& mIt->first != name)
@@ -191,17 +193,19 @@ void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from
hit = true;
break;
}
- if (loop_up_check != 0
- && testVal < loop_up_check)
- {
- hit = true;
- break;
- }
- if (loop_down_check != 0
- && testVal > loop_down_check)
+ if (mLoopOverlap)
{
- hit = true;
- break;
+ // Check edge overlap values
+ if (locationVal < loop_up_check)
+ {
+ hit = true;
+ break;
+ }
+ if (locationVal > loop_down_check)
+ {
+ hit = true;
+ break;
+ }
}
}
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 4b60ed4e68..6981203e75 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -1818,7 +1818,14 @@ LLSettingsBase::BlendFactor LLTrackBlenderLoopingManual::setPosition(const LLSet
F64 spanPos = ((mPosition < (*bounds.first).first) ? (mPosition + 1.0) : mPosition) - (*bounds.first).first;
- F64 blendf = fmod(spanPos, spanLength) / spanLength;
+ if (spanPos > spanLength)
+ {
+ // we are clamping position to 0-1 and spanLength is 1
+ // so don't account for case of spanPos == spanLength
+ spanPos = fmod(spanPos, spanLength);
+ }
+
+ F64 blendf = spanPos / spanLength;
return LLSettingsBlender::setBlendFactor(blendf);
}