|
|
|
@ -159,25 +159,28 @@ gantt.attachEvent("onGanttScroll", function (left, top){
|
|
|
|
|
var left_date = gantt.dateFromPos(left) |
|
|
|
|
var right_date = gantt.dateFromPos(left + gantt.$task.offsetWidth) |
|
|
|
|
|
|
|
|
|
gantt.config.start_date = gantt.config.start_date || gantt.getState().min_date; |
|
|
|
|
gantt.config.end_date = gantt.config.end_date || gantt.getState().max_date; |
|
|
|
|
|
|
|
|
|
var min_allowed_date = gantt.date.add(gantt.config.start_date, 1, "day"); |
|
|
|
|
var max_allowed_date = gantt.date.add(gantt.config.end_date, -1, "day"); |
|
|
|
|
|
|
|
|
|
var repaint = false; |
|
|
|
|
if (+left_date <= +min_allowed_date){ |
|
|
|
|
gantt.config.start_date = gantt.date.add(gantt.config.start_date, -1, "day"); |
|
|
|
|
repaint = true; |
|
|
|
|
} |
|
|
|
|
if (+right_date >= +max_allowed_date){ |
|
|
|
|
gantt.config.end_date = gantt.date.add(gantt.config.end_date, 1, "day"); |
|
|
|
|
repaint = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (repaint) { |
|
|
|
|
setTimeout(function(){ |
|
|
|
|
gantt.render() |
|
|
|
|
},20) |
|
|
|
|
} |
|
|
|
|
let taskCount = gantt.getTaskCount(); |
|
|
|
|
if (taskCount > 0) { |
|
|
|
|
gantt.config.start_date = gantt.config.start_date || gantt.getState().min_date; |
|
|
|
|
gantt.config.end_date = gantt.config.end_date || gantt.getState().max_date; |
|
|
|
|
|
|
|
|
|
var min_allowed_date = gantt.date.add(gantt.config.start_date, 1, "day"); |
|
|
|
|
var max_allowed_date = gantt.date.add(gantt.config.end_date, -1, "day"); |
|
|
|
|
|
|
|
|
|
var repaint = false; |
|
|
|
|
if (+left_date <= +min_allowed_date){ |
|
|
|
|
gantt.config.start_date = gantt.date.add(gantt.config.start_date, -1, "day"); |
|
|
|
|
repaint = true; |
|
|
|
|
} |
|
|
|
|
if (+right_date >= +max_allowed_date){ |
|
|
|
|
gantt.config.end_date = gantt.date.add(gantt.config.end_date, 1, "day"); |
|
|
|
|
repaint = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (repaint) { |
|
|
|
|
setTimeout(function(){ |
|
|
|
|
gantt.render() |
|
|
|
|
},20) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |