mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-16 23:31:55 +00:00
LibGUI: Implement automatic scrolling in AbstractView
This adds automatic scrolling when dragging items in TreeViews and other widgets that inherit from AbstractView when the overloaded accepts_drag() returns true. This is implemented in FileSystemModel to allow directories and files to be dragged.
This commit is contained in:
parent
53cfc6ec9f
commit
d660e86d13
Notes:
sideshowbarker
2024-07-18 03:19:50 +09:00
Author: https://github.com/metmo
Commit: d660e86d13
Pull-request: https://github.com/SerenityOS/serenity/pull/10150
6 changed files with 45 additions and 7 deletions
|
@ -460,4 +460,14 @@ bool AbstractTableView::is_navigation(GUI::KeyEvent& event)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Gfx::IntPoint AbstractTableView::automatic_scroll_delta_from_position(const Gfx::IntPoint& pos) const
|
||||
{
|
||||
if (pos.y() > column_header().height() + autoscroll_threshold())
|
||||
return AbstractScrollableWidget::automatic_scroll_delta_from_position(pos);
|
||||
|
||||
Gfx::IntPoint position_excluding_header = { pos.x(), pos.y() - column_header().height() };
|
||||
return AbstractScrollableWidget::automatic_scroll_delta_from_position(position_excluding_header);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue