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
Make scrollZoom speed configurable #1085
Comments
cc #2041 |
Is there are progress here? |
As a quick hack one can adjust manually the hardcoded normalisation factor in var r=-e.deltaY;if(isFinite(r)||(r=e.wheelDelta/10),isFinite(r)){var n,i=Math.exp(-Math.min(Math.max(r,-20),20)/200),... I replaced |
If using in Javascript, I solved this by overtaking the wheel event (capture phase) and emitted my own event with modified deltaY. This works on cartesian plots, I did not check others. function handler(event)
{
if (!event.isTrusted) return;
event.stopPropagation();
var newEv = new WheelEvent('wheel', {
clientX: event.clientX,
clientY:event.clientY,
deltaY:event.deltaY*2,
});
event.target.dispatchEvent(newEv);
} |
What is the element that you attached the 'handler'? I tried on 'document' and plot element and does not work.... |
I attached it to plot element but on wheel event in capture mode. |
Thank you! I've missed the 'capture mode' from the initial post. Now it worked. |
What's the 'capture mode' you guys talking about? Could you share the script of this part, please? |
Use the same element, Plotly.react is called on. So if you initialize plot with Plotly.react(plotEl, data, layout, options) you should do something like this: The last true, means capture events. For explanation on capture events, search for "event bubbling capturing" |
Thanks a lot, @mitja-p. I'm using angular-plotly.js, based on your suggestion, I did it this way, and it works now. (in case somebody using angular-plotly.js needs it in the future. ) <plotly-plot *ngIf="isPlotDataReady" [data]="graph.data" [layout]="graph.layout"> ngAfterViewInit() { public handler(event: any) {
} |
rreusser commentedOct 25, 2016
•
edited
I find scrollZoom speed painfully slow. Making this configurable may mean propagating a scale factor to some other gl modules or something, but then again it might just be a simple scalar. Maybe
scrollZoomSpeed
?(Side note: it's not clear to me why
scrollZoom
is camelCased and belongs to config instead of to layout.)I don't think it's entirely straightforward to get the speed itself just right across browsers and system configs, but maybe this is something: http://stackoverflow.com/questions/5527601/normalizing-mousewheel-speed-across-browsers#answer-30134826
The text was updated successfully, but these errors were encountered: