Skip to content

Commit

Permalink
added resize event on image load
Browse files Browse the repository at this point in the history
Co-authored-by: Ben <[email protected]>
  • Loading branch information
RainerZarth committed Sep 13, 2022
1 parent fe9f68d commit 85ae27b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions plugins/h5p-drawing-board/drawing-board.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,14 @@ H5P.DrawingBoard = (function (_$) {
const loadImage = async () => {
const storedCanvas = localStorage.getItem(LOCAL_STORAGE_KEY);
await drawBackgroundImage();
this.trigger('resize');
if (storedCanvas !== null) {
this.log('using stored canvas');
const img = new Image();
img.src = storedCanvas;
await img.decode();
ctx.drawImage(img, 0, 0);
this.trigger('resize');
}
};

Expand Down
2 changes: 1 addition & 1 deletion plugins/h5p-drawing-board/library.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Displays a simple drawing board",
"majorVersion": 1,
"minorVersion": 3,
"patchVersion": 11,
"patchVersion": 12,
"runnable": 1,
"author": "Stefan Wintergerst",
"license": "MIT",
Expand Down

0 comments on commit 85ae27b

Please sign in to comment.