16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 00:49:19 +02:00

map set camera preset on middle click

This commit is contained in:
milek7
2020-10-21 20:39:20 +02:00
parent 003d234abb
commit 136e550ccc

View File

@@ -312,6 +312,13 @@ void ui::map_panel::render_contents()
Application.set_cursor_pos(surface_screen_center.x, surface_screen_center.y); Application.set_cursor_pos(surface_screen_center.x, surface_screen_center.y);
} }
if (FreeFlyModeFlag && ImGui::IsMouseClicked(2)) {
glm::vec3 world_pos = glm::inverse(transform) * glm::vec4(ndc_pos.x, 0.0f, -ndc_pos.y, 1.0f);
Global.FreeCameraInit[0].x = world_pos.x;
Global.FreeCameraInit[0].y = Global.pCamera.Pos.y;
Global.FreeCameraInit[0].z = world_pos.z;
}
if (mode == 0 && ImGui::IsMouseDragging(0)) if (mode == 0 && ImGui::IsMouseDragging(0))
{ {
ImVec2 delta_im = ImGui::GetMouseDragDelta(); ImVec2 delta_im = ImGui::GetMouseDragDelta();