Skip to content

Commit

Permalink
Fix right handle behavior on click
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus authored Apr 2, 2020
1 parent b3e381f commit cfa0c9d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions RangeSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,14 @@ void RangeSlider::mousePressEvent(QMouseEvent* aEvent)
mDelta = posValue - (secondHandleRectPosValue + scHandleSideLength / 2);
}

if(posCheck >= 2
&& posCheck <= posMax - 2)
else if(posCheck >= 2
&& posCheck <= posMax - 2)
{
int step = mInterval / 10 < 1 ? 1 : mInterval / 10;
if(posValue < firstHandleRectPosValue)
setLowerValue(mLowerValue - step);
else if(posValue > secondHandleRectPosValue + scHandleSideLength)
setUpperValue(mUpperValue + step);
else if(((posValue > firstHandleRectPosValue + scHandleSideLength) || !type.testFlag(LeftHandle))
&& ((posValue < secondHandleRectPosValue) || !type.testFlag(RightHandle)))
{
Expand All @@ -157,9 +159,7 @@ void RangeSlider::mousePressEvent(QMouseEvent* aEvent)
setLowerValue((mLowerValue + step < mUpperValue) ? mLowerValue + step : mUpperValue);
else if(type.testFlag(RightHandle))
setUpperValue((mUpperValue - step > mLowerValue) ? mUpperValue - step : mLowerValue);
}
else if(posValue > secondHandleRectPosValue + scHandleSideLength)
setUpperValue(mUpperValue + step);
}
}
}
}
Expand Down

0 comments on commit cfa0c9d

Please sign in to comment.