Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
HashLips committed Jan 26, 2022
1 parent 0e6824e commit b708b3a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
17 changes: 6 additions & 11 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,13 @@ const addAttributes = (_element) => {
};

const loadLayerImg = async (_layer) => {
try {
if (_layer.selectedElement.path.includes("-")) {
throw new Error("layer name can not contain dashes");
}
const image = await loadImage(`${_imgObject.path}`);
return {
imgObject: _imgObject,
loadedImage: image,
};
} catch (error) {
console.error("Error loading image:", error);
if (_layer.selectedElement.path.includes("-")) {
throw new Error("layer name can not contain dashes");
}
return new Promise(async (resolve) => {
const image = await loadImage(`${_layer.selectedElement.path}`);
resolve({ layer: _layer, loadedImage: image });
});
};

const addText = (_sig, x, y, size) => {
Expand Down
11 changes: 8 additions & 3 deletions utils/pixelate.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,15 @@ const getImages = (_dir) => {
};

const loadImgData = async (_imgObject) => {
return new Promise(async (resolve) => {
try {
const image = await loadImage(`${_imgObject.path}`);
resolve({ imgObject: _imgObject, loadedImage: image });
});
return {
imgObject: _imgObject,
loadedImage: image,
};
} catch (error) {
console.error("Error loading image:", error);
}
};

const draw = (_imgObject) => {
Expand Down

0 comments on commit b708b3a

Please sign in to comment.