Stanzilla / WoWUIBugs

World of Warcraft UI Bug Tracker
166 stars 7 forks source link

A way to set scroll speed for the new ScrollFrameTemplate? #427

Closed Arxareon closed 1 year ago

Arxareon commented 1 year ago

Hey!

I've been trying to hack a way to keep the panExtentPercentage property of a new ScrollFrame set to a specified value but each time the ScrollFrame initializes or updates itself, the value resets to the default 0.3* which is extremely annoying.

I've yet to find a way to to do it without having to go to extremes like force-updating it every frame with an OnUpdate script, which of course would work but.. would overkill to say the least.

I'm assuming this is the culprit https://github.com/Gethe/wow-ui-source/blob/6eca162dbca161e850b735bd5b08039f96caf2df/Interface/SharedXML/Scroll/ScrollUtil.lua#L219 as it seems to be the only place the default value is being set (over and over).

I can confirm that setting panExtentPercentage to a number between (0, 1) would indeed work and that seems to be the way to specify the scroll step behavior which can be easily tested through editing the value directly in the Frame Attributes window.

I tried using ScrollControllerMixin:SetPanExtentPercentage through the mixin https://github.com/Gethe/wow-ui-source/blob/6eca162dbca161e850b735bd5b08039f96caf2df/Interface/SharedXML/Scroll/ScrollController.lua#L107but even that seems to do absolutely nothing as the value reverts to 0.3 all the same.

I'm not actually sure if it's a bug, an oversight or just an (incomprehensibly) unsupported feature, or, the ineptitude on my part of not being able to figure this out.

I really wish Blizzard released official, up to date, useful and comprehensive documentation of their API..

*The value OnLoad is actually 0.1 but in practice it will be set to 0.3when the ScrollFrame is in use.

Meorawr commented 1 year ago

You can replace the SetPanExtentPercentage function on the scrollbar itself with something that does nothing when called.

-- Assuming ScrollFrame is the frame inheriting ScrollFrameTemplate:
ScrollFrame.ScrollBar:SetPanExtentPercentage(0.1)
ScrollFrame.ScrollBar.SetPanExtentPercentage = nop
Arxareon commented 1 year ago

Yes, indeed that works. It should be a good workaround for anyone for the time being.

I didn't think of that but I should've. I'm tired. But anyhow.. now it's great! Thanks a lot!

Meorawr commented 1 year ago

Going to re-open this; there's likely going to be a better way to do this added in a future build but it's not super high priority right now. Will close once that's landed (or if I hear back and say it's no longer happening).

Meorawr commented 1 year ago

This'll be implemented in 10.1.0.49474: https://github.com/Gethe/wow-ui-source/blob/05898806ea0422ac369b0d56305c5e898104ae7b/Interface/SharedXML/Scroll/ScrollUtil.lua#L209-L215