2017-06-08 04:45:49 +08:00
|
|
|
import { makeCall } from '/imports/ui/services/api';
|
2017-05-03 08:05:41 +08:00
|
|
|
import Storage from '/imports/ui/services/storage/session';
|
2017-06-17 10:32:41 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2017-05-02 05:34:24 +08:00
|
|
|
|
|
|
|
const sendAnnotation = (annotation) => {
|
2017-06-08 04:45:49 +08:00
|
|
|
makeCall('sendAnnotation', annotation);
|
2017-05-02 05:34:24 +08:00
|
|
|
};
|
|
|
|
|
2017-05-03 08:05:41 +08:00
|
|
|
const getWhiteboardToolbarValues = () => {
|
2017-08-19 10:47:31 +08:00
|
|
|
const drawSettings = Storage.getItem('drawSettings');
|
|
|
|
if (drawSettings) {
|
2017-06-17 10:32:41 +08:00
|
|
|
const {
|
|
|
|
whiteboardAnnotationTool,
|
|
|
|
whiteboardAnnotationThickness,
|
|
|
|
whiteboardAnnotationColor,
|
|
|
|
textFontSize,
|
|
|
|
textShape,
|
|
|
|
} = drawSettings;
|
|
|
|
|
2017-06-03 07:40:52 +08:00
|
|
|
return {
|
2017-06-17 10:32:41 +08:00
|
|
|
tool: whiteboardAnnotationTool,
|
|
|
|
thickness: whiteboardAnnotationThickness,
|
|
|
|
color: whiteboardAnnotationColor,
|
2017-08-19 10:47:31 +08:00
|
|
|
textFontSize,
|
2017-06-17 10:32:41 +08:00
|
|
|
textShapeValue: textShape.textShapeValue ? textShape.textShapeValue : '',
|
2017-06-03 07:40:52 +08:00
|
|
|
};
|
|
|
|
}
|
2017-08-19 10:47:31 +08:00
|
|
|
return undefined;
|
2017-05-03 08:05:41 +08:00
|
|
|
};
|
|
|
|
|
2017-06-17 10:32:41 +08:00
|
|
|
const resetTextShapeValue = () => {
|
2017-08-19 10:47:31 +08:00
|
|
|
const drawSettings = Storage.getItem('drawSettings');
|
|
|
|
if (drawSettings) {
|
2017-06-17 10:32:41 +08:00
|
|
|
drawSettings.textShape.textShapeValue = '';
|
|
|
|
Storage.setItem('drawSettings', JSON.stringify(drawSettings));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const setTextShapeActiveId = (id) => {
|
2017-08-19 10:47:31 +08:00
|
|
|
const drawSettings = Storage.getItem('drawSettings');
|
|
|
|
if (drawSettings) {
|
|
|
|
drawSettings.textShape.textShapeActiveId = `${Auth.userID}-${id}`;
|
2017-06-17 10:32:41 +08:00
|
|
|
Storage.setItem('drawSettings', JSON.stringify(drawSettings));
|
|
|
|
}
|
2017-06-11 10:21:37 +08:00
|
|
|
};
|
|
|
|
|
2017-08-19 10:47:31 +08:00
|
|
|
const getCurrentUserId = () => Auth.userID;
|
|
|
|
|
|
|
|
|
2017-05-02 05:34:24 +08:00
|
|
|
export default {
|
|
|
|
sendAnnotation,
|
2017-05-03 08:05:41 +08:00
|
|
|
getWhiteboardToolbarValues,
|
2017-06-17 10:32:41 +08:00
|
|
|
setTextShapeActiveId,
|
|
|
|
resetTextShapeValue,
|
2017-08-19 10:47:31 +08:00
|
|
|
getCurrentUserId,
|
2017-05-02 05:34:24 +08:00
|
|
|
};
|