bugfix: cycle mouse to the other side of the screen when using scrollbox (#5048)

* bugfix: cycle mouse to the other side of the screen when using scrollbox

Signed-off-by: Michael Pollind <mpollind@gmail.com>

* chore: added comments to SpinBox

Signed-off-by: Michael Pollind <mpollind@gmail.com>
This commit is contained in:
Michael Pollind
2021-11-03 13:31:56 -07:00
committed by GitHub
parent f0ba0ff7eb
commit 4277414268
@@ -657,13 +657,18 @@ bool SpinBoxWatcher::handleMouseDragStepping(QAbstractSpinBox* spinBox, QEvent*
QPoint screenPos = mouseEvent->screenPos().toPoint();
const int xPos = screenPos.x();
int newXPos = xPos;
// cursor bounces on the left and right side of the screen
// looks like buggy behaviour so mouse cursor is wrapped
// around to the other side of the screen.
if (xPos >= screenRect.right())
{
newXPos = screenRect.right() - 1;
// wraps mouse cursor around to the left side of the screen
newXPos = screenRect.left() + 1;
}
else if (xPos <= screenRect.left())
{
newXPos = screenRect.left() + 1;
// wraps mouse cursor around to the right side of the screen
newXPos = screenRect.right() - 1;
}
if (newXPos != xPos)