mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-21 13:25:45 +00:00
Add mouse panning
This commit is contained in:
parent
1c784618b5
commit
c7cae8769f
11 changed files with 149 additions and 38 deletions
|
@ -405,12 +405,17 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
|
|||
if (event->source() == Qt::MouseEventSynthesizedBySystem) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto pos = event->pos();
|
||||
const auto [x, y] = ScaleTouch(pos);
|
||||
input_subsystem->GetMouse()->MouseMove(x, y);
|
||||
const int center_x = width() / 2;
|
||||
const int center_y = height() / 2;
|
||||
input_subsystem->GetMouse()->MouseMove(x, y, center_x, center_y);
|
||||
this->TouchMoved(x, y, 0);
|
||||
|
||||
if (Settings::values.mouse_panning) {
|
||||
QCursor::setPos(mapToGlobal({center_x, center_y}));
|
||||
}
|
||||
|
||||
emit MouseActivity();
|
||||
}
|
||||
|
||||
|
@ -727,6 +732,11 @@ void GRenderWindow::showEvent(QShowEvent* event) {
|
|||
|
||||
bool GRenderWindow::eventFilter(QObject* object, QEvent* event) {
|
||||
if (event->type() == QEvent::HoverMove) {
|
||||
if (Settings::values.mouse_panning) {
|
||||
auto* hover_event = static_cast<QMouseEvent*>(event);
|
||||
mouseMoveEvent(hover_event);
|
||||
return false;
|
||||
}
|
||||
emit MouseActivity();
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue