Set default size for empty whiteboard

Previously, empty whiteboards were exported as a 0×0 pixel image, which
raised an error in fabric.js.
To address this issue, the default empty image is set to be a 600×600
pixel transparent png file.

Also fix #1267 that is a consequence of the aforementioned issue.
This commit is contained in:
Fabrice Mouhartem 2023-11-16 15:44:43 +01:00
parent 38b20e8417
commit 51abbb484f
1 changed files with 3 additions and 2 deletions

View File

@ -25,8 +25,9 @@ define([
if (c[k].y > h) { h = c[k].y + 1; }
});
});
w = Math.min(w, MAX);
h = Math.min(h, MAX);
// Empty documents are rendered as a 600x600 transparent PNG image
w = w === 0 ? 600 : Math.min(w, MAX);
h = h === 0 ? 600 : Math.min(h, MAX);
canvas.setWidth(w);
canvas.setHeight(h);
canvas.calcOffset();