cellGem: fix mouse positions

This commit is contained in:
Megamouse 2021-07-30 15:55:50 +02:00
parent ccb7531289
commit dd7f24b20e
5 changed files with 98 additions and 56 deletions

View file

@ -122,11 +122,11 @@ void basic_mouse_handler::MouseMove(QMouseEvent* event)
{
if (is_time_for_update())
{
// get the screen dimensions
const QSize screen = m_target->size();
if (m_target && m_target->isActive() && get_mouse_lock_state())
{
// get the screen dimensions
const QSize screen = m_target->size();
// get the center of the screen in global coordinates
QPoint p_center = m_target->geometry().topLeft() + QPoint(screen.width() / 2, screen.height() / 2);
@ -147,11 +147,11 @@ void basic_mouse_handler::MouseMove(QMouseEvent* event)
p_real.setY(std::clamp(p_real.y() + p_delta.y(), 0, screen.height()));
// pass the 'real' position and the current delta to the screen center
MouseHandlerBase::Move(p_real.x(), p_real.y(), true, p_delta.x(), p_delta.y());
MouseHandlerBase::Move(p_real.x(), p_real.y(), screen.width(), screen.height(), true, p_delta.x(), p_delta.y());
}
else
{
MouseHandlerBase::Move(event->x(), event->y());
MouseHandlerBase::Move(event->x(), event->y(), screen.width(), screen.height());
}
}
}