From 70f48a0fa9c09cdcccd6f46f2d4c8a5c250d49cf Mon Sep 17 00:00:00 2001 From: Shuyan Hu Date: Tue, 26 Apr 2022 22:09:30 +0800 Subject: [PATCH] [Optimize] Fix editor camera is too sensitive for 4k monitor/screen --- engine/source/editor/source/editor_ui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/source/editor/source/editor_ui.cpp b/engine/source/editor/source/editor_ui.cpp index 120cbcd22..271063ec8 100644 --- a/engine/source/editor/source/editor_ui.cpp +++ b/engine/source/editor/source/editor_ui.cpp @@ -940,7 +940,7 @@ namespace Pilot if (!m_is_editor_mode) return; - constexpr float angularVelocity = 180.0f / 600.0f; // degrees/pixel + float angularVelocity = 180.0f / Math::max(m_engine_window_size.x, m_engine_window_size.y); // 180 degrees while moving full screen if (m_mouse_x >= 0.0f && m_mouse_y >= 0.0f) { if (m_io->isMouseButtonDown(GLFW_MOUSE_BUTTON_RIGHT)) @@ -1041,7 +1041,7 @@ namespace Pilot if (selected_object == nullptr) return; - constexpr float angularVelocity = 18.0f / 600.0f; + float angularVelocity = 18.0f / Math::max(m_engine_window_size.x, m_engine_window_size.y); // 18 degrees while moving full screen Vector2 delta_mouse_move_uv = {(new_mouse_pos_x - last_mouse_pos_x), (new_mouse_pos_y - last_mouse_pos_y)}; Vector3 model_scale;