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

Allow zooming only with a pressed modifier key #335

Closed
NicolasGoeddel opened this issue Mar 15, 2020 · 3 comments
Closed

Allow zooming only with a pressed modifier key #335

NicolasGoeddel opened this issue Mar 15, 2020 · 3 comments

Comments

@NicolasGoeddel
Copy link

Hi,

when I create a nearly page filling graph with the zoom functionality enabled, it is nearly impossible to find a spot where is no canvas to scroll the page. It would be nice if one could set a modifier key like Alt, Ctrl or Shift to enable zooming with the scroll wheel.

If there is already such a functionality, can you please give me an example application?

@NicolasGoeddel
Copy link
Author

I tried to change the enabled property with some key binds but although the property gets changed it does not enable the zooming functionality.

The graphs object stores all my graphs on the page and I iterate through them to change the state of the zoom.

  $(document).keydown(function(event) {
    if (event.shiftKey) {
      for (var g in graphs) {
        graphs[g].options.plugins.zoom.zoom.enabled = true;
        console.log('enabled');
      }
    }
  });

  $(document).keyup(function(event) {
    if (event.shiftKey) {
      for (var g in graphs) {
        graphs[g].options.plugins.zoom.zoom.enabled = false;
        console.log('disabled');
      }
    }
  });

@KoalaBear84
Copy link

KoalaBear84 commented Apr 6, 2020

What if you also add? Here it works. Without it, is sometimes does not work as expected, with the update it does.

graphs[g].update();

@etimberg
Copy link
Member

A wheel modifier key was added in #382

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

No branches or pull requests

3 participants