fix(CustomMultiLineTextArea): prevent scrolling when the component is disabled

This commit is contained in:
extio-de
2026-04-27 22:01:21 +02:00
parent f90fad7ad1
commit d9fdcefb19

View File

@@ -389,7 +389,17 @@ public class CustomMultiLineTextArea extends Component {
@Override @Override
public void mouseWheelMoved(final MouseWheelEvent e) { public void mouseWheelMoved(final MouseWheelEvent e) {
if (!CustomMultiLineTextArea.this.enabled) {
return;
}
final int lineHeight = getLineHeight(); final int lineHeight = getLineHeight();
final int visibleHeight = getVisibleHeight();
final int totalContentHeight = getWrappedLines().size() * lineHeight;
if (totalContentHeight <= visibleHeight) {
return;
}
final int scrollAmount = e.getWheelRotation() * SCROLL_WHEEL_LINES * lineHeight; final int scrollAmount = e.getWheelRotation() * SCROLL_WHEEL_LINES * lineHeight;
scroll(scrollAmount); scroll(scrollAmount);
e.consume(); e.consume();