@@ -40,6 +40,8 @@ def __init__(self,
40
40
anchors : Optional [Dict [str , Union [str , UIElement ]]] = None ,
41
41
visible : int = 1 ):
42
42
super ().__init__ (relative_rect , manager ,
43
+ allow_scroll_x = allow_scroll_x ,
44
+ allow_scroll_y = allow_scroll_y ,
43
45
starting_height = starting_height ,
44
46
container = container ,
45
47
parent_element = parent_element ,
@@ -52,26 +54,16 @@ def __init__(self,
52
54
object_id = object_id ,
53
55
element_id = "auto_scrolling_container" )
54
56
55
- self .allow_scroll_x = allow_scroll_x
56
- self .allow_scroll_y = allow_scroll_y
57
-
58
- anchors = {"left" : "left" ,
59
- "right" : "left" ,
60
- "top" : "top" ,
61
- "bottom" : "top" }
62
-
63
57
resize_left : bool = True
64
58
resize_right : bool = True
65
59
resize_top : bool = True
66
60
resize_bottom : bool = True
67
61
68
62
if not self .allow_scroll_x :
69
- anchors ["right" ] = "right"
70
63
resize_left = False
71
64
resize_right = False
72
65
73
66
if not self .allow_scroll_y :
74
- anchors ["bottom" ] = "bottom"
75
67
resize_top = False
76
68
resize_bottom = False
77
69
@@ -89,9 +81,10 @@ def __init__(self,
89
81
object_id = ObjectID (
90
82
object_id = "#scrollable_container" ,
91
83
class_id = None ),
92
- anchors = anchors )
93
-
94
- self .scrollable_container_dimensions = scrollable_rect .size
84
+ anchors = {"left" : "left" ,
85
+ "right" : "left" ,
86
+ "top" : "top" ,
87
+ "bottom" : "top" })
95
88
96
89
def update (self , time_delta : float ):
97
90
"""
@@ -103,9 +96,6 @@ def update(self, time_delta: float):
103
96
"""
104
97
super ().update (time_delta )
105
98
106
- new_dimensions = self .scrollable_container .rect .size
107
-
108
- if self .scrollable_container_dimensions != new_dimensions :
109
- self .scrollable_container_dimensions = new_dimensions
99
+ if self .scrollable_container .has_recently_updated_dimensions :
110
100
self ._calculate_scrolling_dimensions ()
111
101
self ._sort_out_element_container_scroll_bars ()
0 commit comments