mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibGUI: Add GScrollableWidget::to_widget_position()
This is a complement to to_content_position() :^)
This commit is contained in:
parent
fc53867937
commit
33043941f9
Notes:
sideshowbarker
2024-07-19 11:44:40 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/33043941f97
2 changed files with 9 additions and 0 deletions
|
@ -188,3 +188,11 @@ Point GScrollableWidget::to_content_position(const Point& widget_position) const
|
|||
content_position.move_by(-frame_thickness(), -frame_thickness());
|
||||
return content_position;
|
||||
}
|
||||
|
||||
Point GScrollableWidget::to_widget_position(const Point& content_position) const
|
||||
{
|
||||
auto widget_position = content_position;
|
||||
widget_position.move_by(-horizontal_scrollbar().value(), -vertical_scrollbar().value());
|
||||
widget_position.move_by(frame_thickness(), frame_thickness());
|
||||
return widget_position;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
bool should_hide_unnecessary_scrollbars() const { return m_should_hide_unnecessary_scrollbars; }
|
||||
|
||||
Point to_content_position(const Point& widget_position) const;
|
||||
Point to_widget_position(const Point& content_position) const;
|
||||
|
||||
protected:
|
||||
explicit GScrollableWidget(GWidget* parent);
|
||||
|
|
Loading…
Add table
Reference in a new issue