Fix presentation size

This commit is contained in:
Vitor Mateus 2020-05-07 18:27:00 -03:00 committed by Vitor Mateus De Almeida
parent a9037224c7
commit b93e99b1c3
3 changed files with 38 additions and 13 deletions

View File

@ -255,6 +255,9 @@ class LayoutManager extends Component {
}; };
} }
console.log('>> webcamsAreaUserSetsWidth', webcamsAreaUserSetsWidth);
if (presentationWidth === null || presentationHeight === null) { if (presentationWidth === null || presentationHeight === null) {
if (webcamsPlacement === 'left' || webcamsPlacement === 'right') { if (webcamsPlacement === 'left' || webcamsPlacement === 'right') {
newWebcamAreaWidth = min( newWebcamAreaWidth = min(
@ -379,8 +382,11 @@ class LayoutManager extends Component {
); );
const { presentationWidth, presentationHeight } = presentationMaxSize; const { presentationWidth, presentationHeight } = presentationMaxSize;
console.log('presentationMaxSize', presentationMaxSize); console.log('mediaAreaHeight', mediaAreaHeight);
console.log('>> webcamAreaWidth', webcamAreaWidth);
if (webcamAreaWidth === null || webcamAreaHeight === null) { if (webcamAreaWidth === null || webcamAreaHeight === null) {
newPresentationAreaWidth = presentationWidth; // 30 is margins newPresentationAreaWidth = presentationWidth; // 30 is margins
@ -392,10 +398,26 @@ class LayoutManager extends Component {
newPresentationAreaWidth = mediaAreaWidth; newPresentationAreaWidth = mediaAreaWidth;
newPresentationAreaHeight = mediaAreaHeight - webcamAreaHeight - 30; // 30 is margins newPresentationAreaHeight = mediaAreaHeight - webcamAreaHeight - 30; // 30 is margins
} }
console.log('>> newPresentationAreaWidth', newPresentationAreaWidth);
if (newPresentationAreaWidth < (mediaAreaWidth * PRESENTATIONAREA_MIN_PERCENT)) {
if (newPresentationAreaWidth < 400) {
newPresentationAreaWidth = 400;
} else {
newPresentationAreaWidth = mediaAreaWidth * PRESENTATIONAREA_MIN_PERCENT;
}
}
console.log('>> newPresentationAreaWidth', newPresentationAreaWidth);
return { return {
newPresentationAreaWidth: max(newPresentationAreaWidth, 400), newPresentationAreaWidth,
newPresentationAreaHeight, newPresentationAreaHeight: newPresentationAreaHeight
< (mediaAreaHeight * PRESENTATIONAREA_MIN_PERCENT)
? mediaAreaHeight * PRESENTATIONAREA_MIN_PERCENT
: newPresentationAreaHeight,
}; };
} }
@ -431,8 +453,6 @@ class LayoutManager extends Component {
); );
} else { } else {
webcamsSize = this.calculatesWebcamsAreaSize(mediaAreaWidth, mediaAreaHeight); webcamsSize = this.calculatesWebcamsAreaSize(mediaAreaWidth, mediaAreaHeight);
console.log('+++ webcamsSize', webcamsSize);
presentationSize = this.calculatesPresentationAreaSize( presentationSize = this.calculatesPresentationAreaSize(
mediaAreaWidth, mediaAreaWidth,
mediaAreaHeight, mediaAreaHeight,

View File

@ -168,6 +168,9 @@ class WebcamDraggable extends PureComponent {
height: Math.trunc(webcamsAreaResizable.height) + resizableHeight, height: Math.trunc(webcamsAreaResizable.height) + resizableHeight,
}; };
console.log('>> newWebcamsAreaResizable', newWebcamsAreaResizable);
if (webcamsPlacement === 'top' || webcamsPlacement === 'bottom') { if (webcamsPlacement === 'top' || webcamsPlacement === 'bottom') {
layoutContextDispatch( layoutContextDispatch(
{ {
@ -181,7 +184,7 @@ class WebcamDraggable extends PureComponent {
layoutContextDispatch( layoutContextDispatch(
{ {
type: 'setWebcamsAreaUserSetsWidth', type: 'setWebcamsAreaUserSetsWidth',
value: newWebcamsAreaResizable.height, value: newWebcamsAreaResizable.width,
}, },
); );
} }

View File

@ -142,12 +142,6 @@ class PresentationArea extends PureComponent {
const { width: prevWidth, height: prevHeight } = prevProps.slidePosition; const { width: prevWidth, height: prevHeight } = prevProps.slidePosition;
const { width: currWidth, height: currHeight } = slidePosition; const { width: currWidth, height: currHeight } = slidePosition;
console.log('presentation currWidth', currWidth);
console.log('presentation currHeight', currHeight);
if (prevWidth !== currWidth || prevHeight !== currHeight) { if (prevWidth !== currWidth || prevHeight !== currHeight) {
layoutContextDispatch({ layoutContextDispatch({
type: 'setPresentationSlideSize', type: 'setPresentationSlideSize',
@ -310,6 +304,14 @@ class PresentationArea extends PureComponent {
const viewBoxWidth = viewBoxDimensions.width; const viewBoxWidth = viewBoxDimensions.width;
const viewBoxHeight = viewBoxDimensions.height; const viewBoxHeight = viewBoxDimensions.height;
console.log('-- presentationAreaHeight', presentationAreaHeight);
console.log('-- presentationAreaWidth', presentationAreaWidth);
console.log('-- originalWidth', originalWidth);
console.log('-- originalHeight', originalHeight);
console.log('-- viewBoxWidth', viewBoxWidth);
console.log('-- viewBoxHeight', viewBoxHeight);
let svgWidth; let svgWidth;
let svgHeight; let svgHeight;