diff --git a/UI/Controls/user_entry.gd b/UI/Controls/user_entry.gd index 9619de88..02e7ca76 100644 --- a/UI/Controls/user_entry.gd +++ b/UI/Controls/user_entry.gd @@ -5,26 +5,19 @@ var chatter: Chatter var tw_hidden: Tween var is_expanded: bool = false - -var scroll: ScrollContainer -var is_visible_in_scroll: bool: - get: - if not scroll: return false - return scroll.get_global_rect().intersects(get_global_rect()) var is_profile_picture_loaded: bool = false signal user_selected(chatter: Chatter) # Called when the node enters the scene tree for the first time. func _ready() -> void: - scroll = get_parent().get_parent() - scroll.get_v_scroll_bar().scrolling.connect(check_update_profile_picture) - visibility_changed.connect(check_update_profile_picture) update() toggle_buttons(false) Globals.live_streamers_updated.connect(func(): %LiveStatus.visible = chatter.twitch_id in Globals.live_streamers.keys()) await get_tree().process_frame check_update_profile_picture() + %ScreenNotifer.rect = get_rect() + %ScreenNotifer.screen_entered.connect(check_update_profile_picture) %User.pressed.connect(user_selected.emit.bind(chatter)) %Shoutout.pressed.connect(func(): Globals.twitcher.shoutout(chatter.user)) %Promote.pressed.connect(func(): Globals.twitcher.send_message(chatter.promo_msg)) @@ -60,7 +53,7 @@ func check_update_profile_picture() -> void: if is_profile_picture_loaded: return if not chatter: return await get_tree().process_frame - if not is_visible_in_scroll: return + if not %ScreenNotifer.is_on_screen(): return is_profile_picture_loaded = true await update_profile_picture() if not %AvatarImg.texture: is_profile_picture_loaded = false diff --git a/UI/Controls/user_entry.tscn b/UI/Controls/user_entry.tscn index 7805b1f1..0d111c26 100644 --- a/UI/Controls/user_entry.tscn +++ b/UI/Controls/user_entry.tscn @@ -134,3 +134,6 @@ theme_override_styles/normal = SubResource("StyleBoxFlat_ddi2y") icon = ExtResource("7_k1oax") icon_alignment = 1 expand_icon = true + +[node name="ScreenNotifer" type="VisibleOnScreenNotifier2D" parent="." unique_id=1597669003] +unique_name_in_owner = true