Browse Source

Default duration import & fix scroll event

pull/1/head
Wahyu Ramadhan 1 year ago
parent
commit
d74ed58443
  1. 3
      edit-mode/function/ganttConfig.js
  2. 45
      edit-mode/function/ganttEvent.js

3
edit-mode/function/ganttConfig.js

@ -314,6 +314,9 @@ var allColumns = [
start_date: start, start_date: start,
end_date: end end_date: end
}) })
if (todayDuration < 0) {
todayDuration = 0;
}
progress = todayDuration/endDuration * 100 progress = todayDuration/endDuration * 100
return roundToTwo(progress); return roundToTwo(progress);
}, resize: true }, resize: true

45
edit-mode/function/ganttEvent.js

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