|
@ -157,9 +157,41 @@ Core.prototype._create = function (container) { |
|
|
if (me.isActive()) { |
|
|
if (me.isActive()) { |
|
|
me.emit('mousewheel', event); |
|
|
me.emit('mousewheel', event); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// prevent scrolling when zoomKey defined or activated
|
|
|
|
|
|
if (!me.options.zoomKey || event[me.options.zoomKey]) return |
|
|
|
|
|
|
|
|
|
|
|
var delta = 0; |
|
|
|
|
|
if (event.wheelDelta) { /* IE/Opera. */ |
|
|
|
|
|
delta = event.wheelDelta / 120; |
|
|
|
|
|
} else if (event.detail) { /* Mozilla case. */ |
|
|
|
|
|
// In Mozilla, sign of delta is different than in IE.
|
|
|
|
|
|
// Also, delta is multiple of 3.
|
|
|
|
|
|
delta = -event.detail / 3; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var current = me.props.scrollTop; |
|
|
|
|
|
var adjusted = current + delta * 120; |
|
|
|
|
|
if (me.isActive()) { |
|
|
|
|
|
me._setScrollTop(adjusted); |
|
|
|
|
|
me._redraw(); |
|
|
|
|
|
me.emit('scroll', event); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Prevent default actions caused by mouse wheel
|
|
|
|
|
|
// (else the page and timeline both scroll)
|
|
|
|
|
|
event.preventDefault(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.dom.root.addEventListener) { |
|
|
|
|
|
// IE9, Chrome, Safari, Opera
|
|
|
|
|
|
this.dom.root.addEventListener("mousewheel", onMouseWheel, false); |
|
|
|
|
|
// Firefox
|
|
|
|
|
|
this.dom.root.addEventListener("DOMMouseScroll", onMouseWheel, false); |
|
|
|
|
|
} else { |
|
|
|
|
|
// IE 6/7/8
|
|
|
|
|
|
this.dom.root.attachEvent("onmousewheel", onMouseWheel); |
|
|
} |
|
|
} |
|
|
this.dom.root.addEventListener('mousewheel', onMouseWheel); |
|
|
|
|
|
this.dom.root.addEventListener('DOMMouseScroll', onMouseWheel); |
|
|
|
|
|
|
|
|
|
|
|
// size properties of each of the panels
|
|
|
// size properties of each of the panels
|
|
|
this.props = { |
|
|
this.props = { |
|
@ -222,7 +254,7 @@ Core.prototype.setOptions = function (options) { |
|
|
var fields = [ |
|
|
var fields = [ |
|
|
'width', 'height', 'minHeight', 'maxHeight', 'autoResize', |
|
|
'width', 'height', 'minHeight', 'maxHeight', 'autoResize', |
|
|
'start', 'end', 'clickToUse', 'dataAttributes', 'hiddenDates', |
|
|
'start', 'end', 'clickToUse', 'dataAttributes', 'hiddenDates', |
|
|
'locale', 'locales', 'moment', 'rtl' |
|
|
|
|
|
|
|
|
'locale', 'locales', 'moment', 'rtl', 'zoomKey' |
|
|
]; |
|
|
]; |
|
|
util.selectiveExtend(fields, this.options, options); |
|
|
util.selectiveExtend(fields, this.options, options); |
|
|
|
|
|
|
|
|