Added double touch

This commit is contained in:
WolverinDEV 2019-03-06 12:11:34 +01:00
parent ac5245de30
commit 96bf77912b

View file

@ -359,17 +359,35 @@ class ChannelEntry {
} }
initializeListener() { initializeListener() {
const _this = this; const tag_channel = this.channelTag();
this.channelTag().click(function () { tag_channel.on('click', () => this.channelTree.onSelect(this));
_this.channelTree.onSelect(_this); tag_channel.on('dblclick', () => {
});
this.channelTag().dblclick(() => {
if($.isArray(this.channelTree.currently_selected)) { //Multiselect if($.isArray(this.channelTree.currently_selected)) { //Multiselect
return; return;
} }
this.joinChannel() this.joinChannel()
}); });
let last_touch: number = 0;
let touch_start: number = 0;
tag_channel.on('touchend', event => {
/* if over 250ms then its not a click its more a drag */
if(Date.now() - touch_start > 250) {
touch_start = 0;
return;
}
if(Date.now() - last_touch > 750) {
last_touch = Date.now();
return;
}
last_touch = Date.now();
/* double touch */
tag_channel.trigger('dblclick');
});
tag_channel.on('touchstart', event => {
touch_start = Date.now();
});
if(!settings.static(Settings.KEY_DISABLE_CONTEXT_MENU, false)) { if(!settings.static(Settings.KEY_DISABLE_CONTEXT_MENU, false)) {
this.channelTag().on("contextmenu", (event) => { this.channelTag().on("contextmenu", (event) => {
event.preventDefault(); event.preventDefault();
@ -378,9 +396,9 @@ class ChannelEntry {
return; return;
} }
_this.channelTree.onSelect(_this, true); this.channelTree.onSelect(this, true);
_this.showContextMenu(event.pageX, event.pageY, () => { this.showContextMenu(event.pageX, event.pageY, () => {
_this.channelTree.onSelect(undefined, true); this.channelTree.onSelect(undefined, true);
}); });
}); });
} }