Adjusting class in chat mode based on number of divs displayed.
This commit is contained in:
parent
7232bbaef9
commit
83fe024c45
@ -43,6 +43,7 @@ export class LayoutManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.positionDiv(div, importance);
|
this.positionDiv(div, importance);
|
||||||
|
this.adjustVideoChatClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
private positionDiv(elem: HTMLDivElement, importance: DivImportance): void {
|
private positionDiv(elem: HTMLDivElement, importance: DivImportance): void {
|
||||||
@ -68,6 +69,7 @@ export class LayoutManager {
|
|||||||
if (div !== undefined) {
|
if (div !== undefined) {
|
||||||
div.remove();
|
div.remove();
|
||||||
this.importantDivs.delete(userId);
|
this.importantDivs.delete(userId);
|
||||||
|
this.adjustVideoChatClass();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,12 +77,30 @@ export class LayoutManager {
|
|||||||
if (div !== undefined) {
|
if (div !== undefined) {
|
||||||
div.remove();
|
div.remove();
|
||||||
this.normalDivs.delete(userId);
|
this.normalDivs.delete(userId);
|
||||||
|
this.adjustVideoChatClass();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error('Could not find user ID "'+userId+'"');
|
throw new Error('Could not find user ID "'+userId+'"');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private adjustVideoChatClass(): void {
|
||||||
|
const chatModeDiv = HtmlUtils.getElementByIdOrFail<HTMLDivElement>('chat-mode');
|
||||||
|
chatModeDiv.classList.remove('one-col', 'two-col', 'three-col', 'four-col');
|
||||||
|
|
||||||
|
const nbUsers = this.importantDivs.size + this.normalDivs.size;
|
||||||
|
|
||||||
|
if (nbUsers <= 1) {
|
||||||
|
chatModeDiv.classList.add('one-col');
|
||||||
|
} else if (nbUsers <= 4) {
|
||||||
|
chatModeDiv.classList.add('two-col');
|
||||||
|
} else if (nbUsers <= 9) {
|
||||||
|
chatModeDiv.classList.add('three-col');
|
||||||
|
} else {
|
||||||
|
chatModeDiv.classList.add('four-col');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private switchLayoutMode(layoutMode: LayoutMode) {
|
private switchLayoutMode(layoutMode: LayoutMode) {
|
||||||
this.mode = layoutMode;
|
this.mode = layoutMode;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user