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

Reversable scrolling #20

Closed
tylerecouture opened this issue Jul 10, 2016 · 3 comments
Closed

Reversable scrolling #20

tylerecouture opened this issue Jul 10, 2016 · 3 comments
Labels

Comments

@tylerecouture
Copy link

tylerecouture commented Jul 10, 2016

Thank you for this plugin! Can I request reversable scrolling? For example one scroll click up then one scroll click down returns you to the original zoom (1:1). This might make for a more intuitive default also.

Also, my chart is on a large page and scrolling caused the page to also scroll, this worked beautifully to prevent that:
http://stackoverflow.com/questions/1459676/prevent-scroll-bubbling-from-element-to-window#answer-4593315.

@courchef
Copy link
Contributor

courchef commented Jul 20, 2016

Thanks for the tip on page scrolling. I have the same issue.

I modified the wheel handler in Chart.Zoom.js at line 195 (as of version 0.1.3) with the following lines:

var wheelHandler = function(e) {
    e.preventDefault();
    if (e.deltaY < 0) {
        doZoom(chartInstance, 1.1);
    } else {
        doZoom(chartInstance, 0.909);
    }
};

It prevents a long page from scrolling when the mouse wheel is activated over the chart.

Is it possible to add this in master branch?

@etimberg
Copy link
Member

@courchef i'm happy to merge a PR for this

@etimberg etimberg added the bug label Jul 20, 2016
@etimberg
Copy link
Member

Fixed in #24

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

No branches or pull requests

3 participants