From 2b913d0b62ae601bd7d3e60cb07bb80f50a34790 Mon Sep 17 00:00:00 2001 From: yotamberk Date: Sun, 15 Jan 2017 11:37:57 +0200 Subject: [PATCH] fix(timeline): #2522 Right button while dragging item makes items uneditable (#2582) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix right click button bug when dragging item --- lib/timeline/component/ItemSet.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index 948f5758..9d93d792 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -256,6 +256,8 @@ ItemSet.prototype._create = function(){ this.body.dom.centerContainer.addEventListener('mouseover', this._onMouseOver.bind(this)); this.body.dom.centerContainer.addEventListener('mouseout', this._onMouseOut.bind(this)); this.body.dom.centerContainer.addEventListener('mousemove', this._onMouseMove.bind(this)); + // right-click on timeline + this.body.dom.centerContainer.addEventListener('contextmenu', this._onDragEnd.bind(this)); // attach to the DOM this.show(); @@ -1590,6 +1592,7 @@ ItemSet.prototype._moveToGroup = function(item, groupId) { * @private */ ItemSet.prototype._onDragEnd = function (event) { + this.touchParams.itemIsDragging = false; if (this.touchParams.itemProps) { event.stopPropagation(); @@ -1597,7 +1600,6 @@ ItemSet.prototype._onDragEnd = function (event) { var dataset = this.itemsData.getDataSet(); var itemProps = this.touchParams.itemProps ; this.touchParams.itemProps = null; - this.touchParams.itemIsDragging = false; itemProps.forEach(function (props) { var id = props.item.id;