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

ChartZoomManager is missing a MouseEvent.MOUSE_CLICKED handler #22

Open
TomSchorsch opened this issue May 14, 2020 · 2 comments
Open

ChartZoomManager is missing a MouseEvent.MOUSE_CLICKED handler #22

TomSchorsch opened this issue May 14, 2020 · 2 comments

Comments

@TomSchorsch
Copy link

I extended the fxutils in my own application so that a double click would restore the original zooming (turn it all off).

To do this I needed a MOUSE_CLICKED handler for the ChartZoomManager for the rectangle.

Unfortunately the eventHandler is private so I could not merely subclass and add it in.

ChartZoomManager needs:

	handlerManager.addEventHandler( false, MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
		@Override
		public void handle( MouseEvent mouseEvent ) {
			//Don't check filter here, we're either already started, or not
			onMouseClick(mouseEvent);
		}
	} );

or the eventHandler needs to be made protected (or other options).

@gillius
Copy link
Owner

gillius commented May 15, 2020

It has been a long time since I've worked on this code...

So using just the code you've provided, there's no onMouseClick method so you are proposing one is added with protected? That wouldn't be consistent with the other onMouse* methods which are private.

The event handler is just attached to the chartPane, which is passed into the ChartZoomManager anyway. Does it work to just simply register an event handler on the Pane passed into the zoom manager, for any events you want to handle? Then if you detect a double click you can just call setAutoRanging(true) on the axes?

This is all based on the fact that it seems that just adding your own event listener to the pane/chart lets you do that, since your proposed code doesn't modify or disable any other event listeners on its own.

@TomSchorsch
Copy link
Author

TomSchorsch commented May 15, 2020 via email

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