almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

Feature request: option to use mousewheel for scrolling window even when over timeline-DIV #3734

Open jugantner opened 6 years ago

jugantner commented 6 years ago

Hi team, I currently use the timeline component of visjs to display a historical overview of a wineyards which works perfect. I disabled scrolling by mousewheel without altKey (which means i use ALT as zoomKey, which works perfect) when i now scroll down the page using the mousewheel and the mousepointer is over the timeline-DIV page scrolling stops, because its captured by the timeline component.

It would be nice to have an option now to enable page scrolling by mousewheel especially when a zoomKey is specified.

my configuration:

var options = {
    locale: 'de',
    clickToUse: false,
    height: '700px',
    zoomable: true,
    moveable: true,
    selectable: true,
    zoomKey: 'altKey',
};

I am using the latest version 4.21.0 and didn't find an option. To use the lib for our needs I commented out line 9619: event.preventDefault(); in function onMouseWheel() to have scrolling page by mousewheel.

Thanks! Julian

yotamberk commented 6 years ago

Have you tried the 'ClickToUse' option?

jugantner commented 6 years ago

Hi Yotam,

thanks for your advice to this option. I already tried that. The problem is: I do not want to click first before use. I disabled scrolling without scrollKey, so I cannot see any reason why scrolling (when mouse pointer is above the timeline) is disabled when clickToUse is false. It would be nice to have an option to use scrolling by mouse wheel even if I am above (with the mouse pointer) the timeline, especially when scolling is disabled without scrollKey. Perhaps this should be the default behaviour then.

Thanks for any other solution Julian

yotamberk commented 6 years ago

The solution might be simply solved by css defining mouse-events. I think it's defined to none. If you attach a jsbin with the problem, I'll take a look at it and try to fix it

omarks commented 6 years ago

I have the same issue after upgrading to the latest vis.js. My issue is that on a smart phone, the timeline takes up the whole window and so it's very difficult to scroll out of it. clickToUse doesn't seem to work with smart phones (at least iPhone). Another option is using vertical scroll but I have to make the timeline window so small for it to work on a phone it then looks odd on a computer.

I'm not sure how this behaviour can be over ridden with css....

Mark

mikemonaco commented 6 years ago

I would like to request this same feature. If a scrollKey is defined, the user should be able to scroll the page while hovering over the timeline.

lewisjb commented 6 years ago

Requested JSBin: http://jsbin.com/zivagegoca/edit?html,console,output

yotamberk commented 6 years ago

This fix can be found in https://github.com/yotamberk/timeline-plus