bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/whiteboard/whiteboard-overlay/service.js

62 lines
1.6 KiB
JavaScript
Raw Normal View History

2017-06-08 04:45:49 +08:00
import { makeCall } from '/imports/ui/services/api';
import Storage from '/imports/ui/services/storage/session';
import Auth from '/imports/ui/services/auth';
2017-09-21 05:05:17 +08:00
const DRAW_SETTINGS = 'drawSettings';
const sendAnnotation = (annotation) => {
2017-06-08 04:45:49 +08:00
makeCall('sendAnnotation', annotation);
};
const getWhiteboardToolbarValues = () => {
2017-09-21 05:05:17 +08:00
const drawSettings = Storage.getItem(DRAW_SETTINGS);
if (!drawSettings) {
return {};
}
2017-09-21 05:05:17 +08:00
const {
whiteboardAnnotationTool,
whiteboardAnnotationThickness,
whiteboardAnnotationColor,
textFontSize,
textShape,
} = drawSettings;
return {
tool: whiteboardAnnotationTool,
thickness: whiteboardAnnotationThickness,
color: whiteboardAnnotationColor,
textFontSize,
textShapeValue: textShape.textShapeValue ? textShape.textShapeValue : '',
textShapeActiveId: textShape.textShapeActiveId ? textShape.textShapeActiveId : '',
};
};
const resetTextShapeSession = () => {
2017-09-21 05:05:17 +08:00
const drawSettings = Storage.getItem(DRAW_SETTINGS);
if (drawSettings) {
drawSettings.textShape.textShapeValue = '';
drawSettings.textShape.textShapeActiveId = '';
2017-09-21 05:05:17 +08:00
Storage.setItem(DRAW_SETTINGS, drawSettings);
}
};
const setTextShapeActiveId = (id) => {
2017-09-21 05:05:17 +08:00
const drawSettings = Storage.getItem(DRAW_SETTINGS);
if (drawSettings) {
drawSettings.textShape.textShapeActiveId = id;
2017-09-21 05:05:17 +08:00
Storage.setItem(DRAW_SETTINGS, drawSettings);
}
};
const getCurrentUserId = () => Auth.userID;
export default {
sendAnnotation,
getWhiteboardToolbarValues,
setTextShapeActiveId,
resetTextShapeSession,
getCurrentUserId,
};