|
@ -135,7 +135,7 @@ function Timeline (container, items, groups, options) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var start = me.options.start != undefined ? me.options.start : range.min; |
|
|
var start = me.options.start != undefined ? me.options.start : range.min; |
|
|
var end = me.options.end != undefined ? me.options.end : range.max; |
|
|
|
|
|
|
|
|
var end = me.options.end != undefined ? me.options.end : range.max; |
|
|
|
|
|
|
|
|
me.setWindow(start, end, {animation: false}); |
|
|
me.setWindow(start, end, {animation: false}); |
|
|
} |
|
|
} |
|
@ -373,8 +373,19 @@ Timeline.prototype.focus = function(id, options) { |
|
|
*/ |
|
|
*/ |
|
|
Timeline.prototype.fit = function (options) { |
|
|
Timeline.prototype.fit = function (options) { |
|
|
var animation = (options && options.animation !== undefined) ? options.animation : true; |
|
|
var animation = (options && options.animation !== undefined) ? options.animation : true; |
|
|
var range = this.getItemRange(); |
|
|
|
|
|
this.range.setRange(range.min, range.max, animation); |
|
|
|
|
|
|
|
|
var range; |
|
|
|
|
|
|
|
|
|
|
|
var dataset = this.itemsData && this.itemsData.getDataSet(); |
|
|
|
|
|
if (dataset.length === 1 && dataset.get()[0].end === undefined) { |
|
|
|
|
|
// a single item -> don't fit, just show a range around the item from -4 to +3 days
|
|
|
|
|
|
range = this.getDataRange(); |
|
|
|
|
|
this.moveTo(range.min.valueOf(), {animation}); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
// exactly fit the items (plus a small margin)
|
|
|
|
|
|
range = this.getItemRange(); |
|
|
|
|
|
this.range.setRange(range.min, range.max, animation); |
|
|
|
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|