2017-05-02 05:34:24 +08:00
|
|
|
import React from 'react';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2017-08-19 10:47:31 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2017-05-02 05:34:24 +08:00
|
|
|
import WhiteboardOverlayService from './service';
|
2018-08-23 23:42:34 +08:00
|
|
|
import WhiteboardToolbarService from '../whiteboard-toolbar/service';
|
2017-05-02 05:34:24 +08:00
|
|
|
import WhiteboardOverlay from './component';
|
|
|
|
|
2017-09-26 07:45:44 +08:00
|
|
|
const WhiteboardOverlayContainer = (props) => {
|
2019-07-18 08:30:28 +08:00
|
|
|
const { drawSettings } = props;
|
|
|
|
if (Object.keys(drawSettings).length > 0) {
|
2017-08-19 10:47:31 +08:00
|
|
|
return (
|
|
|
|
<WhiteboardOverlay {...props} />
|
|
|
|
);
|
2017-05-02 05:34:24 +08:00
|
|
|
}
|
2017-08-19 10:47:31 +08:00
|
|
|
return null;
|
|
|
|
};
|
2017-05-02 05:34:24 +08:00
|
|
|
|
2018-01-08 12:44:42 +08:00
|
|
|
export default withTracker(() => ({
|
2018-08-23 23:42:34 +08:00
|
|
|
undoAnnotation: WhiteboardToolbarService.undoAnnotation,
|
2018-07-24 05:25:06 +08:00
|
|
|
contextMenuHandler: WhiteboardOverlayService.contextMenuHandler,
|
2017-05-02 05:34:24 +08:00
|
|
|
sendAnnotation: WhiteboardOverlayService.sendAnnotation,
|
2018-08-14 03:40:47 +08:00
|
|
|
addAnnotationToDiscardedList: WhiteboardOverlayService.addAnnotationToDiscardedList,
|
2017-06-17 10:32:41 +08:00
|
|
|
setTextShapeActiveId: WhiteboardOverlayService.setTextShapeActiveId,
|
2017-08-24 11:35:34 +08:00
|
|
|
resetTextShapeSession: WhiteboardOverlayService.resetTextShapeSession,
|
2017-05-03 08:05:41 +08:00
|
|
|
drawSettings: WhiteboardOverlayService.getWhiteboardToolbarValues(),
|
2017-08-19 10:47:31 +08:00
|
|
|
userId: WhiteboardOverlayService.getCurrentUserId(),
|
2019-07-18 08:30:28 +08:00
|
|
|
updateCursor: WhiteboardOverlayService.updateCursor,
|
2018-01-08 12:44:42 +08:00
|
|
|
}))(WhiteboardOverlayContainer);
|
2017-08-19 10:47:31 +08:00
|
|
|
|
|
|
|
|
|
|
|
WhiteboardOverlayContainer.propTypes = {
|
2017-10-04 05:28:44 +08:00
|
|
|
drawSettings: PropTypes.oneOfType([
|
|
|
|
PropTypes.shape({
|
|
|
|
// Annotation color
|
|
|
|
color: PropTypes.number.isRequired,
|
|
|
|
// Annotation thickness (not normalized)
|
|
|
|
thickness: PropTypes.number.isRequired,
|
|
|
|
// The name of the tool currently selected
|
|
|
|
tool: PropTypes.string.isRequired,
|
|
|
|
// Font size for the text shape
|
|
|
|
textFontSize: PropTypes.number.isRequired,
|
|
|
|
// Current active text shape value
|
|
|
|
textShapeValue: PropTypes.string.isRequired,
|
|
|
|
// Text active text shape id
|
|
|
|
textShapeActiveId: PropTypes.string.isRequired,
|
|
|
|
}),
|
|
|
|
PropTypes.object.isRequired,
|
|
|
|
]),
|
2017-08-19 10:47:31 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
WhiteboardOverlayContainer.defaultProps = {
|
2017-09-06 09:36:15 +08:00
|
|
|
drawSettings: {},
|
2017-08-19 10:47:31 +08:00
|
|
|
};
|