From 108eeb5898043eb870a47617a878bb253237c324 Mon Sep 17 00:00:00 2001 From: Luigi Trabacchin Date: Thu, 20 Feb 2025 23:33:48 +0100 Subject: [PATCH] Handle double tab as if it was a double_click --- src/bar.js | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/bar.js b/src/bar.js index e27a85b..1315200 100644 --- a/src/bar.js +++ b/src/bar.js @@ -85,8 +85,8 @@ export default class Bar { this.compute_expected_progress(); this.expected_progress_width = this.gantt.options.column_width * - this.duration * - (this.expected_progress / 100) || 0; + this.duration * + (this.expected_progress / 100) || 0; } draw() { @@ -385,6 +385,27 @@ export default class Bar { }); $.on(this.group, 'dblclick', (e) => { + if (this.action_completed) { + // just finished a move action, wait for a few seconds + return; + } + this.group.classList.remove('active'); + if (this.gantt.popup) + this.gantt.popup.parent.classList.remove('hide'); + + this.gantt.trigger_event('double_click', [this.task]); + }); + let tapedTwice = false; + $.on(this.group, 'touchstart', (e) => { + if (!tapedTwice) { + tapedTwice = true; + setTimeout(function () { tapedTwice = false; }, 300); + return false; + } + e.preventDefault(); + //action on double tap goes below + + if (this.action_completed) { // just finished a move action, wait for a few seconds return; @@ -528,7 +549,7 @@ export default class Bar { this.gantt.config.ignored_positions.reduce((acc, val) => { return acc + (val >= this.x && val <= progress_area); }, 0) * - this.gantt.config.column_width; + this.gantt.config.column_width; if (progress < 0) return 0; const total = this.$bar.getWidth() - @@ -642,8 +663,8 @@ export default class Bar { this.$expected_bar_progress.setAttribute( 'width', this.gantt.config.column_width * - this.actual_duration_raw * - (this.expected_progress / 100) || 0, + this.actual_duration_raw * + (this.expected_progress / 100) || 0, ); }