Merged in andreykproductengine/maint-eep (pull request #86)

SL-9653 Multy slider edge overlap cases

Approved-by: Maxim Nikolenko <maximnproductengine@lindenlab.com>
meow-7.2.2
Rider Linden 2018-09-14 15:45:28 +00:00
commit 3dd286064e
2 changed files with 27 additions and 16 deletions

View File

@ -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)
if (mLoopOverlap)
{
hit = true;
break;
}
if (loop_down_check != 0
&& testVal > loop_down_check)
{
hit = true;
break;
// Check edge overlap values
if (locationVal < loop_up_check)
{
hit = true;
break;
}
if (locationVal > loop_down_check)
{
hit = true;
break;
}
}
}

View File

@ -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);
}