fixed repetitive channel names
This commit is contained in:
parent
b640adaef3
commit
7b5eecbc2d
3 changed files with 30 additions and 13 deletions
|
@ -98,6 +98,9 @@
|
|||
|
||||
justify-content: left;
|
||||
|
||||
max-width: 100%; /* important for the repetitive channel name! */
|
||||
overflow: hidden;
|
||||
|
||||
&.align-right {
|
||||
justify-content: right;
|
||||
}
|
||||
|
|
|
@ -562,26 +562,38 @@ class ChannelEntry {
|
|||
if(this._channel_name_formatted !== undefined) {
|
||||
tag_container_name.addClass(this._channel_name_alignment);
|
||||
|
||||
if(this._channel_name_alignment == "*") {
|
||||
let lastSuccess = "";
|
||||
let index = 6;
|
||||
if(this._channel_name_alignment == "align-repetitive") {
|
||||
if(tag_name.parent().width() != 0) {
|
||||
let lastSuccess = "";
|
||||
let index = 6;
|
||||
|
||||
let name = this.formattedChannelName();
|
||||
while(index-- > 0)
|
||||
name = name + name;
|
||||
tag_name.text(name);
|
||||
do {
|
||||
tag_name.text(name = name + name);
|
||||
} while (tag_name.parent().width() >= tag_name.width() && ++index < 64);
|
||||
if(index == 64) console.warn(LogCategory.CHANNEL, tr("Repeating spacer took too much repeats!"));
|
||||
if(lastSuccess.length > 0) {
|
||||
tag_name.text(lastSuccess);
|
||||
let name = this._channel_name_formatted;
|
||||
if(name.length < 1) throw "invalid name!";
|
||||
|
||||
while(index-- > 0)
|
||||
name = name + name;
|
||||
tag_name.text(name);
|
||||
do {
|
||||
tag_name.text(name = name + name);
|
||||
if(name.length > 1024 * 8)
|
||||
index = 63;
|
||||
} while (tag_name.parent().width() >= tag_name.width() && ++index < 64);
|
||||
if(index == 64)
|
||||
console.warn(LogCategory.CHANNEL, tr("Repeating spacer took too much repeats!"));
|
||||
if(lastSuccess.length > 0) {
|
||||
tag_name.text(lastSuccess);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(tr("Align: %s"), this._channel_name_alignment);
|
||||
}
|
||||
|
||||
recalculate_repetitive_name() {
|
||||
if(this._channel_name_alignment == "align-repetitive")
|
||||
this.__updateChannelName();
|
||||
}
|
||||
|
||||
updateVariables(...variables: {key: string, value: string}[]) {
|
||||
let group = log.group(log.LogType.DEBUG, LogCategory.CHANNEL_PROPERTIES, tr("Update properties (%i) of %s (%i)"), variables.length, this.channelName(), this.getChannelId());
|
||||
|
||||
|
|
|
@ -75,6 +75,8 @@ class ChannelTree {
|
|||
show_channel_tree() {
|
||||
this._tree_detached = false;
|
||||
this.htmlTree.appendTo(this.htmlTree_parent);
|
||||
|
||||
this.channels.forEach(e => e.recalculate_repetitive_name());
|
||||
}
|
||||
|
||||
showContextMenu(x: number, y: number, on_close: () => void = undefined) {
|
||||
|
|
Loading…
Add table
Reference in a new issue