Skip to content

Commit

Permalink
Fixes issue where the TextArea component wasn't able to gain focus.
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkryst committed Aug 29, 2018
1 parent f109690 commit b9fbc14
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/com/valkryst/VTerminal/component/TextArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,21 @@ public void createEventListeners(final @NonNull Screen parentScreen) {
final MouseListener mouseListener = new MouseListener() {
@Override
public void mouseClicked(final MouseEvent e) {
if (editable == false || isFocused() == false) {
if (editable == false) {
return;
}

if (e.getButton() != MouseEvent.BUTTON1) {
return;
}

if (intersects(parentScreen.getMousePosition())) {
setFocused(true);
} else {
setFocused(false);
return;
}

final Font font = parentScreen.getImageCache().getFont();
final int columnIndexInArea = (e.getX() / font.getWidth()) - tiles.getXPosition();
final int rowIndexInArea = (e.getY() / font.getHeight()) - tiles.getYPosition();
Expand Down

0 comments on commit b9fbc14

Please sign in to comment.