Handle double tab as if it was a double_click

This commit is contained in:
Luigi Trabacchin 2025-02-20 23:33:48 +01:00 committed by Safwan Samsudeen
parent 7419b37847
commit 108eeb5898

View File

@ -85,8 +85,8 @@ export default class Bar {
this.compute_expected_progress(); this.compute_expected_progress();
this.expected_progress_width = this.expected_progress_width =
this.gantt.options.column_width * this.gantt.options.column_width *
this.duration * this.duration *
(this.expected_progress / 100) || 0; (this.expected_progress / 100) || 0;
} }
draw() { draw() {
@ -385,6 +385,27 @@ export default class Bar {
}); });
$.on(this.group, 'dblclick', (e) => { $.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) { if (this.action_completed) {
// just finished a move action, wait for a few seconds // just finished a move action, wait for a few seconds
return; return;
@ -528,7 +549,7 @@ export default class Bar {
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 <= progress_area);
}, 0) * }, 0) *
this.gantt.config.column_width; this.gantt.config.column_width;
if (progress < 0) return 0; if (progress < 0) return 0;
const total = const total =
this.$bar.getWidth() - this.$bar.getWidth() -
@ -642,8 +663,8 @@ export default class Bar {
this.$expected_bar_progress.setAttribute( this.$expected_bar_progress.setAttribute(
'width', 'width',
this.gantt.config.column_width * this.gantt.config.column_width *
this.actual_duration_raw * this.actual_duration_raw *
(this.expected_progress / 100) || 0, (this.expected_progress / 100) || 0,
); );
} }