natinusala / borealis

Hardware accelerated, controller and TV oriented UI library for PC and Nintendo Switch (libnx)
Apache License 2.0
257 stars 81 forks source link

[Yoga] ScrollView inside ScrollView #81

Open XITRIX opened 3 years ago

XITRIX commented 3 years ago

I'd like to make a horizontal ScrollView, but there is the weird behaviour when I put ScrollView inside another one.

You can reproduce it by adding this into demo/components.xml image

I'll try to understand what is going wrong, but maybe you'll realise it faster than me.

natinusala commented 3 years ago

Why do you want to put a ScrollingFrame into another one? This is not supported lol

XITRIX commented 3 years ago

I'd like to make horizontal scroll view and use it inside vertical scroll view, i.e. bunch of screenshots in horizontal scroll inside vertical with another info (any AppStore\Google Play\eShop page). I think to make it work vertical scroll inside another one also should work properly, even if it's useless.

natinusala commented 3 years ago

What is the behavior that you see? I cannot reproduce it right now

XITRIX commented 3 years ago

Where I can post a video?...

XITRIX commented 3 years ago

https://user-images.githubusercontent.com/9553519/108274344-d1d63e80-7185-11eb-9517-758c4d6b6d43.mov

Oh, I can do it here...

XITRIX commented 3 years ago

There was the same problem when I tried to implement horizontal scrolling, as root view it worked fine.

natinusala commented 3 years ago

Oh I see thanks for the video

I would say that I don't want to support nesting two scrollviews that have the same scrolling direction. Nesting a vertical and a horizontal should work (although I would discourage it since it's wonky to the user). So, I would say not to worry about that issue if you want to create a horizontal scrolling frame.

XITRIX commented 3 years ago

I've made horizontal scrolling and it also have the same problem. That happens cause doublenested view don't count primary scrollview's detachedOrigin and renders it only in place where it was rendered first.

https://user-images.githubusercontent.com/9553519/108410482-8a5cba80-7238-11eb-87bd-9ef6eb46b285.mov

I fixed it, but I think my "fix" could break something, but right now I cannot realise what, just check it in my branch with horizontal scroll in View.cpp file.

https://user-images.githubusercontent.com/9553519/108411829-2804b980-723a-11eb-9d27-d29419eb0cfa.mov

Also my solution for horizontal scroll is really bulky, so I don't think that I should make a PR.

natinusala commented 3 years ago

Can you link me to the changes you made so that I can have a look at them if you want?