Updated UserEntry

Removed ScrollContainer code, as it doesn't work with Filtering (Online
/ Name filtering).
Added VisibleOnScreenNotifier2D to the control, to handle on screen
visibility notification.
Connected screen_entered to check_update_profile_picture.
Added check if not is_on_screen(), to not try and update the profile
picture.
This commit is contained in:
Mario Steele 2026-03-08 16:24:55 -05:00
parent 11e4590d8e
commit 991597ff21
2 changed files with 6 additions and 10 deletions

View file

@ -5,26 +5,19 @@ var chatter: Chatter
var tw_hidden: Tween var tw_hidden: Tween
var is_expanded: bool = false 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 var is_profile_picture_loaded: bool = false
signal user_selected(chatter: Chatter) signal user_selected(chatter: Chatter)
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: 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() update()
toggle_buttons(false) toggle_buttons(false)
Globals.live_streamers_updated.connect(func(): %LiveStatus.visible = chatter.twitch_id in Globals.live_streamers.keys()) Globals.live_streamers_updated.connect(func(): %LiveStatus.visible = chatter.twitch_id in Globals.live_streamers.keys())
await get_tree().process_frame await get_tree().process_frame
check_update_profile_picture() check_update_profile_picture()
%ScreenNotifer.rect = get_rect()
%ScreenNotifer.screen_entered.connect(check_update_profile_picture)
%User.pressed.connect(user_selected.emit.bind(chatter)) %User.pressed.connect(user_selected.emit.bind(chatter))
%Shoutout.pressed.connect(func(): Globals.twitcher.shoutout(chatter.user)) %Shoutout.pressed.connect(func(): Globals.twitcher.shoutout(chatter.user))
%Promote.pressed.connect(func(): Globals.twitcher.send_message(chatter.promo_msg)) %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 is_profile_picture_loaded: return
if not chatter: return if not chatter: return
await get_tree().process_frame await get_tree().process_frame
if not is_visible_in_scroll: return if not %ScreenNotifer.is_on_screen(): return
is_profile_picture_loaded = true is_profile_picture_loaded = true
await update_profile_picture() await update_profile_picture()
if not %AvatarImg.texture: is_profile_picture_loaded = false if not %AvatarImg.texture: is_profile_picture_loaded = false

View file

@ -134,3 +134,6 @@ theme_override_styles/normal = SubResource("StyleBoxFlat_ddi2y")
icon = ExtResource("7_k1oax") icon = ExtResource("7_k1oax")
icon_alignment = 1 icon_alignment = 1
expand_icon = true expand_icon = true
[node name="ScreenNotifer" type="VisibleOnScreenNotifier2D" parent="." unique_id=1597669003]
unique_name_in_owner = true