iconlaunch - Render icons for one item at once

pull/2895/head
Martin Boonk 2023-07-22 12:24:35 +02:00
parent 64238f4ec0
commit 76425b947b
1 changed files with 7 additions and 3 deletions

View File

@ -61,6 +61,8 @@
let i = firstApp - 1; let i = firstApp - 1;
let selectedApp; let selectedApp;
let currentApp; let currentApp;
let layers=[];
let selectedRect;
for (currentApp of apps) { for (currentApp of apps) {
i++; i++;
x += whitespace; x += whitespace;
@ -68,19 +70,21 @@
g.setFontAlign(0, 0, 0).setFont("12x20:2").drawString("?", x + r.x + iconSize / 2, r.y + iconSize / 2); g.setFontAlign(0, 0, 0).setFont("12x20:2").drawString("?", x + r.x + iconSize / 2, r.y + iconSize / 2);
} else { } else {
if (!currentApp.icondata) currentApp.icondata = s.read(currentApp.icon); if (!currentApp.icondata) currentApp.icondata = s.read(currentApp.icon);
g.drawImage(currentApp.icondata, x + r.x, r.y); layers.push({x:x+r.x,y:r.y,image:currentApp.icondata});
} }
if (selectedItem == i) { if (selectedItem == i) {
selectedApp = currentApp; selectedApp = currentApp;
g.drawRect( selectedRect = [
x + r.x - 1, x + r.x - 1,
r.y - 1, r.y - 1,
x + r.x + iconSize + 1, x + r.x + iconSize + 1,
r.y + iconSize + 1 r.y + iconSize + 1
); ];
} }
x += iconSize; x += iconSize;
} }
g.drawImages(layers);
if (selectedRect) g.drawRect.apply(null, selectedRect);
if (selectedApp) drawText(itemI, r.y, selectedApp); if (selectedApp) drawText(itemI, r.y, selectedApp);
}; };