also render text when whiteboard is exported as img

This commit is contained in:
raphael 2019-03-18 10:30:41 +01:00
parent a3b89d9bfb
commit 6b059c4011
1 changed files with 17 additions and 0 deletions

View File

@ -747,6 +747,23 @@ var whiteboard = {
copyCanvas.height = height;
var ctx = copyCanvas.getContext("2d");
$.each($(".textBox"), function() {
var textContainer = $(this)
var textEl = $(this).find(".textContent");
var text = textEl.text();
var fontSize = textEl.css('font-size');
var fontColor = textEl.css('color');
var p = textContainer.position();
var left = Math.round(p.left * 100) / 100;
var top = Math.round(p.top * 100) / 100;
top+=25; //Fix top position
console.log(text, fontSize, fontColor, left, top)
ctx.font = fontSize+" monospace";
ctx.fillStyle = fontColor;
ctx.fillText(text, left, top);
});
$.each(_this.imgContainer.find("img"), function () {
var width = $(this).width();
var height = $(this).height();