diff --git a/lib/timeline/Core.js b/lib/timeline/Core.js index 1b4f1291..3ea69325 100644 --- a/lib/timeline/Core.js +++ b/lib/timeline/Core.js @@ -277,8 +277,7 @@ Core.prototype.setOptions = function (options) { 'start', 'end', 'clickToUse', 'dataAttributes', 'hiddenDates', 'locale', 'locales', 'moment', 'rtl', 'zoomKey', 'horizontalScroll', 'verticalScroll' ]; - util.selectiveExtend(fields, this.options, options); - + util.selectiveExtend(fields, this.options, options); if (this.options.rtl) { this.dom.container.style.direction = "rtl"; diff --git a/lib/timeline/Timeline.js b/lib/timeline/Timeline.js index cc44f3b0..a2d528df 100644 --- a/lib/timeline/Timeline.js +++ b/lib/timeline/Timeline.js @@ -57,9 +57,17 @@ function Timeline (container, items, groups, options) { minHeight: null }; this.options = util.deepExtend({}, this.defaultOptions); - if (options) { - this.options.rtl = options.rtl - } + + if (!options || (options && typeof options.rtl == "undefined")) { + if (container.dir) { + this.options.rtl = container.dir == "rtl"; + } else if (document.dir) { + this.options.rtl = document.dir == "rtl"; + } + } else { + this.options.rtl = options.rtl; + } + // Create the DOM, props, and emitter this._create(container); @@ -91,17 +99,17 @@ function Timeline (container, items, groups, options) { }; // range - this.range = new Range(this.body); + this.range = new Range(this.body, this.options); this.components.push(this.range); this.body.range = this.range; // time axis - this.timeAxis = new TimeAxis(this.body); + this.timeAxis = new TimeAxis(this.body, this.options); this.timeAxis2 = null; // used in case of orientation option 'both' this.components.push(this.timeAxis); // current time bar - this.currentTime = new CurrentTime(this.body); + this.currentTime = new CurrentTime(this.body, this.options); this.components.push(this.currentTime); // item set