on xenial help sign in
fix off by one error in the corners
5d291b2Lukáš Tinkl
plugins/Cursor/MousePointer.cpp+3−3
@@ -58,13 +58,13 @@ void MousePointer::handleMouseEvent(ulong timestamp, QPointF movement, Qt::Mouse
58 if (newX < 0 && newY < m_panelHeight) { // top left corner
58 if (newX < 0 && newY < m_panelHeight) { // top left corner
59 const auto distance = qSqrt(qPow(newX, 2) + qPow(newY-m_panelHeight, 2));
59 const auto distance = qSqrt(qPow(newX, 2) + qPow(newY-m_panelHeight, 2));
60 Q_EMIT pushedTopLeftCorner(qAbs(distance), buttons);
60 Q_EMIT pushedTopLeftCorner(qAbs(distance), buttons);
61− } else if (newX >= sceneWidth && newY < m_panelHeight) { // top right corner
61+ } else if (newX >= sceneWidth-1 && newY < m_panelHeight) { // top right corner
62 const auto distance = qSqrt(qPow(newX-sceneWidth, 2) + qPow(newY-m_panelHeight, 2));
62 const auto distance = qSqrt(qPow(newX-sceneWidth, 2) + qPow(newY-m_panelHeight, 2));
63 Q_EMIT pushedTopRightCorner(qAbs(distance), buttons);
63 Q_EMIT pushedTopRightCorner(qAbs(distance), buttons);
64− } else if (newX < 0 && newY >= sceneHeight) { // bottom left corner
64+ } else if (newX < 0 && newY >= sceneHeight-1) { // bottom left corner
65 const auto distance = qSqrt(qPow(newX, 2) + qPow(newY-sceneHeight, 2));
65 const auto distance = qSqrt(qPow(newX, 2) + qPow(newY-sceneHeight, 2));
66 Q_EMIT pushedBottomLeftCorner(qAbs(distance), buttons);
66 Q_EMIT pushedBottomLeftCorner(qAbs(distance), buttons);
67− } else if (newX >= sceneWidth && newY >= sceneHeight) { // bottom right corner
67+ } else if (newX >= sceneWidth-1 && newY >= sceneHeight-1) { // bottom right corner
68 const auto distance = qSqrt(qPow(newX-sceneWidth, 2) + qPow(newY-sceneHeight, 2));
68 const auto distance = qSqrt(qPow(newX-sceneWidth, 2) + qPow(newY-sceneHeight, 2));
69 Q_EMIT pushedBottomRightCorner(qAbs(distance), buttons);
69 Q_EMIT pushedBottomRightCorner(qAbs(distance), buttons);
70 } else if (newX < 0) { // left edge
70 } else if (newX < 0) { // left edge