From 51abbb484fadf43e9ce2691b305eede48eb70378 Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Thu, 16 Nov 2023 15:44:43 +0100 Subject: [PATCH] Set default size for empty whiteboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- www/whiteboard/export.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/www/whiteboard/export.js b/www/whiteboard/export.js index 300085c92..7c9253fea 100644 --- a/www/whiteboard/export.js +++ b/www/whiteboard/export.js @@ -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();