From 45826f839acb8ad432df4681c6abf3d55f8d6369 Mon Sep 17 00:00:00 2001 From: zhouhang95 <765229842@qq.com> Date: Thu, 28 Sep 2023 11:17:59 +0800 Subject: [PATCH 1/2] use-mid-button-wasd --- ui/zenoedit/viewport/cameracontrol.cpp | 10 +++++----- ui/zenoedit/viewport/cameracontrol.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/zenoedit/viewport/cameracontrol.cpp b/ui/zenoedit/viewport/cameracontrol.cpp index d7af0dcc5b..ce7c793b71 100644 --- a/ui/zenoedit/viewport/cameracontrol.cpp +++ b/ui/zenoedit/viewport/cameracontrol.cpp @@ -103,8 +103,8 @@ void CameraControl::fakeMousePressEvent(QMouseEvent *event) { ZASSERT_EXIT(m_zenovis); auto scene = m_zenovis->getSession()->get_scene(); - if (event->buttons() == Qt::RightButton) { - right_button_pressed = true; + if (event->buttons() == Qt::MiddleButton) { + middle_button_pressed = true; } if (scene->camera->m_need_sync) { scene->camera->m_need_sync = false; @@ -483,8 +483,8 @@ QVariant CameraControl::hitOnFloor(float x, float y) const { } void CameraControl::fakeMouseReleaseEvent(QMouseEvent *event) { - if (event->buttons() == Qt::RightButton) { - right_button_pressed = false; + if (event->buttons() == Qt::MiddleButton) { + middle_button_pressed = false; } if (event->button() == Qt::LeftButton) { @@ -637,7 +637,7 @@ void CameraControl::fakeMouseReleaseEvent(QMouseEvent *event) { } bool CameraControl::fakeKeyPressEvent(int uKey) { - if (!right_button_pressed) { + if (!middle_button_pressed) { return false; } float cos_t = cos(getTheta()); diff --git a/ui/zenoedit/viewport/cameracontrol.h b/ui/zenoedit/viewport/cameracontrol.h index ac597fe0ee..db3f10b544 100644 --- a/ui/zenoedit/viewport/cameracontrol.h +++ b/ui/zenoedit/viewport/cameracontrol.h @@ -65,7 +65,7 @@ class CameraControl : public QObject std::shared_ptr m_transformer; Zenovis* m_zenovis; - bool right_button_pressed = false; + bool middle_button_pressed = false; }; From b9fa237aa96bcd9172e4cb458528b1e20aa5dac7 Mon Sep 17 00:00:00 2001 From: zhouhang95 <765229842@qq.com> Date: Thu, 28 Sep 2023 11:32:21 +0800 Subject: [PATCH 2/2] fuck qt --- ui/zenoedit/viewport/cameracontrol.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/zenoedit/viewport/cameracontrol.cpp b/ui/zenoedit/viewport/cameracontrol.cpp index ce7c793b71..f9427ed9d5 100644 --- a/ui/zenoedit/viewport/cameracontrol.cpp +++ b/ui/zenoedit/viewport/cameracontrol.cpp @@ -103,7 +103,7 @@ void CameraControl::fakeMousePressEvent(QMouseEvent *event) { ZASSERT_EXIT(m_zenovis); auto scene = m_zenovis->getSession()->get_scene(); - if (event->buttons() == Qt::MiddleButton) { + if (event->button() == Qt::MiddleButton) { middle_button_pressed = true; } if (scene->camera->m_need_sync) { @@ -483,7 +483,7 @@ QVariant CameraControl::hitOnFloor(float x, float y) const { } void CameraControl::fakeMouseReleaseEvent(QMouseEvent *event) { - if (event->buttons() == Qt::MiddleButton) { + if (event->button() == Qt::MiddleButton) { middle_button_pressed = false; } if (event->button() == Qt::LeftButton) {