Open ginkoblongata opened 4 years ago
I have purposefully not attempted this because it seems like it would be very difficult to get right when you don't know what the underlying components are. But if you got something that seems to be working, I would definitely want to check it out and include it!
In order to get it to be workable with existing code, I've added an interface ScrollableBox. I need to do some melding into things like TextBox and AbstractListBox for those to be able to be used in their existing manner and also be capable of being in a ScrollPanel.
I am hoping that the issue for the mouse events (https://github.com/mabe02/lanterna/pull/488) could be merged to 3.1 prior to proceeding onto this.
Pull request created: https://github.com/mabe02/lanterna/pull/492
It is not complete, just created in case of remarks.
Looks like will need to make some part in the events pipeline which tracks DRAG.
Something along the lines of:
UiSystem {
mouseDown(event) {
this.component = event.comp;
}
mouseDrag(event) {
this.component.handleInput(event);
}
mouseUp(event) {
this.component = null;
}
}
The reason is that currently when dragging on the ScrollBar, only mouse drag events which are inside the rectangle are delivered to the ScrollBar InteractableComponent.
The above component would make it so that the mouse DRAGS are delivered to which component last was the target of the mouse DOWNS.
This would need to be configurable (on/off method) in order to maintain backwards compatablity by leaving this component off the pipeline.
Ended up adding this to AbstractBasePane, did not make it configurable.
Ok, I got a couple of comments on the PR.
Hello, I've run into the similar task with Lanterna. My application consists of fullscreen window and main panel in it, containing long list of small panels. And I need main panel to be scrollable.
As I understand from discussion there are no generic scroll panel at the moment but it is possible to implement it manually for specific case. Is there are any examples of such code exists?
I would also like to express interest in having a feature like this.
Having a general container which manages the horizontal and vertical ScrollBars for the supplied single contained Component will be generally useful.
I have started into this and have what I think is about 85% complete prototype in a non API breaking backwards compatible manner.
Using this approach, it's ScrollBar components will also be interactable.