2017-09-24 09:40:42 +08:00
|
|
|
import React, { Component } from 'react';
|
2017-06-04 10:40:14 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2017-10-26 07:11:06 +08:00
|
|
|
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
2017-05-02 05:34:24 +08:00
|
|
|
import WhiteboardOverlayContainer from '/imports/ui/components/whiteboard/whiteboard-overlay/container';
|
2017-04-19 08:54:51 +08:00
|
|
|
import WhiteboardToolbarContainer from '/imports/ui/components/whiteboard/whiteboard-toolbar/container';
|
2018-12-05 19:00:12 +08:00
|
|
|
import { HUNDRED_PERCENT, MAX_PERCENT } from '/imports/utils/slideCalcUtils';
|
2019-02-14 20:03:25 +08:00
|
|
|
import PresentationToolbarContainer from './presentation-toolbar/container';
|
2017-08-15 08:15:11 +08:00
|
|
|
import CursorWrapperContainer from './cursor/cursor-wrapper-container/container';
|
2017-07-27 20:35:55 +08:00
|
|
|
import AnnotationGroupContainer from '../whiteboard/annotation-group/container';
|
2017-07-29 08:29:40 +08:00
|
|
|
import PresentationOverlayContainer from './presentation-overlay/container';
|
|
|
|
import Slide from './slide/component';
|
2018-01-08 14:17:18 +08:00
|
|
|
import { styles } from './styles.scss';
|
2019-02-08 01:47:28 +08:00
|
|
|
import MediaService, { shouldEnableSwapLayout } from '../media/service';
|
2018-12-15 04:16:15 +08:00
|
|
|
import PresentationCloseButton from './presentation-close-button/component';
|
2017-07-29 08:29:40 +08:00
|
|
|
|
2019-02-07 05:12:59 +08:00
|
|
|
class PresentationArea extends Component {
|
2017-07-29 08:29:40 +08:00
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
|
2017-03-24 05:52:36 +08:00
|
|
|
this.state = {
|
2017-09-18 09:58:37 +08:00
|
|
|
presentationWidth: 0,
|
|
|
|
presentationHeight: 0,
|
2017-03-24 05:52:36 +08:00
|
|
|
showSlide: false,
|
2018-08-23 01:53:04 +08:00
|
|
|
zoom: 100,
|
2018-09-18 02:02:52 +08:00
|
|
|
touchZoom: false,
|
2018-09-05 01:37:36 +08:00
|
|
|
delta: {
|
|
|
|
x: 0,
|
|
|
|
y: 0,
|
|
|
|
},
|
2018-09-25 20:47:49 +08:00
|
|
|
fitToWidth: false,
|
2017-03-24 05:52:36 +08:00
|
|
|
};
|
2017-07-29 08:29:40 +08:00
|
|
|
|
|
|
|
this.getSvgRef = this.getSvgRef.bind(this);
|
2018-08-23 01:53:04 +08:00
|
|
|
this.zoomChanger = this.zoomChanger.bind(this);
|
2018-09-18 02:02:52 +08:00
|
|
|
this.touchUpdate = this.touchUpdate.bind(this);
|
2018-09-05 01:37:36 +08:00
|
|
|
this.pointUpdate = this.pointUpdate.bind(this);
|
2018-09-25 20:47:49 +08:00
|
|
|
this.fitToWidthHandler = this.fitToWidthHandler.bind(this);
|
2017-07-29 08:29:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
// adding an event listener to scale the whiteboard on 'resize' events sent by chat/userlist etc
|
|
|
|
window.addEventListener('resize', () => {
|
|
|
|
setTimeout(this.handleResize.bind(this), 0);
|
|
|
|
});
|
|
|
|
|
2017-09-18 09:58:37 +08:00
|
|
|
this.getInitialPresentationSizes();
|
2017-03-24 05:52:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
2017-09-06 09:36:15 +08:00
|
|
|
window.removeEventListener('resize', () => {
|
|
|
|
setTimeout(this.handleResize.bind(this), 0);
|
|
|
|
});
|
2017-03-24 05:52:36 +08:00
|
|
|
}
|
|
|
|
|
2017-07-29 08:29:40 +08:00
|
|
|
// returns a ref to the svg element, which is required by a WhiteboardOverlay
|
|
|
|
// to transform screen coordinates to svg coordinate system
|
|
|
|
getSvgRef() {
|
|
|
|
return this.svggroup;
|
|
|
|
}
|
2017-04-28 06:18:53 +08:00
|
|
|
|
2019-02-14 20:03:25 +08:00
|
|
|
getToolbarHeight() {
|
|
|
|
const { refPresentationToolbar } = this;
|
|
|
|
let height = 0;
|
|
|
|
if (refPresentationToolbar) {
|
|
|
|
const { clientHeight } = refPresentationToolbar;
|
|
|
|
height = clientHeight;
|
|
|
|
}
|
|
|
|
return height;
|
|
|
|
}
|
|
|
|
|
2017-09-18 09:58:37 +08:00
|
|
|
getPresentationSizesAvailable() {
|
2019-02-12 21:35:52 +08:00
|
|
|
const { userIsPresenter, multiUser } = this.props;
|
2017-09-18 09:58:37 +08:00
|
|
|
const { refPresentationArea, refWhiteboardArea } = this;
|
|
|
|
const presentationSizes = {};
|
2017-07-29 08:29:40 +08:00
|
|
|
|
2017-09-18 09:58:37 +08:00
|
|
|
if (refPresentationArea && refWhiteboardArea) {
|
|
|
|
// By default presentation sizes are equal to the sizes of the refPresentationArea
|
|
|
|
// direct parent of the svg wrapper
|
2017-10-26 07:11:06 +08:00
|
|
|
let { clientWidth, clientHeight } = refPresentationArea;
|
2017-09-18 09:58:37 +08:00
|
|
|
|
|
|
|
// if a user is a presenter - this means there is a whiteboard toolbar on the right
|
|
|
|
// and we have to get the width/height of the refWhiteboardArea
|
2017-08-26 06:45:06 +08:00
|
|
|
// (inner hidden div with absolute position)
|
2019-02-08 01:47:28 +08:00
|
|
|
if (userIsPresenter || multiUser) {
|
2017-10-26 07:11:06 +08:00
|
|
|
({ clientWidth, clientHeight } = refWhiteboardArea);
|
2017-08-26 06:45:06 +08:00
|
|
|
}
|
2017-04-28 06:18:53 +08:00
|
|
|
|
2019-02-14 20:03:25 +08:00
|
|
|
presentationSizes.presentationHeight = clientHeight - this.getToolbarHeight();
|
2017-09-18 09:58:37 +08:00
|
|
|
presentationSizes.presentationWidth = clientWidth;
|
2017-09-06 09:36:15 +08:00
|
|
|
}
|
2017-09-18 09:58:37 +08:00
|
|
|
return presentationSizes;
|
2017-09-06 09:36:15 +08:00
|
|
|
}
|
|
|
|
|
2017-09-18 09:58:37 +08:00
|
|
|
getInitialPresentationSizes() {
|
|
|
|
// determining the presentationWidth and presentationHeight (available space for the svg)
|
|
|
|
// on the initial load
|
2018-10-19 01:03:11 +08:00
|
|
|
|
2017-09-18 09:58:37 +08:00
|
|
|
const presentationSizes = this.getPresentationSizesAvailable();
|
|
|
|
if (Object.keys(presentationSizes).length > 0) {
|
|
|
|
// setting the state of the available space for the svg
|
2017-09-06 09:36:15 +08:00
|
|
|
// and set the showSlide to true to start rendering the slide
|
2017-10-26 07:11:06 +08:00
|
|
|
this.setState({
|
|
|
|
presentationHeight: presentationSizes.presentationHeight,
|
|
|
|
presentationWidth: presentationSizes.presentationWidth,
|
|
|
|
showSlide: true,
|
|
|
|
});
|
2017-09-06 09:36:15 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
handleResize() {
|
2017-09-18 09:58:37 +08:00
|
|
|
const presentationSizes = this.getPresentationSizesAvailable();
|
|
|
|
if (Object.keys(presentationSizes).length > 0) {
|
2017-08-26 06:45:06 +08:00
|
|
|
// updating the size of the space available for the slide
|
2017-09-18 09:58:37 +08:00
|
|
|
this.setState(presentationSizes);
|
2017-08-26 06:45:06 +08:00
|
|
|
}
|
2017-03-24 05:52:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
calculateSize() {
|
2017-09-18 09:58:37 +08:00
|
|
|
const { presentationHeight, presentationWidth } = this.state;
|
2019-02-08 01:47:28 +08:00
|
|
|
const { currentSlide } = this.props;
|
|
|
|
const originalWidth = currentSlide.calculatedData.width;
|
|
|
|
const originalHeight = currentSlide.calculatedData.height;
|
2017-07-29 08:29:40 +08:00
|
|
|
|
2017-03-24 05:52:36 +08:00
|
|
|
let adjustedWidth;
|
|
|
|
let adjustedHeight;
|
|
|
|
|
2017-07-29 08:29:40 +08:00
|
|
|
// Slide has a portrait orientation
|
2017-03-24 05:52:36 +08:00
|
|
|
if (originalWidth <= originalHeight) {
|
2017-09-18 09:58:37 +08:00
|
|
|
adjustedWidth = (presentationHeight * originalWidth) / originalHeight;
|
|
|
|
if (presentationWidth < adjustedWidth) {
|
|
|
|
adjustedHeight = (presentationHeight * presentationWidth) / adjustedWidth;
|
|
|
|
adjustedWidth = presentationWidth;
|
2017-03-24 05:52:36 +08:00
|
|
|
} else {
|
2017-09-18 09:58:37 +08:00
|
|
|
adjustedHeight = presentationHeight;
|
2017-03-24 05:52:36 +08:00
|
|
|
}
|
|
|
|
|
2017-07-29 08:29:40 +08:00
|
|
|
// Slide has a landscape orientation
|
2017-03-24 05:52:36 +08:00
|
|
|
} else {
|
2017-09-18 09:58:37 +08:00
|
|
|
adjustedHeight = (presentationWidth * originalHeight) / originalWidth;
|
|
|
|
if (presentationHeight < adjustedHeight) {
|
|
|
|
adjustedWidth = (presentationWidth * presentationHeight) / adjustedHeight;
|
|
|
|
adjustedHeight = presentationHeight;
|
2017-03-24 05:52:36 +08:00
|
|
|
} else {
|
2017-09-18 09:58:37 +08:00
|
|
|
adjustedWidth = presentationWidth;
|
2017-03-24 05:52:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
width: adjustedWidth,
|
2019-02-14 20:03:25 +08:00
|
|
|
height: adjustedHeight + this.getToolbarHeight(),
|
2017-03-24 05:52:36 +08:00
|
|
|
};
|
|
|
|
}
|
2018-12-10 10:12:42 +08:00
|
|
|
|
2019-02-08 01:47:28 +08:00
|
|
|
zoomChanger(incomingZoom) {
|
|
|
|
const { zoom } = this.state;
|
|
|
|
let newZoom = incomingZoom;
|
|
|
|
const isDifferent = newZoom !== zoom;
|
2017-03-24 05:52:36 +08:00
|
|
|
|
2018-08-23 01:53:04 +08:00
|
|
|
if (newZoom <= HUNDRED_PERCENT) {
|
|
|
|
newZoom = HUNDRED_PERCENT;
|
2019-02-08 01:47:28 +08:00
|
|
|
} else if (incomingZoom >= MAX_PERCENT) {
|
2018-08-23 01:53:04 +08:00
|
|
|
newZoom = MAX_PERCENT;
|
|
|
|
}
|
|
|
|
if (isDifferent) this.setState({ zoom: newZoom });
|
|
|
|
}
|
2018-12-10 10:12:42 +08:00
|
|
|
|
2018-09-05 01:37:36 +08:00
|
|
|
pointUpdate(pointX, pointY) {
|
|
|
|
this.setState({
|
|
|
|
delta: {
|
|
|
|
x: pointX,
|
|
|
|
y: pointY,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2018-12-10 10:12:42 +08:00
|
|
|
|
2018-09-18 02:02:52 +08:00
|
|
|
touchUpdate(bool) {
|
|
|
|
this.setState({
|
|
|
|
touchZoom: bool,
|
|
|
|
});
|
|
|
|
}
|
2018-12-10 10:12:42 +08:00
|
|
|
|
2018-09-25 20:47:49 +08:00
|
|
|
fitToWidthHandler() {
|
2019-02-08 01:47:28 +08:00
|
|
|
const { fitToWidth } = this.state;
|
2019-02-12 21:35:52 +08:00
|
|
|
this.setState({
|
|
|
|
fitToWidth: !fitToWidth,
|
|
|
|
});
|
2019-02-08 01:47:28 +08:00
|
|
|
}
|
|
|
|
|
2019-02-12 21:35:52 +08:00
|
|
|
|
2019-02-08 01:47:28 +08:00
|
|
|
isPresentationAccessible() {
|
|
|
|
const { currentSlide } = this.props;
|
|
|
|
// sometimes tomcat publishes the slide url, but the actual file is not accessible (why?)
|
|
|
|
return currentSlide && currentSlide.calculatedData;
|
2018-09-25 20:47:49 +08:00
|
|
|
}
|
|
|
|
|
2019-02-12 21:35:52 +08:00
|
|
|
renderPresentationClose() {
|
|
|
|
const { isFullscreen } = this.props;
|
|
|
|
if (!shouldEnableSwapLayout() || isFullscreen) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return <PresentationCloseButton toggleSwapLayout={MediaService.toggleSwapLayout} />;
|
|
|
|
}
|
|
|
|
|
|
|
|
renderOverlays(slideObj, adjustedSizes) {
|
|
|
|
const {
|
|
|
|
userIsPresenter,
|
|
|
|
multiUser,
|
|
|
|
podId,
|
|
|
|
currentSlide,
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
const {
|
|
|
|
delta,
|
|
|
|
zoom,
|
|
|
|
touchZoom,
|
|
|
|
fitToWidth,
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
if (!userIsPresenter && !multiUser) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
// retrieving the pre-calculated data from the slide object
|
|
|
|
const {
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
viewBoxWidth,
|
|
|
|
viewBoxHeight,
|
|
|
|
} = slideObj.calculatedData;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<PresentationOverlayContainer
|
|
|
|
podId={podId}
|
|
|
|
currentSlideNum={currentSlide.num}
|
|
|
|
slide={slideObj}
|
|
|
|
whiteboardId={slideObj.id}
|
|
|
|
slideWidth={width}
|
|
|
|
slideHeight={height}
|
|
|
|
delta={delta}
|
|
|
|
viewBoxWidth={viewBoxWidth}
|
|
|
|
viewBoxHeight={viewBoxHeight}
|
|
|
|
zoom={zoom}
|
|
|
|
zoomChanger={this.zoomChanger}
|
|
|
|
adjustedSizes={adjustedSizes}
|
|
|
|
getSvgRef={this.getSvgRef}
|
|
|
|
presentationSize={this.getPresentationSizesAvailable()}
|
|
|
|
touchZoom={touchZoom}
|
|
|
|
fitToWidth={fitToWidth}
|
|
|
|
>
|
|
|
|
<WhiteboardOverlayContainer
|
|
|
|
getSvgRef={this.getSvgRef}
|
|
|
|
whiteboardId={slideObj.id}
|
|
|
|
slideWidth={width}
|
|
|
|
slideHeight={height}
|
|
|
|
viewBoxX={x}
|
|
|
|
viewBoxY={y}
|
|
|
|
pointChanger={this.pointUpdate}
|
|
|
|
viewBoxWidth={viewBoxWidth}
|
|
|
|
viewBoxHeight={viewBoxHeight}
|
|
|
|
physicalSlideWidth={(adjustedSizes.width / slideObj.widthRatio) * 100}
|
|
|
|
physicalSlideHeight={(adjustedSizes.height / slideObj.heightRatio) * 100}
|
|
|
|
zoom={zoom}
|
|
|
|
zoomChanger={this.zoomChanger}
|
|
|
|
touchUpdate={this.touchUpdate}
|
|
|
|
/>
|
|
|
|
</PresentationOverlayContainer>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-07-29 08:29:40 +08:00
|
|
|
// renders the whole presentation area
|
2017-02-17 05:11:46 +08:00
|
|
|
renderPresentationArea() {
|
2019-02-08 01:47:28 +08:00
|
|
|
const { fitToWidth } = this.state;
|
|
|
|
const { podId, currentSlide } = this.props;
|
|
|
|
if (!this.isPresentationAccessible()) return null;
|
|
|
|
|
2019-02-14 20:03:25 +08:00
|
|
|
|
2017-10-26 07:11:06 +08:00
|
|
|
// to control the size of the svg wrapper manually
|
|
|
|
// and adjust cursor's thickness, so that svg didn't scale it automatically
|
2017-09-22 05:02:50 +08:00
|
|
|
const adjustedSizes = this.calculateSize();
|
2017-10-26 07:11:06 +08:00
|
|
|
// a reference to the slide object
|
2019-02-08 01:47:28 +08:00
|
|
|
const slideObj = currentSlide;
|
2017-04-28 06:18:53 +08:00
|
|
|
|
2019-02-12 21:35:52 +08:00
|
|
|
const presentationCloseButton = this.renderPresentationClose();
|
2019-01-26 00:21:05 +08:00
|
|
|
|
2017-10-26 07:11:06 +08:00
|
|
|
// retrieving the pre-calculated data from the slide object
|
2017-09-22 05:02:50 +08:00
|
|
|
const {
|
2017-10-26 07:11:06 +08:00
|
|
|
x,
|
|
|
|
y,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
viewBoxWidth,
|
|
|
|
viewBoxHeight,
|
|
|
|
imageUri,
|
|
|
|
} = slideObj.calculatedData;
|
2019-02-12 21:35:52 +08:00
|
|
|
|
|
|
|
const svgDimensions = fitToWidth
|
|
|
|
? {
|
|
|
|
position: 'absolute',
|
|
|
|
width: 'inherit',
|
|
|
|
}
|
|
|
|
: {
|
|
|
|
position: 'absolute',
|
|
|
|
width: adjustedSizes.width,
|
|
|
|
height: adjustedSizes.height,
|
|
|
|
};
|
|
|
|
|
2017-09-22 05:02:50 +08:00
|
|
|
return (
|
|
|
|
<div
|
2018-09-25 20:47:49 +08:00
|
|
|
style={svgDimensions}
|
2017-09-22 05:02:50 +08:00
|
|
|
>
|
2019-01-26 00:21:05 +08:00
|
|
|
{presentationCloseButton}
|
2017-10-26 07:11:06 +08:00
|
|
|
<TransitionGroup>
|
|
|
|
<CSSTransition
|
2017-09-22 05:02:50 +08:00
|
|
|
key={slideObj.id}
|
2017-10-26 07:11:06 +08:00
|
|
|
classNames={{
|
|
|
|
enter: styles.enter,
|
|
|
|
enterActive: styles.enterActive,
|
|
|
|
appear: styles.appear,
|
|
|
|
appearActive: styles.appearActive,
|
|
|
|
}}
|
|
|
|
appear
|
|
|
|
enter
|
|
|
|
exit={false}
|
|
|
|
timeout={{ enter: 400 }}
|
2016-05-31 06:07:02 +08:00
|
|
|
>
|
2017-10-26 07:11:06 +08:00
|
|
|
<svg
|
2018-12-01 01:59:14 +08:00
|
|
|
data-test="whiteboard"
|
2019-02-08 01:47:28 +08:00
|
|
|
{...{
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
}}
|
2017-10-26 07:11:06 +08:00
|
|
|
ref={(ref) => { if (ref != null) { this.svggroup = ref; } }}
|
|
|
|
viewBox={`${x} ${y} ${viewBoxWidth} ${viewBoxHeight}`}
|
|
|
|
version="1.1"
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
className={styles.svgStyles}
|
|
|
|
>
|
|
|
|
<defs>
|
|
|
|
<clipPath id="viewBox">
|
|
|
|
<rect x={x} y={y} width="100%" height="100%" fill="none" />
|
|
|
|
</clipPath>
|
|
|
|
</defs>
|
|
|
|
<g clipPath="url(#viewBox)">
|
|
|
|
<Slide
|
|
|
|
imageUri={imageUri}
|
|
|
|
svgWidth={width}
|
|
|
|
svgHeight={height}
|
|
|
|
/>
|
|
|
|
<AnnotationGroupContainer
|
2019-02-08 01:47:28 +08:00
|
|
|
{...{
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
}}
|
2017-10-26 07:11:06 +08:00
|
|
|
whiteboardId={slideObj.id}
|
|
|
|
/>
|
|
|
|
<CursorWrapperContainer
|
2019-02-08 01:47:28 +08:00
|
|
|
podId={podId}
|
2018-04-10 07:18:49 +08:00
|
|
|
whiteboardId={slideObj.id}
|
2017-10-26 07:11:06 +08:00
|
|
|
widthRatio={slideObj.widthRatio}
|
|
|
|
physicalWidthRatio={adjustedSizes.width / width}
|
|
|
|
slideWidth={width}
|
|
|
|
slideHeight={height}
|
2019-02-08 01:47:28 +08:00
|
|
|
radius={fitToWidth ? 2 : 5}
|
2017-10-26 07:11:06 +08:00
|
|
|
/>
|
|
|
|
</g>
|
|
|
|
{this.renderOverlays(slideObj, adjustedSizes)}
|
|
|
|
</svg>
|
|
|
|
</CSSTransition>
|
|
|
|
</TransitionGroup>
|
2019-02-14 20:03:25 +08:00
|
|
|
<div
|
|
|
|
ref={(ref) => { this.refPresentationToolbar = ref; }}
|
|
|
|
>
|
|
|
|
{this.renderPresentationToolbar()}
|
|
|
|
</div>
|
2017-09-22 05:02:50 +08:00
|
|
|
</div>
|
|
|
|
);
|
2016-06-02 07:37:51 +08:00
|
|
|
}
|
|
|
|
|
2019-02-12 21:35:52 +08:00
|
|
|
renderPresentationToolbar() {
|
2017-09-19 07:54:52 +08:00
|
|
|
const {
|
2019-02-12 21:35:52 +08:00
|
|
|
currentSlide,
|
|
|
|
podId,
|
|
|
|
isFullscreen: propIsFullscreen,
|
|
|
|
} = this.props;
|
2019-02-07 05:12:59 +08:00
|
|
|
|
2019-02-12 21:35:52 +08:00
|
|
|
const { zoom } = this.state;
|
2019-01-08 02:12:28 +08:00
|
|
|
|
2019-02-12 21:35:52 +08:00
|
|
|
const fullRef = () => this.refPresentationContainer.requestFullscreen();
|
2019-01-08 02:12:28 +08:00
|
|
|
|
2019-02-12 21:35:52 +08:00
|
|
|
if (!currentSlide) {
|
|
|
|
return null;
|
|
|
|
}
|
2017-09-19 08:18:20 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<PresentationToolbarContainer
|
2019-02-12 21:35:52 +08:00
|
|
|
|
|
|
|
isFullscreen={propIsFullscreen}
|
|
|
|
fullscreenRef={fullRef}
|
|
|
|
podId={podId}
|
2019-02-08 01:47:28 +08:00
|
|
|
currentSlideNum={currentSlide.num}
|
|
|
|
presentationId={currentSlide.presentationId}
|
2019-02-12 21:35:52 +08:00
|
|
|
zoom={zoom}
|
2018-08-23 01:53:04 +08:00
|
|
|
zoomChanger={this.zoomChanger}
|
2018-09-25 20:47:49 +08:00
|
|
|
fitToWidthHandler={this.fitToWidthHandler}
|
2017-09-19 08:18:20 +08:00
|
|
|
/>
|
|
|
|
);
|
2016-08-06 02:39:24 +08:00
|
|
|
}
|
|
|
|
|
2017-04-19 08:54:51 +08:00
|
|
|
renderWhiteboardToolbar() {
|
2019-02-08 01:47:28 +08:00
|
|
|
const { currentSlide } = this.props;
|
|
|
|
if (!this.isPresentationAccessible()) return null;
|
2017-09-21 05:05:17 +08:00
|
|
|
|
|
|
|
const adjustedSizes = this.calculateSize();
|
|
|
|
return (
|
|
|
|
<WhiteboardToolbarContainer
|
2019-02-08 01:47:28 +08:00
|
|
|
whiteboardId={currentSlide.id}
|
2017-09-21 05:05:17 +08:00
|
|
|
height={adjustedSizes.height}
|
|
|
|
/>
|
|
|
|
);
|
2017-04-19 08:54:51 +08:00
|
|
|
}
|
|
|
|
|
2016-06-02 07:37:51 +08:00
|
|
|
render() {
|
2019-02-08 01:47:28 +08:00
|
|
|
const { userIsPresenter, multiUser } = this.props;
|
2019-02-12 21:35:52 +08:00
|
|
|
const { showSlide } = this.state;
|
2019-02-08 01:47:28 +08:00
|
|
|
|
2016-06-02 07:37:51 +08:00
|
|
|
return (
|
2019-01-26 00:21:05 +08:00
|
|
|
<div
|
|
|
|
ref={(ref) => { this.refPresentationContainer = ref; }}
|
2019-02-07 05:12:59 +08:00
|
|
|
className={styles.presentationContainer}
|
|
|
|
>
|
2017-07-29 08:29:40 +08:00
|
|
|
<div
|
2017-09-18 09:58:37 +08:00
|
|
|
ref={(ref) => { this.refPresentationArea = ref; }}
|
|
|
|
className={styles.presentationArea}
|
2017-07-29 08:29:40 +08:00
|
|
|
>
|
2017-03-24 05:52:36 +08:00
|
|
|
<div
|
2017-09-18 09:58:37 +08:00
|
|
|
ref={(ref) => { this.refWhiteboardArea = ref; }}
|
2017-07-29 08:29:40 +08:00
|
|
|
className={styles.whiteboardSizeAvailable}
|
|
|
|
/>
|
2019-02-12 21:35:52 +08:00
|
|
|
{showSlide
|
|
|
|
? this.renderPresentationArea()
|
|
|
|
: null}
|
|
|
|
{userIsPresenter || multiUser
|
|
|
|
? this.renderWhiteboardToolbar()
|
|
|
|
: null}
|
2017-07-29 08:29:40 +08:00
|
|
|
</div>
|
2016-05-31 06:07:02 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-14 20:03:25 +08:00
|
|
|
export default PresentationArea;
|
2019-02-07 05:12:59 +08:00
|
|
|
|
2017-07-29 08:29:40 +08:00
|
|
|
PresentationArea.propTypes = {
|
2018-04-12 04:05:30 +08:00
|
|
|
podId: PropTypes.string.isRequired,
|
2017-07-29 08:29:40 +08:00
|
|
|
// Defines a boolean value to detect whether a current user is a presenter
|
|
|
|
userIsPresenter: PropTypes.bool.isRequired,
|
|
|
|
currentSlide: PropTypes.shape({
|
|
|
|
presentationId: PropTypes.string.isRequired,
|
2017-08-17 10:24:59 +08:00
|
|
|
current: PropTypes.bool.isRequired,
|
|
|
|
heightRatio: PropTypes.number.isRequired,
|
|
|
|
widthRatio: PropTypes.number.isRequired,
|
|
|
|
xOffset: PropTypes.number.isRequired,
|
|
|
|
yOffset: PropTypes.number.isRequired,
|
|
|
|
num: PropTypes.number.isRequired,
|
|
|
|
id: PropTypes.string.isRequired,
|
2017-09-19 06:20:44 +08:00
|
|
|
calculatedData: PropTypes.shape({
|
|
|
|
x: PropTypes.number.isRequired,
|
|
|
|
y: PropTypes.number.isRequired,
|
|
|
|
height: PropTypes.number.isRequired,
|
|
|
|
width: PropTypes.number.isRequired,
|
|
|
|
viewBoxWidth: PropTypes.number.isRequired,
|
|
|
|
viewBoxHeight: PropTypes.number.isRequired,
|
|
|
|
imageUri: PropTypes.string.isRequired,
|
2017-09-22 05:02:50 +08:00
|
|
|
}),
|
2017-07-29 08:29:40 +08:00
|
|
|
}),
|
2017-08-15 08:15:11 +08:00
|
|
|
// current multi-user status
|
|
|
|
multiUser: PropTypes.bool.isRequired,
|
2016-05-31 06:07:02 +08:00
|
|
|
};
|
2017-08-19 10:47:31 +08:00
|
|
|
|
|
|
|
PresentationArea.defaultProps = {
|
|
|
|
currentSlide: undefined,
|
|
|
|
};
|