Skip to content
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

Mouse-Related events aren't overrideable like KeyEvents are #217

Closed
JordanMartinez opened this issue Dec 4, 2015 · 6 comments
Closed

Mouse-Related events aren't overrideable like KeyEvents are #217

JordanMartinez opened this issue Dec 4, 2015 · 6 comments

Comments

@JordanMartinez
Copy link
Contributor

In StyledTextAreaBehavior, MouseEvents are handled using EventStreams which don't take into consideration if the MouseEvent is already consumed (unlike EventHandlerTemplate and KeyEvents):

EventHandlerHelper.installAfter(area.onKeyPressedProperty(), keyPressedHandler);
EventHandlerHelper.installAfter(area.onKeyTypedProperty(), keyTypedHandler);

subscription = Subscription.multi(
        eventsOf(area, MouseEvent.MOUSE_PRESSED).subscribe(this::mousePressed),
        eventsOf(area, MouseEvent.MOUSE_DRAGGED).subscribe(this::mouseDragged),
        eventsOf(area, MouseEvent.DRAG_DETECTED).subscribe(this::dragDetected),
        eventsOf(area, MouseEvent.MOUSE_RELEASED).subscribe(this::mouseReleased),
        () -> {
            EventHandlerHelper.remove(area.onKeyPressedProperty(), keyPressedHandler);
            EventHandlerHelper.remove(area.onKeyTypedProperty(), keyTypedHandler);
        });

The following summarized code doesn't work:

EventHandler<MouseEvent> mouseRelease = EventHandlerTemplate
            .on(MouseEvent.MOUSE_RELEASED).act {area, event -> event.consume() }
            .create()
            .bind(this)
EventHandlerHelper.install(onMouseReleasedProperty(), mouseRelease)

If I want to customize the MouseEvent handling, it can only be done by adding an EventFilter

@TomasMikula
Copy link
Member

Good point. We should investigate how to port the mouse event handling to the same approach that is used for key handling.

@TomasMikula
Copy link
Member

Oh, I see you already did that :)

@JordanMartinez
Copy link
Contributor Author

😄 Yup!

@JordanMartinez
Copy link
Contributor Author

So...... this issue and others I've opened (#218, #223, #152) have been resolved in the current master branch but haven't yet been included in an official release. Am I supposed to close them now, or wait for you to do so when the next version that includes the code that resolves these issues is released?

@TomasMikula
Copy link
Member

Thanks for checking up on them. I think we can close them now :)

@JordanMartinez
Copy link
Contributor Author

Resolved via ca3b771

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants