Skip to content

Commit

Permalink
Fix mouse handling logic in TextViewSkin.
Browse files Browse the repository at this point in the history
Previously, pop-up triggers were not handled correctly when the primary mouse button was not pressed. This update ensures that mouse events are managed appropriately by checking the primary button status along with the pop-up trigger.
  • Loading branch information
dlemmermann committed Aug 15, 2024
1 parent 8087f0a commit fa2cb36
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gemsfx/src/main/java/com/dlsc/gemsfx/skins/TextViewSkin.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,16 @@ public void handle(MouseEvent evt) {
}

private void handleMouseDragged(MouseEvent evt) {
if (!evt.isPrimaryButtonDown() || evt.isPopupTrigger()) {
return;
}
if (evt.getPickResult().getIntersectedNode() instanceof Text text) {
addSelectedIndex(texts.indexOf(text));
}
}

private void handleMousePressed(MouseEvent evt) {
if (evt.isPopupTrigger()) {
if (!evt.isPrimaryButtonDown() || evt.isPopupTrigger()) {
return;
}
getSkinnable().requestFocus();
Expand All @@ -291,7 +294,7 @@ private void handleMousePressed(MouseEvent evt) {
}

private void handleMouseReleased(MouseEvent evt) {
if (evt.isPopupTrigger()) {
if (!evt.isPrimaryButtonDown() || evt.isPopupTrigger()) {
return;
}
firstIndex = null;
Expand Down

0 comments on commit fa2cb36

Please sign in to comment.