use of com.spinyowl.legui.component.TextArea in project legui by SpinyOwl.
the class TextAreaViewportScrollListener method process.
/**
* Used to handle specific event.
*
* @param event event to handle.
*/
@Override
public void process(ScrollEvent event) {
Vector2f cursorPosition = Mouse.getCursorPosition();
Component targetComponent = event.getTargetComponent();
if (hasViewportsInAboveLayersUnderCursor(targetComponent, cursorPosition)) {
return;
}
ArrayList<Component> targetList = new ArrayList<>();
SehUtil.recursiveTargetComponentListSearch(Mouse.getCursorPosition(), event.getTargetComponent(), targetList);
for (Component component : targetList) {
if ((component instanceof TextArea) || (component instanceof ScrollablePanel)) {
return;
}
}
TextArea textArea = (TextArea) event.getTargetComponent().getParent();
textArea.resizeTextAreaField();
if (Math.abs(event.getYoffset()) > 0) {
updateScrollBarValue(event.getYoffset(), event.getContext(), event.getFrame(), textArea.getVerticalScrollBar());
}
if (Math.abs(event.getXoffset()) > 0) {
updateScrollBarValue(event.getXoffset(), event.getContext(), event.getFrame(), textArea.getHorizontalScrollBar());
}
}
Aggregations