mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:07:47 +00:00
LibGUI: Don't assert when hovering spacing around single-child Splitter
Fixes #1215.
This commit is contained in:
parent
fc562a3a93
commit
f88fe5dc3f
2 changed files with 7 additions and 6 deletions
|
@ -74,7 +74,7 @@ void Splitter::leave_event(Core::Event&)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Splitter::get_resize_candidates_at(const Gfx::Point& position, Widget*& first, Widget*& second)
|
bool Splitter::get_resize_candidates_at(const Gfx::Point& position, Widget*& first, Widget*& second)
|
||||||
{
|
{
|
||||||
int x_or_y = position.primary_offset_for_orientation(m_orientation);
|
int x_or_y = position.primary_offset_for_orientation(m_orientation);
|
||||||
int fudge = layout()->spacing();
|
int fudge = layout()->spacing();
|
||||||
|
@ -87,8 +87,7 @@ void Splitter::get_resize_candidates_at(const Gfx::Point& position, Widget*& fir
|
||||||
second = &child;
|
second = &child;
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
ASSERT(first);
|
return first && second;
|
||||||
ASSERT(second);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Splitter::mousedown_event(MouseEvent& event)
|
void Splitter::mousedown_event(MouseEvent& event)
|
||||||
|
@ -99,7 +98,8 @@ void Splitter::mousedown_event(MouseEvent& event)
|
||||||
|
|
||||||
Widget* first { nullptr };
|
Widget* first { nullptr };
|
||||||
Widget* second { nullptr };
|
Widget* second { nullptr };
|
||||||
get_resize_candidates_at(event.position(), first, second);
|
if (!get_resize_candidates_at(event.position(), first, second))
|
||||||
|
return;
|
||||||
|
|
||||||
m_first_resizee = first->make_weak_ptr();
|
m_first_resizee = first->make_weak_ptr();
|
||||||
m_second_resizee = second->make_weak_ptr();
|
m_second_resizee = second->make_weak_ptr();
|
||||||
|
@ -128,7 +128,8 @@ void Splitter::mousemove_event(MouseEvent& event)
|
||||||
if (!m_resizing) {
|
if (!m_resizing) {
|
||||||
Widget* first { nullptr };
|
Widget* first { nullptr };
|
||||||
Widget* second { nullptr };
|
Widget* second { nullptr };
|
||||||
get_resize_candidates_at(event.position(), first, second);
|
if (!get_resize_candidates_at(event.position(), first, second))
|
||||||
|
return;
|
||||||
recompute_grabbable_rect(*first, *second);
|
recompute_grabbable_rect(*first, *second);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void recompute_grabbable_rect(const Widget&, const Widget&);
|
void recompute_grabbable_rect(const Widget&, const Widget&);
|
||||||
void get_resize_candidates_at(const Gfx::Point&, Widget*&, Widget*&);
|
bool get_resize_candidates_at(const Gfx::Point&, Widget*&, Widget*&);
|
||||||
|
|
||||||
Orientation m_orientation;
|
Orientation m_orientation;
|
||||||
bool m_resizing { false };
|
bool m_resizing { false };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue