Skip to content

Commit

Permalink
fix: game view error
Browse files Browse the repository at this point in the history
  • Loading branch information
barry-ran committed May 30, 2024
1 parent 5f03590 commit 3f1031a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/device/controller/inputconvert/inputconvertgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,16 @@ bool InputConvertGame::processMouseMove(const QMouseEvent *from)
return true;
}

if (!m_ctrlMouseMove.lastPos.isNull() && m_processMouseMove) {
QPointF distance_raw{from->localPos() - m_ctrlMouseMove.lastPos};
auto lastPos = m_ctrlMouseMove.lastPos;
m_ctrlMouseMove.lastPos = from->localPos();

if (m_ctrlMouseMove.ignoreCount > 0) {
--m_ctrlMouseMove.ignoreCount;
return true;
}

if (!lastPos.isNull() && m_processMouseMove) {
QPointF distance_raw{from->localPos() - lastPos};
QPointF speedRatio {m_keyMap.getMouseMoveMap().data.mouseMove.speedRatio};
QPointF distance {distance_raw.x() / speedRatio.x(), distance_raw.y() / speedRatio.y()};

Expand All @@ -579,13 +587,14 @@ bool InputConvertGame::processMouseMove(const QMouseEvent *from)
});
} else {
mouseMoveStopTouch();
mouseMoveStartTouch(from);
m_ctrlMouseMove.ignoreCount = 5;
return true;
}
}

sendTouchMoveEvent(getTouchID(Qt::ExtraButton24), m_ctrlMouseMove.lastConverPos);
}
m_ctrlMouseMove.lastPos = from->localPos();

return true;
}

Expand Down
1 change: 1 addition & 0 deletions src/device/controller/inputconvert/inputconvertgame.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ private slots:
bool touching = false;
int timer = 0;
bool smallEyes = false;
int ignoreCount = 0;
} m_ctrlMouseMove;

// for drag delay
Expand Down

0 comments on commit 3f1031a

Please sign in to comment.