diff -r 8e017d512ef5 -r dc66d623dddd timeline/js/timeline.js --- a/timeline/js/timeline.js Fri Aug 16 19:12:05 2013 +0200 +++ b/timeline/js/timeline.js Mon Aug 19 12:54:37 2013 +0200 @@ -126,29 +126,25 @@ span : 7 * 86400 * 1000, grid_interval : 86400 * 1000, grid_date_format : '{{dayOfMonth}} {{monthName}}', - start_date_format : '{{dayOfMonth}} {{shortMonthName}}', - end_date_format : '{{dayOfMonth}} {{shortMonthName}}' + min_importance : 1 }, { label : "3 jours", span : 3 * 86400 * 1000, grid_interval : 6 * 3600 * 1000, grid_date_format : '{{^isDayStart}}{{0hours}}h{{0minutes}}{{/isDayStart}}{{#isDayStart}}{{dayOfMonth}} {{shortMonthName}}{{/isDayStart}}', - start_date_format : '{{dayOfMonth}} {{shortMonthName}}', - end_date_format : '{{dayOfMonth}} {{shortMonthName}}' + min_importance : 0 }, { label : "Journée", span : 86400 * 1000, grid_interval : 2 * 3600 * 1000, grid_date_format : '{{^isDayStart}}{{0hours}}h{{0minutes}}{{/isDayStart}}{{#isDayStart}}{{dayOfMonth}} {{shortMonthName}}{{/isDayStart}}', - start_date_format : '{{dayOfMonth}} {{shortMonthName}} {{hours}}h', - end_date_format : '{{dayOfMonth}} {{shortMonthName}} {{hours}}h' + min_importance : 0 }, { label : "Demi-Journée", span : 6 * 3600 * 1000, grid_interval : 3600 * 1000, grid_date_format : '{{^isDayStart}}{{0hours}}h{{0minutes}}{{/isDayStart}}{{#isDayStart}}{{dayOfMonth}} {{shortMonthName}}{{/isDayStart}}', - start_date_format : '{{dayOfMonth}} {{shortMonthName}} {{hours}}h', - end_date_format : '{{dayOfMonth}} {{shortMonthName}} {{hours}}h' + min_importance : 0 }], level: 0, central_time: 0, @@ -174,7 +170,8 @@ "Cms\\Rule": "Règle", "Cms\\Video": "Vidéo", "Cms\\SweetCadaver": "Cadavre exquis" - } + }, + maxtime: false } for (var _i = 0; _i < Tlns.Defaults.Timeline.timescales.length; _i++) { @@ -262,8 +259,9 @@ var _deltaX = _event.pageX - _this.dragging_bounds.left, _tAtMouse = _this.timeFromMouse(_event.pageX), _newScale = _this.main_width / (_this.timescales[_newLevel].span), - _newStart = _tAtMouse - _deltaX / _newScale; - _this.central_time = _newStart + _this.timescales[_newLevel].span / 2; + _newStart = _tAtMouse - _deltaX / _newScale, + _newTime = _newStart + _this.timescales[_newLevel].span / 2; + _this.central_time = _this.maxtime ? Math.min(_newTime, _this.maxtime) : _newTime; _this.setLevel(_newLevel); } return false; @@ -300,7 +298,7 @@ } Tlns.Classes.Timeline.prototype.timeFromX = function(_x) { - return Math.max(this.start_time,Math.min(this.end_time, this.start_time + _x / this.current_scale)); + return this.start_time + _x / this.current_scale; } Tlns.Classes.Timeline.prototype.timeFromMouse = function(_pageX) { @@ -352,7 +350,7 @@ Tlns.Classes.Timeline.prototype.setTime = function(_centralTime) { this.sync_now = false; - this.central_time = _centralTime; + this.central_time = this.maxtime ? Math.min(_centralTime, this.maxtime) : _centralTime; this.changeSpan(); } @@ -474,8 +472,10 @@ _occ.x = _this.current_scale * (_occ.date - _this.start_time); _occ.y = _occ.univers.y; }); + var minT = this.timeFromX(-85), + minI = this.timescales[this.level].min_importance; var _visible = _(this.occurrences).filter(function(_occ) { - return (_occ.date >= _this.start_time && _occ.date <= _this.end_time && _occ.status); + return (_occ.date >= minT && _occ.date <= _this.end_time && _occ.status && (_occ.importance >= minI)); }); var _moved = true, l = 0; @@ -582,6 +582,7 @@ this.formatted_date = Tlns.Utils.dateFormat(this.date,Tlns.Defaults.Timeline.tooltip_date_format); this.title = _data.title; this.type = _data.__CLASS__; + this.importance = _data.importance; switch(_data.__CLASS__) { case "Cms\\Previously": case "Cms\\Chapter":