perfect progress in ignore
This commit is contained in:
parent
0c9e4aeb3e
commit
af1c94b56a
32
src/bar.js
32
src/bar.js
@ -402,6 +402,7 @@ export default class Bar {
|
|||||||
if (this.gantt.options.show_expected_progress) {
|
if (this.gantt.options.show_expected_progress) {
|
||||||
this.update_expected_progressbar_position();
|
this.update_expected_progressbar_position();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.update_progressbar_position();
|
this.update_progressbar_position();
|
||||||
this.update_arrow_position();
|
this.update_arrow_position();
|
||||||
}
|
}
|
||||||
@ -587,13 +588,14 @@ export default class Bar {
|
|||||||
if (
|
if (
|
||||||
!this.gantt.config.ignored_dates.find(
|
!this.gantt.config.ignored_dates.find(
|
||||||
(k) => k.getTime() === d.getTime(),
|
(k) => k.getTime() === d.getTime(),
|
||||||
) ||
|
) &&
|
||||||
(this.gantt.config.ignored_function &&
|
this.gantt.config.ignored_function &&
|
||||||
!this.gantt.config.ignored_function(d))
|
!this.gantt.config.ignored_function(d)
|
||||||
) {
|
) {
|
||||||
actual_duration_in_days++;
|
actual_duration_in_days++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(this.actual_duration_in_days);
|
||||||
this.actual_duration_in_days = actual_duration_in_days;
|
this.actual_duration_in_days = actual_duration_in_days;
|
||||||
|
|
||||||
this.duration =
|
this.duration =
|
||||||
@ -644,18 +646,24 @@ export default class Bar {
|
|||||||
update_progressbar_position() {
|
update_progressbar_position() {
|
||||||
if (this.invalid || this.gantt.options.readonly) return;
|
if (this.invalid || this.gantt.options.readonly) return;
|
||||||
this.$bar_progress.setAttribute('x', this.$bar.getX());
|
this.$bar_progress.setAttribute('x', this.$bar.getX());
|
||||||
let new_width =
|
|
||||||
this.actual_duration *
|
const ignored_end = this.x + this.$bar.getWidth();
|
||||||
this.gantt.config.column_width *
|
const progress_end = this.x + this.progress_width;
|
||||||
(this.task.progress / 100);
|
const total_ignored_area =
|
||||||
const progress_area = this.x + this.progress_width;
|
|
||||||
new_width +=
|
|
||||||
this.gantt.config.ignored_positions.reduce((acc, val) => {
|
this.gantt.config.ignored_positions.reduce((acc, val) => {
|
||||||
return acc + (val >= this.x && val <= progress_area);
|
return acc + (val >= this.x && val < ignored_end);
|
||||||
|
}, 0) * this.gantt.config.column_width;
|
||||||
|
const progress_ignored_area =
|
||||||
|
this.gantt.config.ignored_positions.reduce((acc, val) => {
|
||||||
|
return acc + (val >= this.x && val < progress_end);
|
||||||
}, 0) * this.gantt.config.column_width;
|
}, 0) * this.gantt.config.column_width;
|
||||||
|
|
||||||
this.progress_width = new_width;
|
let new_width =
|
||||||
this.$bar_progress.setAttribute('width', new_width);
|
(this.duration * this.gantt.config.column_width -
|
||||||
|
total_ignored_area) *
|
||||||
|
(this.task.progress / 100);
|
||||||
|
this.progress_width = progress_ignored_area + new_width;
|
||||||
|
this.$bar_progress.setAttribute('width', this.progress_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_label_position() {
|
update_label_position() {
|
||||||
|
|||||||
@ -119,14 +119,7 @@ const DEFAULT_OPTIONS = {
|
|||||||
view_mode_select: false,
|
view_mode_select: false,
|
||||||
default_snap: '1d',
|
default_snap: '1d',
|
||||||
holiday_highlight: {
|
holiday_highlight: {
|
||||||
green: [
|
green: 'weekend',
|
||||||
'2024-03-01',
|
|
||||||
'2024-03-02',
|
|
||||||
'2024-03-03',
|
|
||||||
'2024-03-04',
|
|
||||||
'2024-03-05',
|
|
||||||
'2024-03-06',
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
ignore: [],
|
ignore: [],
|
||||||
};
|
};
|
||||||
|
|||||||
@ -683,7 +683,7 @@ export default class Gantt {
|
|||||||
!this.config.ignored_function(d))
|
!this.config.ignored_function(d))
|
||||||
)
|
)
|
||||||
continue;
|
continue;
|
||||||
console.log(this.config.ignored_function);
|
|
||||||
let diff =
|
let diff =
|
||||||
date_utils.convert_scales(
|
date_utils.convert_scales(
|
||||||
date_utils.diff(d, this.gantt_start) + 'd',
|
date_utils.diff(d, this.gantt_start) + 'd',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user