restore resize in custom layout

This commit is contained in:
Ramón Souza 2023-11-16 17:08:13 -03:00
parent 1f14f9a333
commit 4edd0a19b1

View File

@ -1,9 +1,9 @@
import React, { useContext } from 'react'; import React, { useContext } from 'react';
import { withTracker } from 'meteor/react-meteor-data'; import { withTracker } from 'meteor/react-meteor-data';
import MediaService from '/imports/ui/components/media/service';
import Auth from '/imports/ui/services/auth'; import Auth from '/imports/ui/services/auth';
import VideoService from '/imports/ui/components/video-provider/service'; import VideoService from '/imports/ui/components/video-provider/service';
import { useSubscription } from '@apollo/client';
import { UsersContext } from '../components-data/users-context/context'; import { UsersContext } from '../components-data/users-context/context';
import { import {
layoutSelect, layoutSelect,
@ -14,14 +14,16 @@ import {
import WebcamComponent from '/imports/ui/components/webcam/component'; import WebcamComponent from '/imports/ui/components/webcam/component';
import { LAYOUT_TYPE } from '../layout/enums'; import { LAYOUT_TYPE } from '../layout/enums';
import { sortVideoStreams } from '/imports/ui/components/video-provider/stream-sorting'; import { sortVideoStreams } from '/imports/ui/components/video-provider/stream-sorting';
import {
CURRENT_PRESENTATION_PAGE_SUBSCRIPTION,
} from '/imports/ui/components/whiteboard/queries';
const { defaultSorting: DEFAULT_SORTING } = Meteor.settings.public.kurento.cameraSortingModes; const { defaultSorting: DEFAULT_SORTING } = Meteor.settings.public.kurento.cameraSortingModes;
const WebcamContainer = ({ const WebcamContainer = ({
audioModalIsOpen, audioModalIsOpen,
swapLayout,
usersVideo, usersVideo,
layoutType, layoutType,
isLayoutSwapped,
}) => { }) => {
const fullscreen = layoutSelect((i) => i.fullscreen); const fullscreen = layoutSelect((i) => i.fullscreen);
const isRTL = layoutSelect((i) => i.isRTL); const isRTL = layoutSelect((i) => i.isRTL);
@ -30,6 +32,19 @@ const WebcamContainer = ({
const presentation = layoutSelectOutput((i) => i.presentation); const presentation = layoutSelectOutput((i) => i.presentation);
const cameraDock = layoutSelectOutput((i) => i.cameraDock); const cameraDock = layoutSelectOutput((i) => i.cameraDock);
const layoutContextDispatch = layoutDispatch(); const layoutContextDispatch = layoutDispatch();
const { data: presentationPageData } = useSubscription(CURRENT_PRESENTATION_PAGE_SUBSCRIPTION);
const presentationPage = presentationPageData?.pres_page_curr[0] || {};
const hasPresentation = !!presentationPage?.presentationId;
const swapLayout = !hasPresentation || isLayoutSwapped;
let floatingOverlay = false;
let hideOverlay = false;
if (swapLayout) {
floatingOverlay = true;
hideOverlay = true;
}
const { cameraOptimalGridSize } = cameraDockInput; const { cameraOptimalGridSize } = cameraDockInput;
const { display: displayPresentation } = presentation; const { display: displayPresentation } = presentation;
@ -56,14 +71,15 @@ const WebcamContainer = ({
displayPresentation, displayPresentation,
isRTL, isRTL,
isGridEnabled, isGridEnabled,
floatingOverlay,
hideOverlay,
}} }}
/> />
) )
: null; : null;
}; };
export default withTracker((props) => { export default withTracker(() => {
const { current_presentation: hasPresentation } = MediaService.getPresentationInfo();
const data = { const data = {
audioModalIsOpen: Session.get('audioModalIsOpen'), audioModalIsOpen: Session.get('audioModalIsOpen'),
isMeteorConnected: Meteor.status().connected, isMeteorConnected: Meteor.status().connected,
@ -77,12 +93,6 @@ export default withTracker((props) => {
} else { } else {
data.usersVideo = usersVideo; data.usersVideo = usersVideo;
} }
data.swapLayout = !hasPresentation || props.isLayoutSwapped;
if (data.swapLayout) {
data.floatingOverlay = true;
data.hideOverlay = true;
}
return data; return data;
})(WebcamContainer); })(WebcamContainer);