add notification when presentation changes

This commit is contained in:
KDSBrowne 2019-05-09 17:44:54 +00:00
parent c7566d4b57
commit 2b9d0cccee
3 changed files with 26 additions and 11 deletions

View File

@ -48,10 +48,20 @@ class PresentationArea extends Component {
}
componentDidUpdate(prevProps, prevState) {
const { currentPresentation, notify } = this.props;
if (prevProps.currentPresentation.name !== currentPresentation.name) {
notify(
`Current presentation ${currentPresentation.name}`,
'info',
'settings',
);
}
if (prevState.fitToWidth) {
// When presenter is changed or slide changed we reset fitToWidth
if ((prevProps.userIsPresenter && !this.props.userIsPresenter) ||
(prevProps.currentSlide.id !== this.props.currentSlide.id)) {
if ((prevProps.userIsPresenter && !this.props.userIsPresenter)
|| (prevProps.currentSlide.id !== this.props.currentSlide.id)) {
this.setState({
fitToWidth: false,
});
@ -196,16 +206,16 @@ class PresentationArea extends Component {
const { fitToWidth } = this.state;
if (userIsPresenter) {
return fitToWidth;
} else {
const { width, height, viewBoxWidth, viewBoxHeight } = currentSlide.calculatedData;
const slideSizeRatio = width / height;
const viewBoxSizeRatio = viewBoxWidth / viewBoxHeight;
if (slideSizeRatio !== viewBoxSizeRatio) {
return true;
} else {
return false;
}
}
const {
width, height, viewBoxWidth, viewBoxHeight,
} = currentSlide.calculatedData;
const slideSizeRatio = width / height;
const viewBoxSizeRatio = viewBoxWidth / viewBoxHeight;
if (slideSizeRatio !== viewBoxSizeRatio) {
return true;
}
return false;
}
zoomChanger(incomingZoom) {
@ -530,6 +540,7 @@ class PresentationArea extends Component {
fitToWidth,
} = this.state;
const adjustedSizes = this.calculateSize();
const adjustedHeight = adjustedSizes.height;
const adjustedWidth = adjustedSizes.width;

View File

@ -1,6 +1,7 @@
import React from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import { getSwapLayout } from '/imports/ui/components/media/service';
import { notify } from '/imports/ui/services/notification';
import PresentationAreaService from './service';
import PresentationArea from './component';
@ -21,5 +22,7 @@ export default withTracker(({ podId }) => {
presentationIsDownloadable,
isFullscreen,
mountPresentationArea: !!currentSlide,
currentPresentation: PresentationAreaService.getCurrentPresentation(podId),
notify,
};
})(PresentationAreaContainer);

View File

@ -174,4 +174,5 @@ export default {
getMultiUserStatus,
currentSlidHasContent,
parseCurrentSlideContent,
getCurrentPresentation,
};