summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2021-09-21 17:51:56 -0400
committerAndreas Kling <kling@serenityos.org>2021-09-22 21:35:42 +0200
commit3159e548a5971a24630053ff4fbe551324feaeb5 (patch)
tree3c9194fa3ef1fdf24b68a4c3c3663732da787d5a /Userland
parente8f3fda3cfe1de3be8be7cfdd4a1f00eb30dea49 (diff)
downloadserenity-3159e548a5971a24630053ff4fbe551324feaeb5.zip
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.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGUI/Scrollbar.cpp8
-rw-r--r--Userland/Libraries/LibGUI/Scrollbar.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibGUI/Scrollbar.cpp b/Userland/Libraries/LibGUI/Scrollbar.cpp
index c6867e7d94..4d9bf7c5c7 100644
--- a/Userland/Libraries/LibGUI/Scrollbar.cpp
+++ b/Userland/Libraries/LibGUI/Scrollbar.cpp
@@ -123,12 +123,12 @@ bool Scrollbar::has_scrubber() const
return max() != min();
}
-int Scrollbar::unclamped_scrubber_size() const
+float Scrollbar::unclamped_scrubber_size() const
{
- int pixel_range = length(orientation()) - button_size() * 2;
- int value_range = max() - min();
+ float pixel_range = length(orientation()) - button_size() * 2;
+ float value_range = max() - min();
- int scrubber_size = 0;
+ float scrubber_size { 0 };
if (value_range > 0) {
// Scrubber size should be proportional to the visible portion
// (page) in relation to the content (value range + page)
diff --git a/Userland/Libraries/LibGUI/Scrollbar.h b/Userland/Libraries/LibGUI/Scrollbar.h
index c9bff8f673..4e46264db5 100644
--- a/Userland/Libraries/LibGUI/Scrollbar.h
+++ b/Userland/Libraries/LibGUI/Scrollbar.h
@@ -48,7 +48,7 @@ private:
Gfx::IntRect decrement_button_rect() const;
Gfx::IntRect increment_button_rect() const;
Gfx::IntRect scrubber_rect() const;
- int unclamped_scrubber_size() const;
+ float unclamped_scrubber_size() const;
int visible_scrubber_size() const;
int scrubbable_range_in_pixels() const;
void on_automatic_scrolling_timer_fired();