@idle-screens/savers-classic 3.2.2 → 3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/idle-worker.js +14 -1
- package/dist/idle-worker.js.map +1 -1
- package/package.json +4 -4
package/dist/idle-worker.js
CHANGED
|
@@ -231,7 +231,20 @@ var LAYER_PROPS_ON_SPRITE = /* @__PURE__ */ new Set(["blend", "trail", "alpha",
|
|
|
231
231
|
function unknownKeys(obj, known) {
|
|
232
232
|
return Object.keys(obj).filter((k) => !known.has(k));
|
|
233
233
|
}
|
|
234
|
+
function normalizeColors(spec) {
|
|
235
|
+
if (!isObj(spec) || !Array.isArray(spec.layers)) return;
|
|
236
|
+
for (const layer of spec.layers) {
|
|
237
|
+
if (!isObj(layer)) continue;
|
|
238
|
+
const sprite = layer.sprite;
|
|
239
|
+
if (!isObj(sprite)) continue;
|
|
240
|
+
const sp = sprite;
|
|
241
|
+
if (Array.isArray(sp.colors) && sp.colors.length > 0 && sp.color === void 0) {
|
|
242
|
+
sp.color = sp.colors[0];
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
234
246
|
function validateSpec(spec) {
|
|
247
|
+
normalizeColors(spec);
|
|
235
248
|
const errors = [];
|
|
236
249
|
const warnings = [];
|
|
237
250
|
const err = (path, message) => void errors.push({ path, message });
|
|
@@ -813,7 +826,7 @@ function weightedIndex(u, weights) {
|
|
|
813
826
|
return weights.length - 1;
|
|
814
827
|
}
|
|
815
828
|
function buildEntities(layer, rng, w, h, scale = 1, countScale = 1) {
|
|
816
|
-
const effectiveCount = countScale === 1 ? layer.count : Math.max(1, Math.min(
|
|
829
|
+
const effectiveCount = countScale === 1 || layer.layout?.type === "grid" ? layer.count : Math.max(1, Math.min(
|
|
817
830
|
Math.round(layer.count * countScale),
|
|
818
831
|
layer.links ? LIMITS.maxLinkLayerCount : LIMITS.maxPerLayer
|
|
819
832
|
));
|