fix: date highlight resizes

This commit is contained in:
Safwan Samsudeen 2024-04-22 19:28:38 +05:30
parent ecbec30fd7
commit 591b599b51
2 changed files with 9 additions and 5 deletions

View File

@ -340,9 +340,11 @@ export default class Bar {
return;
}
this.update_attr(bar, "x", x);
this.update_attr(this.$date_highlight, "x", x);
}
if (width) {
this.update_attr(bar, "width", width);
this.update_attr(this.$date_highlight, "width", width);
}
this.update_label_position();
this.update_handle_position();

View File

@ -101,7 +101,8 @@ export default class Gantt {
readonly: false,
highlight_weekend: true,
scroll_today: true,
lines: 'both'
lines: 'both',
auto_move_label: true,
};
this.options = Object.assign({}, default_options, options);
if (!options.view_mode_padding) options.view_mode_padding = {}
@ -854,10 +855,11 @@ export default class Gantt {
if (dx) {
localBars = ids.map(id => this.get_bar(id));
localBars.forEach(bar => {
bar.update_label_position_on_horizontal_scroll({ x: dx, sx: e.currentTarget.scrollLeft });
});
if (this.options.auto_move_label) {
localBars.forEach(bar => {
bar.update_label_position_on_horizontal_scroll({ x: dx, sx: e.currentTarget.scrollLeft });
});
}
}
x_on_scroll_start = e.currentTarget.scrollLeft;