SpyrexDE / SmoothScroll

Addon for the Godot Game Engine that adds a SmoothScrollContainer.
https://spyrexde.github.io/SmoothScroll/
MIT License
144 stars 13 forks source link

Add full support of horizontal scrolling #16

Closed HaroldLever closed 1 year ago

HaroldLever commented 1 year ago

Full support of horizontal scrolling, as well as relative function. scrollto... functions are all using tween now. I changed set_h/v_scroll() to get_h/v_scroll_bar().set_value_with_no_signal() and queue_redraw, as the former function tries to pull content back to boundary, which caused flicker like #2.

SpyrexDE commented 1 year ago

Might not be a large issue but the horizontal over-drag seems to snap back further than the vertical one.

https://user-images.githubusercontent.com/57133330/216006112-d2fc0fa6-2413-4645-acf8-cc7de84a65d8.mp4

HaroldLever commented 1 year ago

Hi, SpyrexDE. It's actually the size of scroll bar and I fix it. And I simplify bounce methods.

SpyrexDE commented 1 year ago

Using the newest Godot Beta (v4.0.beta16.official [518b9e580]) I get some really weird behavior:

https://user-images.githubusercontent.com/57133330/216141057-286a22ac-9c41-4533-a4c6-196a5e7872f1.mp4

The scroll container on the right just has some wider content to make it create a horizontal scroll.

HaroldLever commented 1 year ago

I'm using the same version, but I didn't find that issue. Have you checked the content node minimum size? Or is that convenient to provide a minimal reproduction project? content node minimum size

SpyrexDE commented 1 year ago

Yeah, I just edited the scroll container in example.tscn to have a wider minimum x-size, so it would create an horizontal scroll bar.

HaroldLever commented 1 year ago

Perhaps I misunderstood something. Is that any weird behavior?

SpyrexDE commented 1 year ago

How would you go about creating a horizontal scroll? Normal scrollbars work with the control's minimum size as well. I did the same for this video and there it worked really well.

HaroldLever commented 1 year ago

I guess you mean you don't want h scroll bar even if content node is wider than scroll container? Creating scroll bar is actually original scroll container behavior, which is controlled by Horizontal/Vertical Scroll Mode.

SpyrexDE commented 1 year ago

No, sorry for the communication issue. What I wanted to point out is that depending on what Godot 4 Beta I am using there appears to be a bug. I opened exactly the same project once using Beta 5 and once using Beta 16, but the results are different:

Beta 5:

https://user-images.githubusercontent.com/57133330/216604255-787f8dc7-a020-4b95-8a98-ba293432e953.mov

Beta 16:

https://user-images.githubusercontent.com/57133330/216604707-8f671a12-d57e-47f5-89b3-1ffe8dd93a4c.mp4

HaroldLever commented 1 year ago

Uhhh, are you wondering why there is scrollbar on rich text label node? Try check this. Idk when godot changed the name, which might cause different behavior? I'm sorry that my brain seems to shut down this days. Fit content

SpyrexDE commented 1 year ago

Ahh okay, that was exactly it. Thank you very much :)