Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Create a new option to disable timeline zoom/drag with mouse in the group column #239

Closed
carueda opened this issue Aug 12, 2014 · 10 comments

Comments

@carueda
Copy link

carueda commented Aug 12, 2014

Then the "released" column area can be used for regular scrolling of the page -- it would actually be a good usability improvement.

@josdejong
Copy link
Contributor

yes, agree.

@carueda
Copy link
Author

carueda commented Aug 13, 2014

Glad you agree. Any idea when it could be made available? And just to note, I'd like to contribute a bit more than just suggestions, unfortunately very time constrained these days, but if you can provide some hints I could try to look at an implementation myself ..

(btw, I'm migrating a project from the chap links timeline to vis.js, which I'm really finding much better designed and flexible -- good work!)

@Jankojanko
Copy link

this is really needed for me as well : I enriched the column area by means of jquery with some additional controls for my application.
The issue is that when the user clicks or drags such controls (i.e. range control) , the timeline scrolls unexpectedly.
Any idea how I can disable this now, without waiting for a new release including this feature?
Thanks, Bye. Janko.

@josdejong
Copy link
Contributor

Any idea how I can disable this now, without waiting for a new release including this feature?

You will have to hack some workaround in the Timeline code. Haven't found time for this myself yet, sorry.

@AlexDM0
Copy link
Contributor

AlexDM0 commented Jan 9, 2015

Hi,

Over the last year a lot of feature requests have been made. We have just introduced our new website which has a list of the requested features. We have placed this request on that list.

The list can be found here:
http://visjs.org/featureRequests.html

An explaination of the new system can be found here:
http://visjs.org/blog.html#New\ website\ for\ vis.js!

I would like to stress that this does not mean we abandon this request. Discussion here will continue if needed on this feature but we will close it to keep our Github issue page more of a bug-todo list.

Future feature requests will still be made here and then added to the website by us.

Regards,

Alex

@AlexDM0 AlexDM0 closed this as completed Jan 9, 2015
@hansmaulwurf23
Copy link
Contributor

I think there are two ways of achieving this:

1. Outside timeline with a dedicated event handler:

// Instantiate our timeline object.
timeline = new vis.Timeline(document.getElementById('mytimeline'), items, groups, options);
// stopping event capture/bubbling in left panel
var leftPanel = document.querySelector("div.vis-panel.vis-left");
leftPanel.addEventListener("mousewheel", function(event) {
    event.stopPropagation();
}, true);

This works fine in Chrome (tested in 43). Firefox (38) keeps zooming unfortunately. I am also not happy with the selector, since the old timeline (https://github.com/almende/chap-links-library) had an option groupsOnRight and if this is implemented here as well, the solution won't work anymore due to the vis-left. Maybe the div holding the groups can add an additional class vis-group-panel?

2. Changing _onMouseWheel:

I tried to understand the whole mouse wheel event processing and if I am not wrong this could be changed here:
https://github.com/almende/vis/blob/master/lib/timeline/Range.js#L463
The path of the event could be analysed like this

if (this.options.zoomInGroupsPanel == false && event.path) {
  var depth = event.path.length;
  for (var i = 0; i < depth; i++) {
    if (event.path[i].className == "vis-panel vis-left") {
      return;
    }
  }
}

to stop the event propagation. Again, this makes use of classnames that are prone to change. In this case even worse, because the order of vis-panel and vis-left may change and so on.
Making use of the event.path may also be just wrong, but I thought this has the least impact on the timeline code.

Any help or suggestions are appreciated. :-)

Cheers
Martin

@hansmaulwurf23
Copy link
Contributor

Having spent the weekend with the timeline, I found another solution, based on the second proposal in the last comment, without using any classname whatsoever:
https://github.com/almende/vis/blob/master/lib/timeline/Range.js#L463

var eventProps = getEventProperties(event);
if (eventProps.what == "group-label") {
    return;
}

This should do the job as well. Maybe invoking this.itemSet.groupFromTarget(event) is also sufficient and has better performance.

The problem in Firefox and proposal 1 is simply the different event name "DOMMouseScroll".

Please decide and I will implement it.

Cheers
Martin

josdejong added a commit that referenced this issue Jul 9, 2015
@josdejong
Copy link
Contributor

Thanks Martin, from your suggestions I just got another idea: in the mouse events, we can check whether the mouse position is inside the current range and if not, ignore. See 20af47e

@mojoaxel mojoaxel changed the title option to disable timeline zoom/drag with mouse in the group column Create a new option to disable timeline zoom/drag with mouse in the group column Oct 24, 2016
@mojoaxel
Copy link
Member

Reopening as Feature-Request issue (see #2114).
Everybody: Please feel free to implement this!

@mojoaxel mojoaxel reopened this Oct 24, 2016
@yotamberk
Copy link
Contributor

This issue is resolved in v4.17.0. zoom/drag is only possible in the centaerContainer (the range)

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

No branches or pull requests

7 participants