From d779efe3f3bfbab7954824e7484e4e50d10e758d Mon Sep 17 00:00:00 2001 From: yotamberk Date: Fri, 2 Dec 2016 11:09:49 +0200 Subject: [PATCH] Fixes #2336 mouse wheel problem on custom time element (#2366) * Fix mouse zoom on currentTime * Fix customTime mousewheel bug --- lib/timeline/component/CustomTime.js | 16 +++++++++++++++- lib/timeline/component/css/currenttime.css | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/timeline/component/CustomTime.js b/lib/timeline/component/CustomTime.js index fcdff5de..63963abe 100644 --- a/lib/timeline/component/CustomTime.js +++ b/lib/timeline/component/CustomTime.js @@ -77,8 +77,22 @@ CustomTime.prototype._create = function() { drag.style.left = '-10px'; drag.style.height = '100%'; drag.style.width = '20px'; - bar.appendChild(drag); + function onMouseWheel (e) { + this.body.range._onMouseWheel(e); + } + + if (drag.addEventListener) { + // IE9, Chrome, Safari, Opera + drag.addEventListener("mousewheel", onMouseWheel.bind(this), false); + // Firefox + drag.addEventListener("DOMMouseScroll", onMouseWheel.bind(this), false); + } else { + // IE 6/7/8 + drag.attachEvent("onmousewheel", onMouseWheel.bind(this)); + } + + bar.appendChild(drag); // attach event listeners this.hammer = new Hammer(drag); this.hammer.on('panstart', this._onDragStart.bind(this)); diff --git a/lib/timeline/component/css/currenttime.css b/lib/timeline/component/css/currenttime.css index 46c7b9c3..7d3547a1 100644 --- a/lib/timeline/component/css/currenttime.css +++ b/lib/timeline/component/css/currenttime.css @@ -2,4 +2,5 @@ background-color: #FF7F6E; width: 2px; z-index: 1; + pointer-events: none; } \ No newline at end of file