ppy / osu-framework

A game framework written with osu! in mind.
MIT License
1.66k stars 418 forks source link

Implement ScrollableIfFit bool property for ScrollableContainer #2573

Open EVAST9919 opened 5 years ago

EVAST9919 commented 5 years ago

In some cases we want ScrollableContainer behave like a regular Container depends on it's content. I.e. if Content.Height > ScrollableContainer.Height scroll works, if no - it doesn't.

swoolcock commented 5 years ago

I would personally prefer to see this implemented by disabling bounce/overshoot. I can see this as being a useful option for framework consumers.

public enum ScrollBouncePolicy
{
    Always, // current functionality
    Never, // disable bouncing entirely
    WhenRequired, // enable bouncing/scrolling only if the content doesn't fit (your suggestion)
}

public virtual ScrollBouncePolicy BouncePolicy { get; set; } = ScrollBouncePolicy.Always;
peppy commented 5 years ago

on or off IMO.

UselessToucan commented 5 years ago

In some cases we want ScrollableContainer behave like a regular Container

Can you provide any concrete use cases?

peppy commented 5 years ago

I would definitely want a use case for this before implementing. I think this may be a step back in UX personally. If anything it should be a protected variable so framework consumers are required to create a scroll container intently with the purpose of changing the overall behaviour.

EVAST9919 commented 4 years ago

It can be used in beatmap overlay description (once it'll be implemented). It's scrollable if content is big and non-scrollable if not. But may be it should be implemented for osu-side only