Skip to content

Commit cf88f0a

Browse files
committed
Bug fixes.
1 parent f7c27bc commit cf88f0a

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/pg/inputPixelEditor/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ A complete JSON storage for a 10x10 image.
104104
"transparent": true,
105105
"colors": [
106106
[0, 0, 0, 0],
107-
[0, 0, 0, 1]
107+
[0, 0, 0, 1],
108+
[255, 255, 255, 1]
108109
],
109110
"layers": [
110111
{

src/pg/inputPixelEditor/inputPixelEditor.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,18 +313,23 @@ export default class PgInputPixelEditor extends HTMLElement {
313313
}
314314
}
315315

316+
getExportLayerIndexes() {
317+
return this.#layers.reduce((arr: any, layer: any, index: number) => {
318+
if (layer.export) {
319+
arr.push(index);
320+
}
321+
return arr;
322+
}, []);
323+
}
324+
316325
/**
317326
* Update cached export grid for performance.
318327
* @param x X
319328
* @param y Y
320329
*/
321330
#updateExport(x: number, y: number) {
322331
let color = 0;
323-
let layers = this.#layers.reduce((acc: any, layer: any, index: number) => {
324-
if (layer.export) {
325-
acc.push(index);
326-
}
327-
}, []);
332+
let layers = this.getExportLayerIndexes();
328333
for (let i = 0; i < layers.length; i++) {
329334
const layer = layers[i];
330335
if (this.#data[layer][y][x] !== 0) {

0 commit comments

Comments
 (0)