diff --git a/bigbluebutton-html5/imports/api/annotations/addAnnotation.js b/bigbluebutton-html5/imports/api/annotations/addAnnotation.js index 11cb8020f3f65e3e091da217eef646163323c3c8..1f1a07dda4b77682535da8582e87dc9b28b16f49 100755 --- a/bigbluebutton-html5/imports/api/annotations/addAnnotation.js +++ b/bigbluebutton-html5/imports/api/annotations/addAnnotation.js @@ -2,6 +2,8 @@ import { check } from 'meteor/check'; const ANNOTATION_TYPE_TEXT = 'text'; const ANNOTATION_TYPE_PENCIL = 'pencil'; +const DEFAULT_TEXT_WIDTH = 30; +const DEFAULT_TEXT_HEIGHT = 20; // line, triangle, ellipse, rectangle function handleCommonAnnotation(meetingId, whiteboardId, userId, annotation) { @@ -39,6 +41,21 @@ function handleTextUpdate(meetingId, whiteboardId, userId, annotation) { id, status, annotationType, annotationInfo, wbId, position, } = annotation; + const { textBoxWidth, textBoxHeight } = annotationInfo; + const useDefaultSize = textBoxWidth === 0 && textBoxHeight === 0; + + if (useDefaultSize) { + annotationInfo.textBoxWidth = DEFAULT_TEXT_WIDTH; + annotationInfo.textBoxHeight = DEFAULT_TEXT_HEIGHT; + + if (100 - annotationInfo.x < DEFAULT_TEXT_WIDTH) { + annotationInfo.textBoxWidth = 100 - annotationInfo.x; + } + if (100 - annotationInfo.y < DEFAULT_TEXT_HEIGHT) { + annotationInfo.textBoxHeight = 100 - annotationInfo.y; + } + } + const selector = { meetingId, id,