|
@ -82,7 +82,6 @@ Core.prototype._create = function (container) { |
|
|
this.dom.centerContainer.appendChild(this.dom.center); |
|
|
this.dom.centerContainer.appendChild(this.dom.center); |
|
|
this.dom.leftContainer.appendChild(this.dom.left); |
|
|
this.dom.leftContainer.appendChild(this.dom.left); |
|
|
this.dom.rightContainer.appendChild(this.dom.right); |
|
|
this.dom.rightContainer.appendChild(this.dom.right); |
|
|
|
|
|
|
|
|
this.dom.centerContainer.appendChild(this.dom.shadowTop); |
|
|
this.dom.centerContainer.appendChild(this.dom.shadowTop); |
|
|
this.dom.centerContainer.appendChild(this.dom.shadowBottom); |
|
|
this.dom.centerContainer.appendChild(this.dom.shadowBottom); |
|
|
this.dom.leftContainer.appendChild(this.dom.shadowTopLeft); |
|
|
this.dom.leftContainer.appendChild(this.dom.shadowTopLeft); |
|
@ -90,9 +89,26 @@ Core.prototype._create = function (container) { |
|
|
this.dom.rightContainer.appendChild(this.dom.shadowTopRight); |
|
|
this.dom.rightContainer.appendChild(this.dom.shadowTopRight); |
|
|
this.dom.rightContainer.appendChild(this.dom.shadowBottomRight); |
|
|
this.dom.rightContainer.appendChild(this.dom.shadowBottomRight); |
|
|
|
|
|
|
|
|
|
|
|
// size properties of each of the panels
|
|
|
|
|
|
this.props = { |
|
|
|
|
|
root: {}, |
|
|
|
|
|
background: {}, |
|
|
|
|
|
centerContainer: {}, |
|
|
|
|
|
leftContainer: {}, |
|
|
|
|
|
rightContainer: {}, |
|
|
|
|
|
center: {}, |
|
|
|
|
|
left: {}, |
|
|
|
|
|
right: {}, |
|
|
|
|
|
top: {}, |
|
|
|
|
|
bottom: {}, |
|
|
|
|
|
border: {}, |
|
|
|
|
|
scrollTop: 0, |
|
|
|
|
|
scrollTopMin: 0 |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
this.on('rangechange', function () { |
|
|
this.on('rangechange', function () { |
|
|
if (this.initialDrawDone === true) { |
|
|
if (this.initialDrawDone === true) { |
|
|
this._redraw(); // this allows overriding the _redraw method
|
|
|
|
|
|
|
|
|
this._redraw(); |
|
|
} |
|
|
} |
|
|
}.bind(this)); |
|
|
}.bind(this)); |
|
|
this.on('touch', this._onTouch.bind(this)); |
|
|
this.on('touch', this._onTouch.bind(this)); |
|
@ -154,15 +170,15 @@ Core.prototype._create = function (container) { |
|
|
}.bind(this)); |
|
|
}.bind(this)); |
|
|
|
|
|
|
|
|
function onMouseWheel(event) { |
|
|
function onMouseWheel(event) { |
|
|
if (me.isActive()) { |
|
|
|
|
|
me.emit('mousewheel', event); |
|
|
|
|
|
|
|
|
if (this.isActive()) { |
|
|
|
|
|
this.emit('mousewheel', event); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// prevent scrolling when zoomKey defined or activated
|
|
|
// prevent scrolling when zoomKey defined or activated
|
|
|
if (!me.options.zoomKey || event[me.options.zoomKey]) return |
|
|
|
|
|
|
|
|
if (!this.options.zoomKey || event[this.options.zoomKey]) return |
|
|
|
|
|
|
|
|
// prevent scrolling vertically when horizontalScroll is true
|
|
|
// prevent scrolling vertically when horizontalScroll is true
|
|
|
if (me.options.horizontalScroll) return |
|
|
|
|
|
|
|
|
if (this.options.horizontalScroll) return |
|
|
|
|
|
|
|
|
var delta = 0; |
|
|
var delta = 0; |
|
|
if (event.wheelDelta) { /* IE/Opera. */ |
|
|
if (event.wheelDelta) { /* IE/Opera. */ |
|
@ -173,12 +189,12 @@ Core.prototype._create = function (container) { |
|
|
delta = -event.detail / 3; |
|
|
delta = -event.detail / 3; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var current = me.props.scrollTop; |
|
|
|
|
|
|
|
|
var current = this.props.scrollTop; |
|
|
var adjusted = current + delta * 120; |
|
|
var adjusted = current + delta * 120; |
|
|
if (me.isActive()) { |
|
|
|
|
|
me._setScrollTop(adjusted); |
|
|
|
|
|
me._redraw(); |
|
|
|
|
|
me.emit('scroll', event); |
|
|
|
|
|
|
|
|
if (this.isActive()) { |
|
|
|
|
|
this._setScrollTop(adjusted); |
|
|
|
|
|
this._redraw(); |
|
|
|
|
|
this.emit('scroll', event); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Prevent default actions caused by mouse wheel
|
|
|
// Prevent default actions caused by mouse wheel
|
|
@ -188,30 +204,27 @@ Core.prototype._create = function (container) { |
|
|
|
|
|
|
|
|
if (this.dom.root.addEventListener) { |
|
|
if (this.dom.root.addEventListener) { |
|
|
// IE9, Chrome, Safari, Opera
|
|
|
// IE9, Chrome, Safari, Opera
|
|
|
this.dom.root.addEventListener("mousewheel", onMouseWheel, false); |
|
|
|
|
|
|
|
|
this.dom.root.addEventListener("mousewheel", onMouseWheel.bind(this), false); |
|
|
// Firefox
|
|
|
// Firefox
|
|
|
this.dom.root.addEventListener("DOMMouseScroll", onMouseWheel, false); |
|
|
|
|
|
|
|
|
this.dom.root.addEventListener("DOMMouseScroll", onMouseWheel.bind(this), false); |
|
|
} else { |
|
|
} else { |
|
|
// IE 6/7/8
|
|
|
// IE 6/7/8
|
|
|
this.dom.root.attachEvent("onmousewheel", onMouseWheel); |
|
|
|
|
|
|
|
|
this.dom.root.attachEvent("onmousewheel", onMouseWheel.bind(this)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// size properties of each of the panels
|
|
|
|
|
|
this.props = { |
|
|
|
|
|
root: {}, |
|
|
|
|
|
background: {}, |
|
|
|
|
|
centerContainer: {}, |
|
|
|
|
|
leftContainer: {}, |
|
|
|
|
|
rightContainer: {}, |
|
|
|
|
|
center: {}, |
|
|
|
|
|
left: {}, |
|
|
|
|
|
right: {}, |
|
|
|
|
|
top: {}, |
|
|
|
|
|
bottom: {}, |
|
|
|
|
|
border: {}, |
|
|
|
|
|
scrollTop: 0, |
|
|
|
|
|
scrollTopMin: 0 |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
function onMouseScrollSide(event) { |
|
|
|
|
|
var current = this.scrollTop; |
|
|
|
|
|
var adjusted = -current; |
|
|
|
|
|
if (me.isActive()) { |
|
|
|
|
|
me._setScrollTop(adjusted); |
|
|
|
|
|
|
|
|
|
|
|
me._redraw(); |
|
|
|
|
|
me.emit('scroll', event); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.dom.left.parentNode.addEventListener('scroll', onMouseScrollSide); |
|
|
|
|
|
this.dom.right.parentNode.addEventListener('scroll', onMouseScrollSide); |
|
|
|
|
|
|
|
|
this.customTimes = []; |
|
|
this.customTimes = []; |
|
|
|
|
|
|
|
@ -257,17 +270,23 @@ 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', 'zoomKey', 'horizontalScroll' |
|
|
|
|
|
|
|
|
'locale', 'locales', 'moment', 'rtl', 'zoomKey', 'horizontalScroll', 'verticalScroll' |
|
|
]; |
|
|
]; |
|
|
util.selectiveExtend(fields, this.options, options); |
|
|
util.selectiveExtend(fields, this.options, options); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.options.rtl) { |
|
|
if (this.options.rtl) { |
|
|
var contentContainer = this.dom.leftContainer; |
|
|
|
|
|
this.dom.leftContainer = this.dom.rightContainer; |
|
|
|
|
|
this.dom.rightContainer = contentContainer; |
|
|
|
|
|
this.dom.container.style.direction = "rtl"; |
|
|
this.dom.container.style.direction = "rtl"; |
|
|
this.dom.backgroundVertical.className = 'vis-panel vis-background vis-vertical-rtl'; } |
|
|
|
|
|
|
|
|
this.dom.backgroundVertical.className = 'vis-panel vis-background vis-vertical-rtl'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.options.verticalScroll) { |
|
|
|
|
|
if (this.options.rtl) { |
|
|
|
|
|
this.dom.rightContainer.className = 'vis-panel vis-right vis-vertical-scroll'; |
|
|
|
|
|
} else { |
|
|
|
|
|
this.dom.leftContainer.className = 'vis-panel vis-left vis-vertical-scroll'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.options.orientation = {item:undefined,axis:undefined}; |
|
|
this.options.orientation = {item:undefined,axis:undefined}; |
|
|
if ('orientation' in options) { |
|
|
if ('orientation' in options) { |
|
@ -740,9 +759,25 @@ Core.prototype._redraw = function() { |
|
|
// calculate the widths of the panels
|
|
|
// calculate the widths of the panels
|
|
|
props.root.width = dom.root.offsetWidth; |
|
|
props.root.width = dom.root.offsetWidth; |
|
|
props.background.width = props.root.width - borderRootWidth; |
|
|
props.background.width = props.root.width - borderRootWidth; |
|
|
props.left.width = dom.leftContainer.clientWidth || -props.border.left; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!this.initialDrawDone) { |
|
|
|
|
|
props.scrollbarWidth = util.getScrollBarWidth(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.options.verticalScroll) { |
|
|
|
|
|
if (this.options.rtl) { |
|
|
|
|
|
props.left.width = dom.leftContainer.clientWidth || -props.border.left; |
|
|
|
|
|
props.right.width = dom.rightContainer.clientWidth + props.scrollbarWidth || -props.border.right; |
|
|
|
|
|
} else { |
|
|
|
|
|
props.left.width = dom.leftContainer.clientWidth + props.scrollbarWidth || -props.border.left; |
|
|
|
|
|
props.right.width = dom.rightContainer.clientWidth || -props.border.right; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
props.left.width = dom.leftContainer.clientWidth || -props.border.left; |
|
|
|
|
|
props.right.width = dom.rightContainer.clientWidth || -props.border.right; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
props.leftContainer.width = props.left.width; |
|
|
props.leftContainer.width = props.left.width; |
|
|
props.right.width = dom.rightContainer.clientWidth || -props.border.right; |
|
|
|
|
|
props.rightContainer.width = props.right.width; |
|
|
props.rightContainer.width = props.right.width; |
|
|
var centerWidth = props.root.width - props.left.width - props.right.width - borderRootWidth; |
|
|
var centerWidth = props.root.width - props.left.width - props.right.width - borderRootWidth; |
|
|
props.center.width = centerWidth; |
|
|
props.center.width = centerWidth; |
|
@ -796,10 +831,8 @@ Core.prototype._redraw = function() { |
|
|
dom.center.style.left = '0'; |
|
|
dom.center.style.left = '0'; |
|
|
dom.center.style.top = offset + 'px'; |
|
|
dom.center.style.top = offset + 'px'; |
|
|
dom.left.style.left = '0'; |
|
|
dom.left.style.left = '0'; |
|
|
dom.left.style.top = offset + 'px'; |
|
|
|
|
|
dom.right.style.left = '0'; |
|
|
dom.right.style.left = '0'; |
|
|
dom.right.style.top = offset + 'px'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// show shadows when vertical scrolling is available
|
|
|
// show shadows when vertical scrolling is available
|
|
|
var visibilityTop = this.props.scrollTop == 0 ? 'hidden' : ''; |
|
|
var visibilityTop = this.props.scrollTop == 0 ? 'hidden' : ''; |
|
|
var visibilityBottom = this.props.scrollTop == this.props.scrollTopMin ? 'hidden' : ''; |
|
|
var visibilityBottom = this.props.scrollTop == this.props.scrollTopMin ? 'hidden' : ''; |
|
@ -810,6 +843,18 @@ Core.prototype._redraw = function() { |
|
|
dom.shadowTopRight.style.visibility = visibilityTop; |
|
|
dom.shadowTopRight.style.visibility = visibilityTop; |
|
|
dom.shadowBottomRight.style.visibility = visibilityBottom; |
|
|
dom.shadowBottomRight.style.visibility = visibilityBottom; |
|
|
|
|
|
|
|
|
|
|
|
if (this.options.verticalScroll) { |
|
|
|
|
|
this.dom.shadowTopRight.style.visibility = "hidden"; |
|
|
|
|
|
this.dom.shadowBottomRight.style.visibility = "hidden"; |
|
|
|
|
|
this.dom.shadowTopLeft.style.visibility = "hidden"; |
|
|
|
|
|
this.dom.shadowBottomLeft.style.visibility = "hidden"; |
|
|
|
|
|
document.getElementsByClassName('vis-left')[0].scrollTop = -offset; |
|
|
|
|
|
document.getElementsByClassName('vis-right')[0].scrollTop = -offset; |
|
|
|
|
|
} else { |
|
|
|
|
|
dom.left.style.top = offset + 'px'; |
|
|
|
|
|
dom.right.style.top = offset + 'px'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// enable/disable vertical panning
|
|
|
// enable/disable vertical panning
|
|
|
var contentsOverflow = this.props.center.height > this.props.centerContainer.height; |
|
|
var contentsOverflow = this.props.center.height > this.props.centerContainer.height; |
|
|
this.hammer.get('pan').set({ |
|
|
this.hammer.get('pan').set({ |
|
@ -832,6 +877,7 @@ Core.prototype._redraw = function() { |
|
|
} else { |
|
|
} else { |
|
|
this.redrawCount = 0; |
|
|
this.redrawCount = 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.initialDrawDone = true; |
|
|
this.initialDrawDone = true; |
|
|
|
|
|
|
|
|
//Emit public 'changed' event for UI updates, see issue #1592
|
|
|
//Emit public 'changed' event for UI updates, see issue #1592
|
|
|