Skip to content

Commit 102b978

Browse files
Support probability
1 parent e1d3ee8 commit 102b978

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

public/app.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,11 @@ function queueLiveApply(source = "Configuration live") {
370370
}, 120);
371371
}
372372

373+
function activateInitialMode(mode) {
374+
if (controls.initialMode.value === mode) return;
375+
controls.initialMode.value = mode;
376+
}
377+
373378
function applyConfig(config, { source = "Configuration" } = {}) {
374379
const normalized = window.AutomaginariumCore.normaliserConfiguration(config);
375380
const validation = validateConfig(normalized);
@@ -478,6 +483,16 @@ liveControlEntries.forEach(([control, eventName]) => {
478483
queueLiveApply();
479484
});
480485
});
486+
controls.initialValues.addEventListener("input", () => {
487+
if (controls.initialValues.value.trim() === "") return;
488+
activateInitialMode("motif");
489+
queueLiveApply();
490+
});
491+
controls.initialProbability.addEventListener("input", () => {
492+
if (controls.initialProbability.value === "") return;
493+
activateInitialMode("aleatoire");
494+
queueLiveApply();
495+
});
481496
controls.wolframRule.addEventListener("input", () => {
482497
updateHudRule();
483498
if (controls.ruleGenerator.value !== "wolfram") return;

0 commit comments

Comments
 (0)