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-04-20 02:27:00 +08:00
|
|
|
|
|
|
|
|
2017-06-17 10:32:41 +08:00
|
|
|
const actions = {
|
|
|
|
undoAnnotation: (whiteboardId) => {
|
|
|
|
makeCall('undoAnnotation', whiteboardId);
|
|
|
|
},
|
|
|
|
|
|
|
|
clearWhiteboard: (whiteboardId) => {
|
|
|
|
makeCall('clearWhiteboard', whiteboardId);
|
|
|
|
},
|
|
|
|
|
|
|
|
setWhiteboardToolbarValues: (tool, thickness, color, fontSize, textShape) => {
|
|
|
|
let drawSettings = {
|
|
|
|
whiteboardAnnotationTool: tool,
|
|
|
|
whiteboardAnnotationThickness: thickness,
|
|
|
|
whiteboardAnnotationColor: color,
|
|
|
|
textFontSize: fontSize,
|
|
|
|
textShape: textShape,
|
|
|
|
};
|
|
|
|
Storage.setItem('drawSettings', JSON.stringify(drawSettings));
|
|
|
|
},
|
|
|
|
|
|
|
|
setTool: (tool) => {
|
|
|
|
let drawSettings = Storage.getItem('drawSettings');
|
|
|
|
if(drawSettings) {
|
|
|
|
drawSettings.whiteboardAnnotationTool = tool;
|
|
|
|
Storage.setItem('drawSettings', JSON.stringify(drawSettings));
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
setThickness: (thickness) => {
|
|
|
|
let drawSettings = Storage.getItem('drawSettings');
|
|
|
|
if(drawSettings) {
|
|
|
|
drawSettings.whiteboardAnnotationThickness = thickness;
|
|
|
|
Storage.setItem('drawSettings', JSON.stringify(drawSettings));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
setColor: (color) => {
|
|
|
|
let drawSettings = Storage.getItem('drawSettings');
|
|
|
|
if(drawSettings) {
|
|
|
|
drawSettings.whiteboardAnnotationColor = color;
|
|
|
|
Storage.setItem('drawSettings', JSON.stringify(drawSettings));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
setFontSize: (fontSize) => {
|
|
|
|
let drawSettings = Storage.getItem('drawSettings');
|
|
|
|
if(drawSettings) {
|
|
|
|
drawSettings.textFontSize = fontSize;
|
|
|
|
Storage.setItem('drawSettings', JSON.stringify(drawSettings));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
setTextShapeObject: (textShape) => {
|
|
|
|
let drawSettings = Storage.getItem('drawSettings');
|
|
|
|
if(drawSettings) {
|
|
|
|
drawSettings.textShape = textShape;
|
|
|
|
Storage.setItem('drawSettings', JSON.stringify(drawSettings));
|
|
|
|
}
|
|
|
|
},
|
2017-04-22 02:01:52 +08:00
|
|
|
};
|
2017-04-20 02:27:00 +08:00
|
|
|
|
2017-06-17 10:32:41 +08:00
|
|
|
const getTextShapeActiveId = () => {
|
|
|
|
let drawSettings = Storage.getItem('drawSettings');
|
|
|
|
if(drawSettings) {
|
|
|
|
return drawSettings.textShape.textShapeActiveId;
|
|
|
|
}
|
2017-05-03 08:05:41 +08:00
|
|
|
};
|
|
|
|
|
2017-04-20 02:27:00 +08:00
|
|
|
export default {
|
2017-06-17 10:32:41 +08:00
|
|
|
actions,
|
|
|
|
getTextShapeActiveId,
|
2017-04-20 02:27:00 +08:00
|
|
|
};
|