|
@ -28,8 +28,8 @@ import Validator from '../shared/Validator'; |
|
|
* @constructor |
|
|
* @constructor |
|
|
* @extends Core |
|
|
* @extends Core |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
function Timeline (container, items, groups, options) { |
|
|
function Timeline (container, items, groups, options) { |
|
|
|
|
|
|
|
|
if (!(this instanceof Timeline)) { |
|
|
if (!(this instanceof Timeline)) { |
|
|
throw new SyntaxError('Constructor must be called with the new operator'); |
|
|
throw new SyntaxError('Constructor must be called with the new operator'); |
|
|
} |
|
|
} |
|
@ -45,22 +45,21 @@ function Timeline (container, items, groups, options) { |
|
|
this.defaultOptions = { |
|
|
this.defaultOptions = { |
|
|
start: null, |
|
|
start: null, |
|
|
end: null, |
|
|
end: null, |
|
|
|
|
|
|
|
|
autoResize: true, |
|
|
autoResize: true, |
|
|
|
|
|
|
|
|
orientation: { |
|
|
orientation: { |
|
|
axis: 'bottom', // axis orientation: 'bottom', 'top', or 'both'
|
|
|
axis: 'bottom', // axis orientation: 'bottom', 'top', or 'both'
|
|
|
item: 'bottom' // not relevant
|
|
|
item: 'bottom' // not relevant
|
|
|
}, |
|
|
}, |
|
|
moment: moment, |
|
|
moment: moment, |
|
|
|
|
|
|
|
|
width: null, |
|
|
width: null, |
|
|
height: null, |
|
|
height: null, |
|
|
maxHeight: null, |
|
|
maxHeight: null, |
|
|
minHeight: null |
|
|
minHeight: null |
|
|
}; |
|
|
}; |
|
|
this.options = util.deepExtend({}, this.defaultOptions); |
|
|
this.options = util.deepExtend({}, this.defaultOptions); |
|
|
|
|
|
|
|
|
|
|
|
if (options) { |
|
|
|
|
|
this.options.rtl = options.rtl |
|
|
|
|
|
} |
|
|
// Create the DOM, props, and emitter
|
|
|
// Create the DOM, props, and emitter
|
|
|
this._create(container); |
|
|
this._create(container); |
|
|
|
|
|
|
|
@ -104,11 +103,6 @@ function Timeline (container, items, groups, options) { |
|
|
// current time bar
|
|
|
// current time bar
|
|
|
this.currentTime = new CurrentTime(this.body); |
|
|
this.currentTime = new CurrentTime(this.body); |
|
|
this.components.push(this.currentTime); |
|
|
this.components.push(this.currentTime); |
|
|
|
|
|
|
|
|
// apply options
|
|
|
|
|
|
if (options) { |
|
|
|
|
|
this.setOptions(options); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// item set
|
|
|
// item set
|
|
|
this.itemSet = new ItemSet(this.body, this.options); |
|
|
this.itemSet = new ItemSet(this.body, this.options); |
|
@ -149,6 +143,11 @@ function Timeline (container, items, groups, options) { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// apply options
|
|
|
|
|
|
if (options) { |
|
|
|
|
|
this.setOptions(options); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// IMPORTANT: THIS HAPPENS BEFORE SET ITEMS!
|
|
|
// IMPORTANT: THIS HAPPENS BEFORE SET ITEMS!
|
|
|
if (groups) { |
|
|
if (groups) { |
|
|
this.setGroups(groups); |
|
|
this.setGroups(groups); |
|
@ -194,7 +193,6 @@ Timeline.prototype.setOptions = function (options) { |
|
|
if (errorFound === true) { |
|
|
if (errorFound === true) { |
|
|
console.log('%cErrors have been found in the supplied options object.', printStyle); |
|
|
console.log('%cErrors have been found in the supplied options object.', printStyle); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Core.prototype.setOptions.call(this, options); |
|
|
Core.prototype.setOptions.call(this, options); |
|
|
|
|
|
|
|
|
if ('type' in options) { |
|
|
if ('type' in options) { |
|
|