From 65fd232e102ff89564d5417771e94bed3d1d31c7 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 18 Nov 2021 00:01:19 +0100 Subject: 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 --- src/QuickMedia.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/QuickMedia.cpp') 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)); } -- cgit v1.2.3