bigbluebutton-Github/bigbluebutton-html5/imports/api/annotations/server/methods/sendAnnotationHelper.js

88 lines
2.5 KiB
JavaScript
Raw Normal View History

import RedisPubSub from '/imports/startup/server/redis';
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
export default function sendAnnotationHelper(annotation, meetingId, requesterUserId) {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'SendWhiteboardAnnotationPubMsg';
const whiteboardId = annotation.wbId;
check(annotation, Object);
check(whiteboardId, String);
if (annotation.annotationType === 'text') {
check(annotation, {
id: String,
status: String,
annotationType: String,
annotationInfo: {
x: Number,
y: Number,
fontColor: Number,
calcedFontSize: Number,
textBoxWidth: Number,
text: String,
textBoxHeight: Number,
id: String,
whiteboardId: String,
status: String,
fontSize: Number,
dataPoints: String,
type: String,
},
wbId: String,
userId: String,
position: Number,
});
2020-10-28 13:36:10 +08:00
} else if (annotation.annotationType === 'rectangle' || annotation.annotationType === 'triangle' || annotation.annotationType === 'ellipse' || annotation.annotationType === 'line' ){
// line does not have the 'fill' property but this is necessary as 'fill' is anyway added at ui/components/whiteboard/whiteboard-overlay/shape-draw-listener/component.jsx
2020-12-24 20:12:57 +08:00
// Any other shape excluding pencil and text (e.g., eraser) needs to be added here.
2020-10-28 13:36:10 +08:00
check(annotation, {
id: String,
status: String,
annotationType: String,
annotationInfo: {
color: Number,
thickness: Number,
fill: Boolean,
points: Array,
id: String,
whiteboardId: String,
status: String,
type: String,
dimensions: Match.Maybe([Number]),
},
wbId: String,
userId: String,
position: Number,
});
} else {
check(annotation, {
id: String,
status: String,
annotationType: String,
annotationInfo: {
color: Number,
thickness: Number,
points: Array,
id: String,
whiteboardId: String,
status: String,
type: String,
dimensions: Match.Maybe([Number]),
},
wbId: String,
userId: String,
position: Number,
});
}
const payload = {
annotation,
};
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
}