Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrollable controls #25

Open
adam-arold opened this issue Oct 6, 2017 · 10 comments
Open

Scrollable controls #25

adam-arold opened this issue Oct 6, 2017 · 10 comments
Labels
enhancement Enhances existing functionality without introducing new features

Comments

@adam-arold
Copy link
Member

No description provided.

@nanodeath
Copy link
Contributor

I think there's a lot to discuss here...here's the three things I can think of:

  • How does it look?
  • How does the user keyboard-navigate to it? Tab? Then arrow keys to scroll?
  • How is it implemented? Decorator, component? New decorator, or aspect of existing decorator?

@nanodeath
Copy link
Contributor

Re: appearance, perhaps this?

                ┌┤Foo├─────┐
                │         ▲│
                │         ■│
                │         ░│
                │         ░│
                │         ▼│
                └──────────┘

@adam-arold
Copy link
Member Author

We already have a ScrollBar, it is just not integrated yet. The problem right now is that Components can't be resized right now because resizing support would need a lot of other things (layout support and dynamic size properties for example). What can be done is to have a Scrollable thing that has a virtual and an actual size (just like with the LogArea). What I'm thinking is that the best course of action is to provide scrollable components as Fragments. There are already some prototypes in place. Take a look here.

@Seveen
Copy link
Member

Seveen commented Mar 13, 2021

There is a naive implementation of a scrolling list in the scrollbar examples:

class DemoScrollFragment(private val size: Size, position: Position, private var items: List<String>) : Fragment {

@nanodeath
Copy link
Contributor

I noticed that -- I've been using it as a starting point and things are going pretty well. I'm making my version accept any T instead of just strings, and reusing labels kinda like Android does because adding/removing labels was causing the UI to chug a bit.

@adam-arold
Copy link
Member Author

This sounds great. There is one problem with the ScrollBar though and I don't know a good solution for this. If you drag the scroll button itself, move it hen move the mouse out of the scroll bar, then it no longer receives mouse events (since the mouse is no longer over it). I think there might be a solution for this somehow using event bubbling, but I'm not 100% sure.

@nanodeath
Copy link
Contributor

Seems like on clicking the scrollbar, you could add a mousedrag handler to the screen/view/root that uses capture/bubble to track movement, then on mouseup release the handler and itself (the mouseup handler).

Can we split this off into a separate issue?

@adam-arold
Copy link
Member Author

Yep, do you want to do it?

@nanodeath
Copy link
Contributor

I'll probably pick it up (#374) once a few of my other PRs get merged.

@adam-arold
Copy link
Member Author

I'm looking at the other PRs right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhances existing functionality without introducing new features
Projects
None yet
Development

No branches or pull requests

3 participants