zircon icon indicating copy to clipboard operation
zircon copied to clipboard

Scrollable controls

Open adam-arold opened this issue 7 years ago • 10 comments

adam-arold avatar Oct 06 '17 19:10 adam-arold

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 avatar Mar 12 '21 20:03 nanodeath

Re: appearance, perhaps this?

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

nanodeath avatar Mar 12 '21 20:03 nanodeath

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.

adam-arold avatar Mar 12 '21 20:03 adam-arold

There is a naive implementation of a scrolling list in the scrollbar examples: https://github.com/Hexworks/zircon/blob/6c8a084e59cc0acdb2f9b3977ce036a911c97b22/zircon.jvm.examples/src/main/kotlin/org/hexworks/zircon/examples/components/ScrollBarExample.kt#L136

Seveen avatar Mar 13 '21 00:03 Seveen

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.

nanodeath avatar Mar 13 '21 01:03 nanodeath

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.

adam-arold avatar Mar 15 '21 19:03 adam-arold

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?

nanodeath avatar Mar 15 '21 22:03 nanodeath

Yep, do you want to do it?

adam-arold avatar Mar 28 '21 20:03 adam-arold

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

nanodeath avatar Mar 28 '21 21:03 nanodeath

I'm looking at the other PRs right now.

adam-arold avatar Apr 06 '21 18:04 adam-arold