@@ -151,16 +151,23 @@ Rect GScrollBar::lower_gutter_rect() const
151
151
int GScrollBar::scrubbable_range_in_pixels () const
152
152
{
153
153
if (orientation () == Orientation::Vertical)
154
- return height () - button_size () * 3 ;
154
+ return height () - button_size () * 2 - scrubber_size () ;
155
155
else
156
- return width () - button_size () * 3 ;
156
+ return width () - button_size () * 2 - scrubber_size () ;
157
157
}
158
158
159
159
bool GScrollBar::has_scrubber () const
160
160
{
161
161
return m_max != m_min;
162
162
}
163
163
164
+ int GScrollBar::scrubber_size () const
165
+ {
166
+ int pixel_range = (orientation () == Orientation::Vertical ? height () : width ()) - button_size () * 2 ;
167
+ int value_range = m_max - m_min;
168
+ return ::max (pixel_range - value_range, button_size ());
169
+ }
170
+
164
171
Rect GScrollBar::scrubber_rect () const
165
172
{
166
173
if (!has_scrubber ())
@@ -169,7 +176,7 @@ Rect GScrollBar::scrubber_rect() const
169
176
if (m_value == m_min)
170
177
x_or_y = button_size ();
171
178
else if (m_value == m_max)
172
- x_or_y = ((orientation () == Orientation::Vertical ? height () : width ()) - ( button_size () * 2 )) + 1 ;
179
+ x_or_y = ((orientation () == Orientation::Vertical ? height () : width ()) - button_size () - scrubber_size ( )) + 1 ;
173
180
else {
174
181
float range_size = m_max - m_min;
175
182
float available = scrubbable_range_in_pixels ();
@@ -178,9 +185,9 @@ Rect GScrollBar::scrubber_rect() const
178
185
}
179
186
180
187
if (orientation () == Orientation::Vertical)
181
- return { 0 , (int )x_or_y, button_size (), button_size () };
188
+ return { 0 , (int )x_or_y, button_size (), scrubber_size () };
182
189
else
183
- return { (int )x_or_y, 0 , button_size (), button_size () };
190
+ return { (int )x_or_y, 0 , scrubber_size (), button_size () };
184
191
}
185
192
186
193
void GScrollBar::paint_event (GPaintEvent& event)
0 commit comments