From 7f5f802b86c7101a2567b2f61d74559061646db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Mon, 24 Aug 2020 18:23:02 +0200 Subject: [PATCH] Avoiding flickering when entering presentation mode with no presentation --- front/src/WebRtc/LayoutManager.ts | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/front/src/WebRtc/LayoutManager.ts b/front/src/WebRtc/LayoutManager.ts index c2bb683e..575b0bb2 100644 --- a/front/src/WebRtc/LayoutManager.ts +++ b/front/src/WebRtc/LayoutManager.ts @@ -208,8 +208,8 @@ class LayoutManager { const mainSectionChildren = Array.from(document.querySelectorAll('div.main-section > div').values()); const sidebarChildren = Array.from(document.querySelectorAll('aside.sidebar > div').values()); - // Nothing? Let's center - if (mainSectionChildren.length === 0 && sidebarChildren.length === 0) { + // No presentation? Let's center on the screen + if (mainSectionChildren.length === 0) { return { xStart: 0, yStart: 0, @@ -218,18 +218,6 @@ class LayoutManager { } } - if (mainSectionChildren.length === 0) { - const lastSidebarDiv = sidebarChildren[sidebarChildren.length-1]; - - // No presentation? Let's center on the main-section space - return { - xStart: 0, - yStart: 0, - xEnd: lastSidebarDiv.offsetLeft, - yEnd: window.innerHeight - } - } - // At this point, we know we have at least one element in the main section. const lastPresentationDiv = mainSectionChildren[mainSectionChildren.length-1];