@@ -597,9 +597,6 @@ def add_widget(
597597 # The region that contains the content (container region minus scrollbars)
598598 child_region = widget ._get_scrollable_region (container_region )
599599
600- # Adjust the clip region accordingly
601- sub_clip = clip .intersection (child_region )
602-
603600 # The region covered by children relative to parent widget
604601 total_region = child_region .reset_offset
605602
@@ -609,9 +606,12 @@ def add_widget(
609606 arranged_widgets = arrange_result .widgets
610607 widgets .update (arranged_widgets )
611608
609+ # Get the region that will be updated
610+ sub_clip = clip .intersection (child_region )
611+
612612 if visible_only :
613613 placements = arrange_result .get_visible_placements (
614- container_size . region + widget .scroll_offset
614+ sub_clip - child_region . offset + widget .scroll_offset
615615 )
616616 else :
617617 placements = arrange_result .placements
@@ -621,9 +621,9 @@ def add_widget(
621621 placement_offset = container_region .offset
622622 placement_scroll_offset = placement_offset - widget .scroll_offset
623623
624- _layers = widget .layers
625624 layers_to_index = {
626- layer_name : index for index , layer_name in enumerate (_layers )
625+ layer_name : index
626+ for index , layer_name in enumerate (widget .layers )
627627 }
628628
629629 get_layer_index = layers_to_index .get
@@ -661,7 +661,10 @@ def add_widget(
661661
662662 if visible :
663663 # Add any scrollbars
664- if any (widget .scrollbars_enabled ):
664+ if (
665+ widget .show_vertical_scrollbar
666+ or widget .show_horizontal_scrollbar
667+ ):
665668 for chrome_widget , chrome_region in widget ._arrange_scrollbars (
666669 container_region
667670 ):
0 commit comments