bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/whiteboard/annotations/helpers.js
2020-04-08 20:03:56 +00:00

30 lines
585 B
JavaScript

const colourToHex = (value) => {
let hex;
hex = parseInt(value, 10).toString(16);
while (hex.length < 6) {
hex = `0${hex}`;
}
return `#${hex}`;
};
const getFormattedColor = (color) => {
let _color = color || '0';
if (!_color.toString().match(/#.*/)) {
_color = colourToHex(_color);
}
return _color;
};
const getStrokeWidth = (thickness, slideWidth) => (thickness * slideWidth) / 100;
const denormalizeCoord = (normCoord, sideLength) => ((normCoord / 100) * sideLength).toFixed(2);
export {
getFormattedColor,
getStrokeWidth,
denormalizeCoord,
};