Skip to content

Commit

Permalink
Properly initialize touch position for color pick
Browse files Browse the repository at this point in the history
In the case where there is only a touch begin event and no subsequent
movement, the touch position is now set to the beginning point properly
instead of leaving it stale.
  • Loading branch information
askmeaboutlo0m committed Sep 28, 2024
1 parent a93fe55 commit 54c3bf5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/desktop/utils/touchhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ void TouchHandler::handleTouchBegin(QTouchEvent *event)
int pointsCount = points.size();
QPointF posf = compat::touchPos(points.first());

m_touchPos = QPointF(0.0, 0.0);
for(const compat::TouchPoint &tp : compat::touchPoints(*event)) {
m_touchPos += compat::touchPos(tp);
}
m_touchPos /= pointsCount;

m_touchDrawBuffer.clear();
m_touchDragging = false;
m_touchRotating = false;
Expand Down

0 comments on commit 54c3bf5

Please sign in to comment.