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

78 lines
2.1 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';
2017-04-20 02:27:00 +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
const getTextShapeActiveId = () => {
let drawSettings = Storage.getItem('drawSettings');
if(drawSettings) {
return drawSettings.textShape.textShapeActiveId;
}
};
2017-04-20 02:27:00 +08:00
export default {
actions,
getTextShapeActiveId,
2017-04-20 02:27:00 +08:00
};