Closed hassila closed 1 year ago
Sample screenshot with arrow keys (using window resize to get proper display):
I don't think the code for the down arrow works, it will always show, even if you are all the way down in the scrollview. Also, (my mistake for having pushed that down arrow in the first place) they are drawn in the background of ScrollView
so they can be overlapped by the scroll view's contents.
For now I've gone ahead and removed the background completely.
If you want to continue with this, layers have an invalidate
function, but you need to take care of the input/layout/drawing cycle. (contentOffset
is set during the input cycle, so that it can later be used in layout, and it looks like contentSize
will be set during layout to be later used while drawing) Also, I'd like to make sure the invalidated part of the screen is correct not to do unnecessary drawing, although that might already not be the case right now. It might make most sense to have a seperate ScrollBar
control.
Thanks - no, you are right, the down arrow needed some TLC as I didn't know how to invalidate - I'll park this for now and have a look at ScrollBar in the future. Once again - major kudos for bringing this to light, really cool stuff and allows for some fundamental interactive interfaces to be super easily created. You should consider open for sponsoring ;-)
Removed hardcoded blue backgrounds as reported in https://github.com/rensbreur/SwiftTUI/issues/7
I also tried to fix so that arrows up/down in the scroll control will display dynamically correct instead of always hardcode an arrow down, but would need guidance on correct way to invalidate the control (added comments in the commit) - right now it seems to display correctly on window change though.