diff --git a/bigbluebutton-html5/imports/ui/components/presentation/component.jsx b/bigbluebutton-html5/imports/ui/components/presentation/component.jsx index e84579324e..d4c50b6016 100755 --- a/bigbluebutton-html5/imports/ui/components/presentation/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/component.jsx @@ -77,6 +77,7 @@ class Presentation extends PureComponent { isPanning: false, tldrawIsMounting: true, isToolbarVisible: true, + hadPresentation: false, }; this.currentPresentationToastId = null; @@ -136,9 +137,15 @@ class Presentation extends PureComponent { window.addEventListener('resize', this.onResize, false); const { - currentSlide, slidePosition, numPages, layoutContextDispatch, + currentSlide, slidePosition, numPages, layoutContextDispatch, currentPresentationId, } = this.props; + if (currentPresentationId) { + this.setState({ + hadPresentation: true + }); + } + if (currentSlide) { layoutContextDispatch({ type: ACTIONS.SET_PRESENTATION_NUM_CURRENT_SLIDE, @@ -178,7 +185,7 @@ class Presentation extends PureComponent { } = this.props; const { - presentationWidth, presentationHeight, zoom, isPanning, fitToWidth, presentationId, + presentationWidth, presentationHeight, zoom, isPanning, fitToWidth, presentationId, hadPresentation, } = this.state; const { numCameras: prevNumCameras, @@ -258,22 +265,28 @@ class Presentation extends PureComponent { }); } const presentationChanged = presentationId !== currentPresentationId; - if (presentationChanged) { - this.setState({ - presentationId: currentPresentationId, - }); - } + + // TODO: this information should be received from server + const isInitialPresentation = currentPresentation.name === 'default.pdf'; + if (!presentationIsOpen && restoreOnUpdate && (currentSlide || presentationChanged)) { const slideChanged = currentSlide.id !== prevProps.currentSlide.id; const positionChanged = slidePosition .viewBoxHeight !== prevProps.slidePosition.viewBoxHeight || slidePosition.viewBoxWidth !== prevProps.slidePosition.viewBoxWidth; const pollPublished = publishedPoll && !prevProps.publishedPoll; - if (slideChanged || positionChanged || pollPublished || presentationChanged) { + if (slideChanged || positionChanged || pollPublished || (presentationChanged && (hadPresentation || !isInitialPresentation))) { setPresentationIsOpen(layoutContextDispatch, !presentationIsOpen); } } + if (presentationChanged) { + this.setState({ + presentationId: currentPresentationId, + hadPresentation: true + }); + } + if ((presentationBounds !== prevPresentationBounds) || (!presentationWidth && !presentationHeight)) this.onResize(); } else if (slidePosition) {