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

Add ability to zoom via scroll wheel #263

Merged
merged 8 commits into from
Mar 1, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private void maybePopup(MouseEvent e) {
addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if ((e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0) {
if ((e.getModifiersEx() & InputEvent.META_DOWN_MASK) != 0||(e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather make the modifier OS-dependent.
In other words, META for macOS, and CTRL for the rest.

Just in case, ctrl+click means "right click" in macOS

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have pushed a commit to adding the os dependent code using OSXSupport.isOSX().

double pos = (double)(getHorizontalScrollBar().getValue()) / (double)(chart.getWidth());
if (e.getWheelRotation() > 0 && getScaleFactor() < 100) {
setScaleFactor((getScaleFactor()*1.2));
Expand Down