From 591b599b5127def6095de3517273751b6be25d9e Mon Sep 17 00:00:00 2001 From: Safwan Samsudeen Date: Mon, 22 Apr 2024 19:28:38 +0530 Subject: [PATCH] fix: date highlight resizes --- src/bar.js | 2 ++ src/index.js | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/bar.js b/src/bar.js index a8d4cec..95b351d 100644 --- a/src/bar.js +++ b/src/bar.js @@ -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(); diff --git a/src/index.js b/src/index.js index a1f1816..2c3e2fc 100644 --- a/src/index.js +++ b/src/index.js @@ -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;