From c815dcd31a452b68e179e4bdfb1eef96744ab402 Mon Sep 17 00:00:00 2001 From: Safwan Samsudeen Date: Sun, 14 Apr 2024 17:21:01 +0530 Subject: [PATCH] fix: progress bug, deselect bar by double click --- src/bar.js | 13 ++++++++++--- src/index.js | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/bar.js b/src/bar.js index 746f412..f2b9360 100644 --- a/src/bar.js +++ b/src/bar.js @@ -255,15 +255,22 @@ export default class Bar { } setup_click_event() { + let in_action = false; $.on(this.group, "focus " + this.gantt.options.popup_trigger, (e) => { if (this.action_completed) { // just finished a move action, wait for a few seconds return; } + if (in_action) { + this.gantt.hide_popup(); + this.group.classList.remove("active"); + } else { + this.show_popup(); + this.gantt.unselect_all(); + this.group.classList.add("active"); + } - this.show_popup(); - this.gantt.unselect_all(); - this.group.classList.add("active"); + in_action = !in_action }); $.on(this.group, "dblclick", (e) => { diff --git a/src/index.js b/src/index.js index cdb7568..aac473c 100644 --- a/src/index.js +++ b/src/index.js @@ -950,11 +950,11 @@ export default class Gantt { if (!($bar_progress && $bar_progress.finaldx)) return; $bar_progress.finaldx = 0; + bar.progress_changed(); + bar.set_action_completed(); bar = null; $bar_progress = null; $bar = null; - bar.progress_changed(); - bar.set_action_completed(); }); }