Reworked the channel tree selected lines
This commit is contained in:
parent
7b5eecbc2d
commit
e092dcc33c
5 changed files with 44 additions and 20 deletions
|
@ -10,6 +10,7 @@
|
||||||
- Fixed query visibility setting
|
- Fixed query visibility setting
|
||||||
- Removed useless client infos for query clients
|
- Removed useless client infos for query clients
|
||||||
- Added an auto reconnect system
|
- Added an auto reconnect system
|
||||||
|
- Reworked the channel tree selected lines
|
||||||
|
|
||||||
* **15.02.19**
|
* **15.02.19**
|
||||||
- Fixed MS Edge loading/document issues
|
- Fixed MS Edge loading/document issues
|
||||||
|
|
|
@ -17,6 +17,7 @@ interface JQuery<TElement = HTMLElement> {
|
||||||
|
|
||||||
|
|
||||||
visible_height() : number;
|
visible_height() : number;
|
||||||
|
visible_width() : number;
|
||||||
|
|
||||||
/* bootstrap */
|
/* bootstrap */
|
||||||
alert() : JQuery<TElement>;
|
alert() : JQuery<TElement>;
|
||||||
|
@ -151,7 +152,19 @@ if(typeof ($) !== "undefined") {
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = this.height();
|
const result = this.height();
|
||||||
console.log(original_style);
|
this.attr("style", original_style || "");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if(!$.fn.visible_width)
|
||||||
|
$.fn.visible_width = function (this: JQuery<HTMLElement>) {
|
||||||
|
const original_style = this.attr("style");
|
||||||
|
this.css({
|
||||||
|
position: 'absolute!important',
|
||||||
|
visibility: 'hidden!important',
|
||||||
|
display: 'block!important'
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = this.width();
|
||||||
this.attr("style", original_style || "");
|
this.attr("style", original_style || "");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ class ChannelEntry {
|
||||||
let current = entry.currentChannel();
|
let current = entry.currentChannel();
|
||||||
if(deep) {
|
if(deep) {
|
||||||
while(current) {
|
while(current) {
|
||||||
if(current.parent_channel() == self) {
|
if(current == self) {
|
||||||
result.push(entry);
|
result.push(entry);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -171,15 +171,16 @@ class ChannelEntry {
|
||||||
return clients;
|
return clients;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_family_index() {
|
update_family_index(enforce?: boolean) {
|
||||||
const current_index = this._family_index;
|
const current_index = this._family_index;
|
||||||
const new_index = this.calculate_family_index(true);
|
const new_index = this.calculate_family_index(true);
|
||||||
if(current_index == new_index) return;
|
if(current_index == new_index && !enforce) return;
|
||||||
|
|
||||||
this._tag_channel.css("z-index", this._family_index);
|
this._tag_channel.css("z-index", this._family_index);
|
||||||
|
this._tag_channel.css("padding-left", (this._family_index + 1) * 16 + "px");
|
||||||
}
|
}
|
||||||
|
|
||||||
private calculate_family_index(enforce_recalculate: boolean = false) : number {
|
calculate_family_index(enforce_recalculate: boolean = false) : number {
|
||||||
if(this._family_index !== undefined && !enforce_recalculate)
|
if(this._family_index !== undefined && !enforce_recalculate)
|
||||||
return this._family_index;
|
return this._family_index;
|
||||||
|
|
||||||
|
@ -202,7 +203,6 @@ class ChannelEntry {
|
||||||
|
|
||||||
container_entry.attr("channel-id", this.channelId);
|
container_entry.attr("channel-id", this.channelId);
|
||||||
container_entry.addClass(this._channel_name_alignment);
|
container_entry.addClass(this._channel_name_alignment);
|
||||||
container_entry.css('z-index', this.calculate_family_index());
|
|
||||||
|
|
||||||
/* channel icon (type) */
|
/* channel icon (type) */
|
||||||
{
|
{
|
||||||
|
@ -290,6 +290,7 @@ class ChannelEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
tag_channel.append(this._tag_channel = container_entry);
|
tag_channel.append(this._tag_channel = container_entry);
|
||||||
|
this.update_family_index(true);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const container_client = $.spawn("div").addClass("container-clients");
|
const container_client = $.spawn("div").addClass("container-clients");
|
||||||
|
|
|
@ -762,6 +762,13 @@ class ClientEntry {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_family_index() {
|
||||||
|
if(!this._channel) return;
|
||||||
|
const index = this._channel.calculate_family_index();
|
||||||
|
|
||||||
|
this.tag.css('padding-left', (index + 2) * 16 + "px");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LocalClientEntry extends ClientEntry {
|
class LocalClientEntry extends ClientEntry {
|
||||||
|
|
|
@ -236,7 +236,6 @@ class ChannelTree {
|
||||||
this.channel_first = channel.channel_next;
|
this.channel_first = channel.channel_next;
|
||||||
|
|
||||||
|
|
||||||
let oldParent = channel.parent_channel();
|
|
||||||
channel.channel_next = undefined;
|
channel.channel_next = undefined;
|
||||||
channel.channel_previous = channel_previous;
|
channel.channel_previous = channel_previous;
|
||||||
channel.parent = parent;
|
channel.parent = parent;
|
||||||
|
@ -253,19 +252,18 @@ class ChannelTree {
|
||||||
channel.channel_next.channel_previous = channel;
|
channel.channel_next.channel_previous = channel;
|
||||||
} else {
|
} else {
|
||||||
if(parent) {
|
if(parent) {
|
||||||
let siblings = parent.children();
|
let children = parent.children();
|
||||||
if(siblings.length <= 1) { //Self should be already in there
|
if(children.length <= 1) { //Self should be already in there
|
||||||
let left = channel.rootTag();
|
let left = channel.rootTag();
|
||||||
left.appendTo(parent.siblingTag());
|
left.appendTo(parent.siblingTag());
|
||||||
|
|
||||||
channel.channel_next = undefined;
|
channel.channel_next = undefined;
|
||||||
} else {
|
} else {
|
||||||
channel.channel_previous = siblings[siblings.length - 2];
|
channel.channel_previous = undefined;
|
||||||
channel.channel_previous.rootTag().after(channel.rootTag());
|
channel.rootTag().prependTo(parent.siblingTag());
|
||||||
|
|
||||||
channel.channel_next = channel.channel_previous.channel_next;
|
channel.channel_next = children[1]; /* children 0 shall be the channel itself */
|
||||||
channel.channel_next.channel_previous = channel;
|
channel.channel_next.channel_previous = channel;
|
||||||
channel.channel_previous.channel_next = channel;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.htmlTree.find(".server").after(channel.rootTag());
|
this.htmlTree.find(".server").after(channel.rootTag());
|
||||||
|
@ -279,10 +277,17 @@ class ChannelTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
channel.update_family_index();
|
channel.update_family_index();
|
||||||
if(channel.channel_previous == channel) /* shall never happen */
|
channel.children(true).forEach(e => e.update_family_index());
|
||||||
|
channel.clients(true).forEach(e => e.update_family_index());
|
||||||
|
|
||||||
|
if(channel.channel_previous == channel) { /* shall never happen */
|
||||||
channel.channel_previous = undefined;
|
channel.channel_previous = undefined;
|
||||||
if(channel.channel_next == channel) /* shall never happen */
|
debugger;
|
||||||
|
}
|
||||||
|
if(channel.channel_next == channel) { /* shall never happen */
|
||||||
channel.channel_next = undefined;
|
channel.channel_next = undefined;
|
||||||
|
debugger;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteClient(client: ClientEntry) {
|
deleteClient(client: ClientEntry) {
|
||||||
|
@ -312,6 +317,7 @@ class ChannelTree {
|
||||||
client.currentChannel().reorderClients();
|
client.currentChannel().reorderClients();
|
||||||
|
|
||||||
channel.updateChannelTypeIcon();
|
channel.updateChannelTypeIcon();
|
||||||
|
client.update_family_index();
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,11 +326,6 @@ class ChannelTree {
|
||||||
client.channelTree = this;
|
client.channelTree = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
reorderAllClients() {
|
|
||||||
for(let channel of this.channels)
|
|
||||||
channel.reorderClients();
|
|
||||||
}
|
|
||||||
|
|
||||||
moveClient(client: ClientEntry, channel: ChannelEntry) {
|
moveClient(client: ClientEntry, channel: ChannelEntry) {
|
||||||
let oldChannel = client.currentChannel();
|
let oldChannel = client.currentChannel();
|
||||||
client["_channel"] = channel;
|
client["_channel"] = channel;
|
||||||
|
@ -340,6 +341,7 @@ class ChannelTree {
|
||||||
client.currentChannel().updateChannelTypeIcon();
|
client.currentChannel().updateChannelTypeIcon();
|
||||||
}
|
}
|
||||||
client.updateClientStatusIcons();
|
client.updateClientStatusIcons();
|
||||||
|
client.update_family_index();
|
||||||
}
|
}
|
||||||
|
|
||||||
findClient?(clientId: number) : ClientEntry {
|
findClient?(clientId: number) : ClientEntry {
|
||||||
|
|
Loading…
Add table
Reference in a new issue