|
|
|
@ -98,3 +98,33 @@ gantt.attachEvent("onGanttRender", function(){
|
|
|
|
|
gantt.config.readonly = true; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
gantt.attachEvent("onGanttScroll", function (left, top){ |
|
|
|
|
var left_date = gantt.dateFromPos(left) |
|
|
|
|
var right_date = gantt.dateFromPos(left + gantt.$task.offsetWidth) |
|
|
|
|
|
|
|
|
|
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 (earliest && +left_date <= +min_allowed_date && +left_date >= +earliest){ |
|
|
|
|
gantt.config.start_date = gantt.date.add(gantt.config.start_date, -1, "day"); |
|
|
|
|
repaint = true; |
|
|
|
|
} |
|
|
|
|
if (latest && +right_date >= +max_allowed_date && +right_date <= +latest){ |
|
|
|
|
gantt.config.end_date = gantt.date.add(gantt.config.end_date, 1, "day"); |
|
|
|
|
repaint = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (repaint) { |
|
|
|
|
setTimeout(function(){ |
|
|
|
|
gantt.render() |
|
|
|
|
},20) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |