diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2022-08-05 06:25:56 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-08-05 13:54:18 +0200 |
commit | 6f2a304971e18f1f4540a69ed793b963e3f89593 (patch) | |
tree | ecf441466daab81691365bc5189b6b0629b55fcc /Userland/Libraries | |
parent | aaa4f6d2870454acb6e74e1f8db898ec0439a3d4 (diff) | |
download | serenity-6f2a304971e18f1f4540a69ed793b963e3f89593.zip |
LibGUI: Calculate maximum primary size for Splitter resizees
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibGUI/Splitter.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Splitter.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Splitter.cpp b/Userland/Libraries/LibGUI/Splitter.cpp index ade4ab746f..6e442cfc57 100644 --- a/Userland/Libraries/LibGUI/Splitter.cpp +++ b/Userland/Libraries/LibGUI/Splitter.cpp @@ -139,6 +139,12 @@ void Splitter::mousedown_event(MouseEvent& event) m_first_resizee_start_size = m_first_resizee->size(); m_second_resizee_start_size = m_second_resizee->size(); m_resize_origin = event.position(); + + VERIFY(layout()); + auto spacer = layout()->spacing(); + auto splitter = size().primary_size_for_orientation(m_orientation); + m_first_resizee_max_size = splitter - spacer - m_second_resizee->calculated_min_size().value_or({ 0, 0 }).primary_size_for_orientation(m_orientation).as_int(); + m_second_resizee_max_size = splitter - spacer - m_first_resizee->calculated_min_size().value_or({ 0, 0 }).primary_size_for_orientation(m_orientation).as_int(); } Gfx::IntRect Splitter::rect_between_widgets(GUI::Widget const& first_widget, GUI::Widget const& second_widget, bool honor_grabbable_margins) const diff --git a/Userland/Libraries/LibGUI/Splitter.h b/Userland/Libraries/LibGUI/Splitter.h index c48e82e2c0..82ad1e676e 100644 --- a/Userland/Libraries/LibGUI/Splitter.h +++ b/Userland/Libraries/LibGUI/Splitter.h @@ -59,6 +59,8 @@ private: int m_second_resizee_minimum_size { 0 }; FixedResizee m_fixed_resizee { FixedResizee::First }; size_t m_last_child_count { 0 }; + int m_first_resizee_max_size { 0 }; + int m_second_resizee_max_size { 0 }; void recompute_grabbables(); |