mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 18:50:50 +00:00
LibGUI: Calculate unclamped_scrubber_size() as float
Large enough content ranges produced unclamped scrubbers sized zero, effectively clamped by their integer type. This led to zero sized page_increments and scrubbers which didn't budge on gutter events. This fixes broken gutters in FontEditor and TextEditor for large files.
This commit is contained in:
parent
e8f3fda3cf
commit
3159e548a5
Notes:
sideshowbarker
2024-07-18 03:33:32 +09:00
Author: https://github.com/thankyouverycool
Commit: 3159e548a5
Pull-request: https://github.com/SerenityOS/serenity/pull/10175
2 changed files with 5 additions and 5 deletions
|
@ -123,12 +123,12 @@ bool Scrollbar::has_scrubber() const
|
||||||
return max() != min();
|
return max() != min();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Scrollbar::unclamped_scrubber_size() const
|
float Scrollbar::unclamped_scrubber_size() const
|
||||||
{
|
{
|
||||||
int pixel_range = length(orientation()) - button_size() * 2;
|
float pixel_range = length(orientation()) - button_size() * 2;
|
||||||
int value_range = max() - min();
|
float value_range = max() - min();
|
||||||
|
|
||||||
int scrubber_size = 0;
|
float scrubber_size { 0 };
|
||||||
if (value_range > 0) {
|
if (value_range > 0) {
|
||||||
// Scrubber size should be proportional to the visible portion
|
// Scrubber size should be proportional to the visible portion
|
||||||
// (page) in relation to the content (value range + page)
|
// (page) in relation to the content (value range + page)
|
||||||
|
|
|
@ -48,7 +48,7 @@ private:
|
||||||
Gfx::IntRect decrement_button_rect() const;
|
Gfx::IntRect decrement_button_rect() const;
|
||||||
Gfx::IntRect increment_button_rect() const;
|
Gfx::IntRect increment_button_rect() const;
|
||||||
Gfx::IntRect scrubber_rect() const;
|
Gfx::IntRect scrubber_rect() const;
|
||||||
int unclamped_scrubber_size() const;
|
float unclamped_scrubber_size() const;
|
||||||
int visible_scrubber_size() const;
|
int visible_scrubber_size() const;
|
||||||
int scrubbable_range_in_pixels() const;
|
int scrubbable_range_in_pixels() const;
|
||||||
void on_automatic_scrolling_timer_fired();
|
void on_automatic_scrolling_timer_fired();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue