Skip to content

Commit 7ea8094

Browse files
authored
Merge pull request #604 from HashLips/dev
Updated the loadLayerImg
2 parents fd637d5 + 0175989 commit 7ea8094

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ const getElements = (path) => {
7373
.readdirSync(path)
7474
.filter((item) => !/(^|\/)\.[^\/\.]/g.test(item))
7575
.map((i, index) => {
76+
if (i.includes("-")) {
77+
throw new Error(`layer name can not contain dashes, please fix: ${i}`);
78+
}
7679
return {
7780
id: index,
7881
name: cleanName(i),
@@ -178,9 +181,6 @@ const addAttributes = (_element) => {
178181

179182
const loadLayerImg = async (_layer) => {
180183
try {
181-
if (_layer.selectedElement.path.includes("-")) {
182-
throw new Error("layer name can not contain dashes");
183-
}
184184
return new Promise(async (resolve) => {
185185
const image = await loadImage(`${_layer.selectedElement.path}`);
186186
resolve({ layer: _layer, loadedImage: image });

0 commit comments

Comments
 (0)