-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent group expansion arrow from activating group when expanding or collapsing #8785
Conversation
I like the basic idea, I'm just thinking if "instanceof StackPane" is determined enough to prevent other side effects (e.g. the hits badge is a StackPane too) |
Thank you for your review @calixtus. I agree that just The reason that Clickable area if only include Clickable area (red) if include both |
@@ -266,7 +266,11 @@ private void initialize() { | |||
.map(this::createContextMenuForGroup) | |||
.orElse((ContextMenu) null)); | |||
row.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> { | |||
if (event.getButton() == MouseButton.SECONDARY || event.getTarget() instanceof StackPane) { | |||
if (event.getTarget() instanceof StackPane) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use pattern matching to avoid unnecessary casts
if (event.getTarget() instanceof StackPane pane) {
@@ -269,6 +269,10 @@ private void initialize() { | |||
if (event.getButton() == MouseButton.SECONDARY) { | |||
// Prevent right-click to select group | |||
event.consume(); | |||
} else if (event.getTarget() instanceof StackPane pane) { | |||
if (pane.getStyleClass().toString().equals("arrow") || pane.getStyleClass().toString().equals("tree-disclosure-node")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's better to check for contains, because there could also be multiple style classes assigned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @calixtus , it has been updated with contains().
Really appreciate your review!
LGTM! Is this fix also for #3176 ? |
Hi @Siedlerchr , I believe that #3176 has also been fixed based on #7982 (comment) and #7982 (comment). |
Thanks again for your contributions! Superb so far! We really appreciate your engagement |
Hey @Siedlerchr @LIM0000 This fix/improvement has been reversed/broken by this commit: ...because the event is being intercepted and consumed, now via an EventHandler (bubbling phase) rather than capture phase, as was previous. So it's too late, the node has already been selected as before. E.g., row.addEventFilter(MouseEvent.MOUSE_PRESSED ...) is gone with the re-factor in the above link. |
Thanks for the hint. Feel free to create a PR with a fix
Cormac Redmond ***@***.***> schrieb am Mo., 24. Juli 2023,
02:03:
… Hey @Siedlerchr <https://github.com/Siedlerchr> @LIM0000
<https://github.com/LIM0000>
This fix/improvement has been reversed/broken by this commit:
bc662cb
<bc662cb>
...because the event is being intercepted and consumed, now via an
EventHandler (bubbling phase) rather than capture phase, as was previous.
So it's too late, the node has already been selected as before.
E.g., row.addEventFilter(MouseEvent.MOUSE_PRESSED ...) is gone with the
re-factor in the above link.
—
Reply to this email directly, view it on GitHub
<#8785 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACOFZBW7GCUA4JC3GLBTH3XRW3VRANCNFSM5VT4N6MQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
…nt: JabRef#8785. Now, once again, the mouse click is handled and consumed at the capture stage if the expansion pane is licked, therefore preventing the node from being selected.
…nt: JabRef#8785. Now, once again, the mouse click is handled and consumed at the capture stage if the expansion pane is licked, therefore preventing the node from being selected.
@Siedlerchr, done: #10111 |
Previous discussion for group activation when expanding or collapsing group #7982
Proposal solution: Prevent group activation/select when user clicks on group expanding or collapsing arrow
Fixes: #7982
Fixes #3176
1.1.mp4
Further discussion
It might not be a good idea to only check eventTarget that returns StackPane class, as the group expand arrow is the only column that is using the StackPane class at current JabRef version. Any feedbacks are much appreciated!
PR Checklist:
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)