From c9312bb7ab04a94e12d5dbe2412cd5f8cf61f41a Mon Sep 17 00:00:00 2001 From: yotamberk Date: Sun, 29 Jan 2017 16:52:12 +0200 Subject: [PATCH] fix(timeline): Fix #2597 Zoom while dragging (#2645) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Fix mousewheel while dragging item bug * Return removed lines --- lib/timeline/component/ItemSet.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index 9d93d792..38bb7028 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -259,6 +259,8 @@ ItemSet.prototype._create = function(){ // right-click on timeline this.body.dom.centerContainer.addEventListener('contextmenu', this._onDragEnd.bind(this)); + this.body.dom.centerContainer.addEventListener('mousewheel', this._onMouseWheel.bind(this)); + // attach to the DOM this.show(); }; @@ -1953,6 +1955,16 @@ ItemSet.prototype._onMouseMove = function (event) { } }; +/** + * Handle mousewheel + * @param event + * @private + */ +ItemSet.prototype._onMouseWheel = function(event) { + if (this.touchParams.itemIsDragging) { + this._onDragEnd(event); + } +} /** * Handle updates of an item on double tap