Skip to content

Commit 108eeb5

Browse files
TrabacchinLuigisafwansamsudeen
authored andcommitted
Handle double tab as if it was a double_click
1 parent 7419b37 commit 108eeb5

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

src/bar.js

+26-5
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ export default class Bar {
8585
this.compute_expected_progress();
8686
this.expected_progress_width =
8787
this.gantt.options.column_width *
88-
this.duration *
89-
(this.expected_progress / 100) || 0;
88+
this.duration *
89+
(this.expected_progress / 100) || 0;
9090
}
9191

9292
draw() {
@@ -385,6 +385,27 @@ export default class Bar {
385385
});
386386

387387
$.on(this.group, 'dblclick', (e) => {
388+
if (this.action_completed) {
389+
// just finished a move action, wait for a few seconds
390+
return;
391+
}
392+
this.group.classList.remove('active');
393+
if (this.gantt.popup)
394+
this.gantt.popup.parent.classList.remove('hide');
395+
396+
this.gantt.trigger_event('double_click', [this.task]);
397+
});
398+
let tapedTwice = false;
399+
$.on(this.group, 'touchstart', (e) => {
400+
if (!tapedTwice) {
401+
tapedTwice = true;
402+
setTimeout(function () { tapedTwice = false; }, 300);
403+
return false;
404+
}
405+
e.preventDefault();
406+
//action on double tap goes below
407+
408+
388409
if (this.action_completed) {
389410
// just finished a move action, wait for a few seconds
390411
return;
@@ -528,7 +549,7 @@ export default class Bar {
528549
this.gantt.config.ignored_positions.reduce((acc, val) => {
529550
return acc + (val >= this.x && val <= progress_area);
530551
}, 0) *
531-
this.gantt.config.column_width;
552+
this.gantt.config.column_width;
532553
if (progress < 0) return 0;
533554
const total =
534555
this.$bar.getWidth() -
@@ -642,8 +663,8 @@ export default class Bar {
642663
this.$expected_bar_progress.setAttribute(
643664
'width',
644665
this.gantt.config.column_width *
645-
this.actual_duration_raw *
646-
(this.expected_progress / 100) || 0,
666+
this.actual_duration_raw *
667+
(this.expected_progress / 100) || 0,
647668
);
648669
}
649670

0 commit comments

Comments
 (0)