Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions web/libs/editor/src/regions/BitmaskRegion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,19 @@ const Model = types

image.src = self.imageDataURL;

try {
await image.decode();
// Fallback onload
image.onload = () => {
context.canvas.width = image.naturalWidth;
context.canvas.height = image.naturalHeight;
bitmask.width = image.naturalWidth;
bitmask.height = image.naturalHeight;

context.drawImage(image, 0, 0);

self.finalizeRegion();
};

try {
await image.decode();
image.onload(); // on success of decode() onload() get called manually
} catch (err) {
console.log(err);
}
Expand Down
Loading