iconlaunch - Use objects instead of arrays

pull/2895/head
Martin Boonk 2023-07-25 20:43:12 +02:00
parent 7e0dbbf6f0
commit a9fff20477
1 changed files with 5 additions and 3 deletions

View File

@ -45,18 +45,20 @@
const iconYoffset = Math.floor(whitespace/4)-1; const iconYoffset = Math.floor(whitespace/4)-1;
const itemSize = iconSize + whitespace; const itemSize = iconSize + whitespace;
launchCache.items = []; let t = Date.now();
launchCache.items = {};
for (let c of launchCache.apps){ for (let c of launchCache.apps){
let i = Math.floor(count/appsN); let i = Math.floor(count/appsN);
if (!launchCache.items[i]) if (!launchCache.items[i])
launchCache.items.push([]); launchCache.items[i] = {};
launchCache.items[Math.floor(count/appsN)].push(c); launchCache.items[i].push(count%3);
if (c.icon) if (c.icon)
c.icondata = s.read(c.icon); c.icondata = s.read(c.icon);
else else
c.icondata = ICON_MISSING; c.icondata = ICON_MISSING;
count++; count++;
} }
let drawItem = function(itemI, r) { let drawItem = function(itemI, r) {
let x = 0; let x = 0;
let apps = launchCache.items[itemI]; let apps = launchCache.items[itemI];