diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-11-18 00:01:19 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-11-18 00:01:19 +0100 |
commit | 65fd232e102ff89564d5417771e94bed3d1d31c7 (patch) | |
tree | 5e3a159d94a7cc06f7f1807c9b42f3c7218743c6 /src/QuickMedia.cpp | |
parent | 4430b3b0be46f4da389a42cf2e871c05188a159d (diff) |
Fix window not being visible on kde because color map is deleted while the window is in use, text editing not working for the first character
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r-- | src/QuickMedia.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index c735f55..a9eab08 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -3794,14 +3794,6 @@ namespace QuickMedia { mgl::vec2i prev_mouse_pos; }; - static mgl::vec2f to_vec2f(mgl::vec2i vec) { - return mgl::vec2f(vec.x, vec.y); - } - - static mgl::vec2f to_vec2f(mgl::vec2u vec) { - return mgl::vec2f(vec.x, vec.y); - } - static mgl::vec2f floor(mgl::vec2f vec) { return { std::floor(vec.x), std::floor(vec.y) }; } @@ -4052,7 +4044,7 @@ namespace QuickMedia { navigation_stage = NavigationStage::VIEWING_ATTACHED_IMAGE; image_control.zoom = 1.0f; - image_control.offset = to_vec2f(attached_image_texture->get_size()) * 0.5f; + image_control.offset = attached_image_texture->get_size().to_vec2f() * 0.5f; image_control.pressed = window.is_mouse_button_pressed(mgl::Mouse::Left); image_control.pressed = false; @@ -4208,14 +4200,14 @@ namespace QuickMedia { const mgl::vec2i mouse_diff = mgl::vec2i(event.mouse_move.x, event.mouse_move.y) - image_control.prev_mouse_pos; image_control.prev_mouse_pos.x = event.mouse_move.x; image_control.prev_mouse_pos.y = event.mouse_move.y; - image_control.offset -= (to_vec2f(mouse_diff) / image_control.zoom); + image_control.offset -= (mouse_diff.to_vec2f() / image_control.zoom); image_control.moved = true; idle_active_handler(); } else if(event.type == mgl::Event::KeyPressed) { if(event.key.code == mgl::Keyboard::W) { image_control.zoom = 1.0f; image_control.moved = false; - image_control.offset = to_vec2f(attached_image_texture->get_size()) * 0.5f; + image_control.offset = attached_image_texture->get_size().to_vec2f() * 0.5f; attached_image_sprite.set_origin(mgl::vec2f(0.0f, 0.0f)); attached_image_sprite.set_scale(mgl::vec2f(1.0f, 1.0f)); } |