Skip to content

Commit 65ee7e5

Browse files
committed
fix linter
1 parent 784909a commit 65ee7e5

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

arcade/gui/experimental/scroll_area.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
Property,
1111
Surface,
1212
UIEvent,
13+
UIKeyPressEvent,
1314
UILayout,
1415
UIMouseDragEvent,
1516
UIMouseEvent,
@@ -18,7 +19,7 @@
1819
UIMouseReleaseEvent,
1920
UIMouseScrollEvent,
2021
UIWidget,
21-
bind, UIKeyPressEvent,
22+
bind,
2223
)
2324
from arcade.types import LBWH
2425

@@ -103,12 +104,16 @@ def on_event(self, event: UIEvent) -> Optional[bool]:
103104
print(self._scroll_bar_size())
104105

105106
return EVENT_UNHANDLED
106-
107+
107108
def _scroll_bar_size(self):
108109
# based on: https://stackoverflow.com/a/16367035
109110

110-
content_size = self.scroll_area.surface.height if self.vertical else self.scroll_area.surface.width
111-
view_size = self.scroll_area.content_height if self.vertical else self.scroll_area.content_width
111+
content_size = (
112+
self.scroll_area.surface.height if self.vertical else self.scroll_area.surface.width
113+
)
114+
view_size = (
115+
self.scroll_area.content_height if self.vertical else self.scroll_area.content_width
116+
)
112117
ratio = view_size / content_size
113118

114119
scoll_range = self.content_height if self.vertical else self.content_width
@@ -135,15 +140,17 @@ def _thumb_rect(self):
135140

136141
if not self._scrollable():
137142
# content is smaller than the scroll area, full size thumb
138-
return LBWH(0,0, self.content_width, self.content_height)
143+
return LBWH(0, 0, self.content_width, self.content_height)
139144

140145
scroll_progress = -scroll_value / scroll_range
141146

142147
content_size = self.content_height if self.vertical else self.content_width
143148
available_track_size = content_size - self._scroll_bar_size()
144149

145150
if self.vertical:
146-
scroll_bar_y = self._scroll_bar_size() / 2 + available_track_size * (1 - scroll_progress)
151+
scroll_bar_y = self._scroll_bar_size() / 2 + available_track_size * (
152+
1 - scroll_progress
153+
)
147154
scroll_bar_x = self.content_width / 2
148155
return XYWH(scroll_bar_x, scroll_bar_y, self.content_width, self._scroll_bar_size())
149156

0 commit comments

Comments
 (0)