{"action":"created","issue":{"url":"https://api.github.com/repos/almende/vis/issues/2275","repository_url":"https://api.github.com/repos/almende/vis","labels_url":"https://api.github.com/repos/almende/vis/issues/2275/labels{/name}","comments_url":"https://api.github.com/repos/almende/vis/issues/2275/comments","events_url":"https://api.github.com/repos/almende/vis/issues/2275/events","html_url":"https://github.com/almende/vis/pull/2275","id":187699206,"number":2275,"title":"Added option 'selectEvent' for Timeline.prototype.setSelection","user":{"login":"itfourp","id":16938828,"avatar_url":"https://avatars.githubusercontent.com/u/16938828?v=3","gravatar_id":"","url":"https://api.github.com/users/itfourp","html_url":"https://github.com/itfourp","followers_url":"https://api.github.com/users/itfourp/followers","following_url":"https://api.github.com/users/itfourp/following{/other_user}","gists_url":"https://api.github.com/users/itfourp/gists{/gist_id}","starred_url":"https://api.github.com/users/itfourp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itfourp/subscriptions","organizations_url":"https://api.github.com/users/itfourp/orgs","repos_url":"https://api.github.com/users/itfourp/repos","events_url":"https://api.github.com/users/itfourp/events{/privacy}","received_events_url":"https://api.github.com/users/itfourp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/almende/vis/milestones/3","html_url":"https://github.com/almende/vis/milestones/Minor%20Release%20v4.18","labels_url":"https://api.github.com/repos/almende/vis/milestones/3/labels","id":2116291,"number":3,"title":"Minor Release v4.18","description":"","creator":{"login":"mojoaxel","id":600565,"avatar_url":"https://avatars.githubusercontent.com/u/600565?v=3","gravatar_id":"","url":"https://api.github.com/users/mojoaxel","html_url":"https://github.com/mojoaxel","followers_url":"https://api.github.com/users/mojoaxel/followers","following_url":"https://api.github.com/users/mojoaxel/following{/other_user}","gists_url":"https://api.github.com/users/mojoaxel/gists{/gist_id}","starred_url":"https://api.github.com/users/mojoaxel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mojoaxel/subscriptions","organizations_url":"https://api.github.com/users/mojoaxel/orgs","repos_url":"https://api.github.com/users/mojoaxel/repos","events_url":"https://api.github.com/users/mojoaxel/events{/privacy}","received_events_url":"https://api.github.com/users/mojoaxel/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":7,"state":"open","created_at":"2016-11-05T12:23:35Z","updated_at":"2016-11-17T16:10:30Z","due_on":null,"closed_at":null},"comments":12,"created_at":"2016-11-07T12:26:58Z","updated_at":"2016-11-20T09:19:52Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/almende/vis/pulls/2275","html_url":"https://github.com/almende/vis/pull/2275","diff_url":"https://github.com/almende/vis/pull/2275.diff","patch_url":"https://github.com/almende/vis/pull/2275.patch"},"body":"When using multiple timelines with JQuery drag&drop in IE11 there occurs a problem that prevents the drag&drop events to be fired. To make JQuery drag&drop work, the 'pointerdown' event must be stopped for each item in the timeline. When calling 'event.stopPropagation()' JQuery drag&drop works, but the selection of items does not work any more. \r\nThis PR adds an option to the setSelection-function of the Timeline-prototype that allows to call the select-event manually when the pointerdown-event-propagation was stopped.\r\n\r\nThe following code shows how to 'disable' the pointerdown-event and use the setSelection-function with the added option.\r\n\r\n```javascript\r\nfor (var prop in myTimeline.itemSet.items) {\r\n  if (myTimeline.itemSet.items[prop].dom &&\r\n    myTimeline.itemSet.items[prop].dom.box) {\r\n      var item = $(myTimeline.itemSet.items[prop].dom.box);\r\n      var itemData = myTimeline.itemSet.items[prop].data;\r\n      //  IE11-fix: prevent the timeline from canceling the event\r\n      if (IsMicrosoftInternetExplorer) {\r\n        item.on(\"pointerdown\", function (event) {\r\n          event.stopPropagation();\r\n        });\r\n        //  this re-enables selecting items\r\n        item.on(\"click\", function (event) {\r\n          var clicked = $(event.currentTarget);\r\n          var id = clicked.data(\"id\");\r\n          myTimeline.setSelection([id], { selectEvent: event });\r\n        });\r\n      }\r\n      //  enable drag for items\r\n      if (item.is(\"your selector here\")) {\r\n        item.draggable({\r\n          axis: \"y\",\r\n          revert: \"invalid\",\r\n          revertDuration: 150,\r\n          scroll: false,\r\n          helper: \"clone\",\r\n          appendTo: \"body\",\r\n          drag: function (event, ui) {\r\n            event.stopImmediatePropagation();\r\n          },\r\n          stop: function (event, ui) {\r\n            event.stopImmediatePropagation();\r\n          }\r\n        });\r\n      }\r\n    }\r\n}\r\n//  create dropzone for another timeline\r\n$(myTimeline2.body.dom.centerContainer).droppable({\r\n  tolerance: \"pointer\",\r\n  accept: \"your selector here\",\r\n  hoverClass: \"...\",\r\n  greedy: true,\r\n  drop: function (event, ui) {\r\n    //  your drop function\r\n  }\r\n});\r\n```\r\n\r\nPlease note this is a very specific solution for a very specific problem. It does not solve the problem of dragging items of one timeline onto another but only fixes a side-effect that occurs when using JQuery drag&drop with the timeline."},"comment":{"url":"https://api.github.com/repos/almende/vis/issues/comments/261767456","html_url":"https://github.com/almende/vis/pull/2275#issuecomment-261767456","issue_url":"https://api.github.com/repos/almende/vis/issues/2275","id":261767456,"user":{"login":"mojoaxel","id":600565,"avatar_url":"https://avatars.githubusercontent.com/u/600565?v=3","gravatar_id":"","url":"https://api.github.com/users/mojoaxel","html_url":"https://github.com/mojoaxel","followers_url":"https://api.github.com/users/mojoaxel/followers","following_url":"https://api.github.com/users/mojoaxel/following{/other_user}","gists_url":"https://api.github.com/users/mojoaxel/gists{/gist_id}","starred_url":"https://api.github.com/users/mojoaxel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mojoaxel/subscriptions","organizations_url":"https://api.github.com/users/mojoaxel/orgs","repos_url":"https://api.github.com/users/mojoaxel/repos","events_url":"https://api.github.com/users/mojoaxel/events{/privacy}","received_events_url":"https://api.github.com/users/mojoaxel/received_events","type":"User","site_admin":false},"created_at":"2016-11-20T09:19:52Z","updated_at":"2016-11-20T09:19:52Z","body":"I have no access to an IE11 at the moment. Maybe somebody else can have a look!?"}}
{"actor":{"display_login":"mojoaxel"}}