Skip to content

Commit

Permalink
Merge pull request #620 from Shallowmallow/ensureVisible
Browse files Browse the repository at this point in the history
so you can ensureVisible in scrollviews before  the component is ready
  • Loading branch information
ianharrigan authored Aug 13, 2024
2 parents 31b9d47 + 5b035ab commit 4e06567
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions haxe/ui/containers/ScrollView.hx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ private class EnsureVisible extends DefaultBehaviour {
return null;
}

if (!scrollview.isReady) {
scrollview.registerEvent(UIEvent.READY, function f(_) {
scrollview.ensureVisible(c);
});
return null;
}

var hscroll:HorizontalScroll = scrollview.findComponent(HorizontalScroll, false);
var hscrollPos:Float = 0;
if (hscroll != null) {
Expand Down

0 comments on commit 4e06567

Please sign in to comment.