mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 12:47:35 +00:00
LibGui: Add bounding of rubber band to IconView
This ensures the selection rubber band in icon views stays within the visible area.
This commit is contained in:
parent
2c0df5e7e7
commit
cc829ed9d2
1 changed files with 2 additions and 2 deletions
|
@ -246,9 +246,9 @@ void IconView::mouseup_event(MouseEvent& event)
|
||||||
AbstractView::mouseup_event(event);
|
AbstractView::mouseup_event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IconView::update_rubber_banding(const Gfx::IntPoint& position)
|
bool IconView::update_rubber_banding(const Gfx::IntPoint& input_position)
|
||||||
{
|
{
|
||||||
auto adjusted_position = to_content_position(position);
|
auto adjusted_position = to_content_position(input_position.constrained(widget_inner_rect()));
|
||||||
if (m_rubber_band_current != adjusted_position) {
|
if (m_rubber_band_current != adjusted_position) {
|
||||||
auto prev_rect = Gfx::IntRect::from_two_points(m_rubber_band_origin, m_rubber_band_current);
|
auto prev_rect = Gfx::IntRect::from_two_points(m_rubber_band_origin, m_rubber_band_current);
|
||||||
auto prev_rubber_band_fill_rect = prev_rect.shrunken(1, 1);
|
auto prev_rubber_band_fill_rect = prev_rect.shrunken(1, 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue