Fixed local client select #2

This commit is contained in:
WolverinDEV 2018-11-04 15:59:54 +01:00
parent 5ffef4383d
commit d247c5757b
2 changed files with 7 additions and 2 deletions

View file

@ -96,10 +96,11 @@ class ClientEntry {
this._listener_initialized = true; this._listener_initialized = true;
this.tag.click(event => { this.tag.click(event => {
console.log("Clicked!");
this.channelTree.onSelect(this); this.channelTree.onSelect(this);
}); });
if(this.clientId() != this.channelTree.client.clientId && !(this instanceof MusicClientEntry)) if(!(this instanceof LocalClientEntry) && !(this instanceof MusicClientEntry))
this.tag.dblclick(event => { this.tag.dblclick(event => {
if($.isArray(this.channelTree.currently_selected)) { //Multiselect if($.isArray(this.channelTree.currently_selected)) { //Multiselect
return; return;

View file

@ -34,6 +34,10 @@ class ChannelTree {
this.htmlTree.parent().on("contextmenu", (event) => { this.htmlTree.parent().on("contextmenu", (event) => {
if(event.isDefaultPrevented()) return; if(event.isDefaultPrevented()) return;
for(const element of document.elementsFromPoint(event.pageX, event.pageY))
if(element.classList.contains("channelLine") || element.classList.contains("client"))
return;
event.preventDefault(); event.preventDefault();
if($.isArray(this.currently_selected)) { //Multiselect if($.isArray(this.currently_selected)) { //Multiselect
(this.currently_selected_context_callback || ((_) => null))(event); (this.currently_selected_context_callback || ((_) => null))(event);
@ -472,7 +476,7 @@ class ChannelTree {
this.server = null; this.server = null;
this.clients = []; this.clients = [];
this.channels = []; this.channels = [];
this.htmlTree.empty(); this.htmlTree.children().detach(); //Do not remove the listener!
} }
spawnCreateChannel(parent?: ChannelEntry) { spawnCreateChannel(parent?: ChannelEntry) {