sliderladder: don't switch rungs if wrapped around screen

This commit is contained in:
itsmattkc
2022-01-06 09:42:29 -08:00
parent 2831f6508b
commit 8dbcbea891
2 changed files with 5 additions and 1 deletions
+4 -1
View File
@@ -79,6 +79,7 @@ SliderLadder::SliderLadder(double drag_multiplier, int nb_outer_values, QString
if (UsingLadders()) {
drag_start_x_ = -1;
wrap_count_ = 0;
} else {
#if defined(Q_OS_MAC)
CGAssociateMouseAndMouseCursorPosition(false);
@@ -145,7 +146,7 @@ void SliderLadder::TimerUpdate()
if (UsingLadders()) {
bool is_under_mouse = (now_pos >= ladder_left && now_pos <= ladder_right);
bool is_under_mouse = (now_pos >= ladder_left && now_pos <= ladder_right && wrap_count_ == 0);
if (drag_start_x_ != -1 && (is_under_mouse
|| (drag_start_x_ < ladder_left && now_pos > ladder_right)
@@ -202,8 +203,10 @@ void SliderLadder::TimerUpdate()
}
if (now_pos == left || now_pos == right) {
if (now_pos == left) {
wrap_count_--;
now_pos = right-1;
} else {
wrap_count_++;
now_pos = left+1;
}
QCursor::setPos(now_pos, QCursor::pos().y());
+1
View File
@@ -87,6 +87,7 @@ private:
int drag_start_x_;
int drag_start_y_;
int wrap_count_;
QList<SliderLadderElement*> elements_;