fill3: Cope with negative interval fractions in scrollbars
This commit is contained in:
parent
34130e2506
commit
b9455f393d
1 changed files with 3 additions and 2 deletions
|
|
@ -185,9 +185,10 @@ class ScrollBar:
|
||||||
width, height = dimensions
|
width, height = dimensions
|
||||||
assert width == 1 or height == 1, (width, height)
|
assert width == 1 or height == 1, (width, height)
|
||||||
length = width if self._is_horizontal else height
|
length = width if self._is_horizontal else height
|
||||||
assert all(0 <= fraction <= 1 for fraction in self.interval), self.interval
|
interval = [abs(fraction) for fraction in self.interval]
|
||||||
|
assert all(0 <= fraction <= 1 for fraction in interval), interval
|
||||||
(start_index, start_remainder), (end_index, end_remainder) = \
|
(start_index, start_remainder), (end_index, end_remainder) = \
|
||||||
[divmod(fraction * length * 8, 8) for fraction in self.interval]
|
[divmod(fraction * length * 8, 8) for fraction in interval]
|
||||||
start_index, end_index = int(start_index), int(end_index)
|
start_index, end_index = int(start_index), int(end_index)
|
||||||
start_remainder, end_remainder = int(start_remainder), int(end_remainder)
|
start_remainder, end_remainder = int(start_remainder), int(end_remainder)
|
||||||
if start_index == end_index:
|
if start_index == end_index:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue