gillius / jfxutils

JavaFX Utilities - Zoom and Pan Charts and Pane Scaling
Apache License 2.0
68 stars 22 forks source link

Update ChartPanManager-- default drag unconstrained #7

Closed gforman44 closed 8 years ago

gforman44 commented 8 years ago

The IF-ELSE fork dropped through in some cases-- like dragging near the title or corners, in which case it would not change the pan mode from the previous mode. Now, if the drag wasn't in the x-axis or y-axis, it just defaults to unconstrained panning.

gillius commented 8 years ago

Thanks for finding this. It's been a long time since I worked on this code so I didn't realize that the area being listened to can be outside of the plot or axes. Another possibility to consider in the future when I work on #5 is to ignore pan/zoom if outside of those 3 areas.

I wonder if ChartZoomManager has the same defect as I followed the same pattern as there.

gforman44 commented 8 years ago

Thanks for accepting my fix so fast. I hope it'll be included in a Maven snapshot within, say, 2 weeks.

Another possibility to consider in the future

Now that I'm using it, I find that I want a way to reset back to the original view often, e.g. when I zoom too far. Pondering how to do that in the framework with as little impact on application programs as possible. Here's an idea:

Double-click to restore. (the original coordinates could be saved with the manager)

Better than using control-click or keyboard shortcuts, because it's less likely to interfere with the app's idea for GUI interactions.

Just as the blue zoom rectangle appears only during zooming, there could be a "reset" button that appears only when the mouse is in the corner between the axes...but then who would ever discover it... Not sure that's the best idea that everyone wants...

Fun to think about.

gillius commented 8 years ago

The latest changes including your merge is already deployed to my Maven2 repo at http://www.gillius.org/maven2 as 0.4-SNAPSHOT.

I think if people really want to use it I will go through the effort to deploy to Maven Central for the 0.4 release.

As for resetting back to original view, that already exists, in the example there is a button "Auto Zoom" which resets the axes back to auto-ranging, which is the default. When you zoom or pan the auto-ranging gets set to false, but you can always turn auto mode back on. You could set up any button or mouse handler of your own to call those functions.