ec07b4434d
WIP | Use streams to cursor and optimistic updates WIP | Use streamss to whiteboard and optimistic updates WIP | Remove fake delay Add two way batching (server/client client/server) Fix null userId exception and remove logs wip Add two way batching (server/client client/server) for cursor Remove message frequency from draw-listeners component since we handle on message publication Handle clear and undo messages
60 lines
1.5 KiB
JavaScript
Executable File
60 lines
1.5 KiB
JavaScript
Executable File
import { makeCall } from '/imports/ui/services/api';
|
|
import Storage from '/imports/ui/services/storage/session';
|
|
import Auth from '/imports/ui/services/auth';
|
|
|
|
import { sendAnnotation } from '/imports/ui/components/whiteboard/service';
|
|
|
|
const DRAW_SETTINGS = 'drawSettings';
|
|
|
|
const getWhiteboardToolbarValues = () => {
|
|
const drawSettings = Storage.getItem(DRAW_SETTINGS);
|
|
if (!drawSettings) {
|
|
return {};
|
|
}
|
|
|
|
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 = () => {
|
|
const drawSettings = Storage.getItem(DRAW_SETTINGS);
|
|
if (drawSettings) {
|
|
drawSettings.textShape.textShapeValue = '';
|
|
drawSettings.textShape.textShapeActiveId = '';
|
|
Storage.setItem(DRAW_SETTINGS, drawSettings);
|
|
}
|
|
};
|
|
|
|
const setTextShapeActiveId = (id) => {
|
|
const drawSettings = Storage.getItem(DRAW_SETTINGS);
|
|
if (drawSettings) {
|
|
drawSettings.textShape.textShapeActiveId = id;
|
|
Storage.setItem(DRAW_SETTINGS, drawSettings);
|
|
}
|
|
};
|
|
|
|
const getCurrentUserId = () => Auth.userID;
|
|
|
|
|
|
export default {
|
|
sendAnnotation,
|
|
getWhiteboardToolbarValues,
|
|
setTextShapeActiveId,
|
|
resetTextShapeSession,
|
|
getCurrentUserId,
|
|
};
|