From 6f12de62f9c80f5fdc5ffbdb1791557a7cbbc22c Mon Sep 17 00:00:00 2001 From: Tanner Netterville Date: Wed, 28 May 2014 16:59:26 -0500 Subject: [PATCH] Add shiftOnlyWheelScroll setting (default: true) In this committer's view, sideways scrolling with the mouse wheel should require holding the shift key so as not to interfere with page scrolling especially for large gantt charts. --- js/jquery.fn.gantt.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/js/jquery.fn.gantt.js b/js/jquery.fn.gantt.js index 077c91d..cd14ca7 100644 --- a/js/jquery.fn.gantt.js +++ b/js/jquery.fn.gantt.js @@ -46,7 +46,8 @@ onItemClick: function (data) { return; }, onAddClick: function (data) { return; }, onRender: function() { return; }, - scrollToToday: true + scrollToToday: true, + shiftOnlyWheelScroll: true }; // custom selector `:findday` used to match on specified day in ms. @@ -1181,7 +1182,7 @@ /* * Dependecies (temporary disabled) */ - /* + /* $.each(element.data, function(i, entry) { $.each(entry.values, function(j, day) { if (day.id && day.dep) @@ -1390,7 +1391,7 @@ } } }); - });*/ + });*/ }, // **Navigation** @@ -1536,6 +1537,11 @@ // Move chart via mousewheel wheelScroll: function (element, e) { + if (settings.shiftOnlyWheelScroll && !e.shiftKey) { + // shift is not held down: break out + return; + } + var delta = e.detail ? e.detail * (-50) : e.wheelDelta / 120 * 50; core.scrollPanel(element, delta); @@ -1939,4 +1945,4 @@ }); }; -})(jQuery); \ No newline at end of file +})(jQuery);