Skip to content

Commit 97d2ffa

Browse files
fix: put all max number of colors to 10
1 parent f7cfed7 commit 97d2ffa

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

main.ts

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -88,34 +88,14 @@ window.onload = () => {
8888
})
8989

9090
// Add onChange handler
91-
paletteSelector.on("change", (ev) => {
92-
// Update max colors based on palette
93-
const paletteColors = ev.value ? moviePalettes.get(ev.value)?.colors : undefined
94-
if (paletteColors) {
95-
const maxColors = paletteColors.length
96-
// Update max values for color count blades
97-
cca1dColorsCountBlade.max = Math.min(maxColors, 5) // Keep original max as upper limit
98-
cca2dColorsCountBlade.max = Math.min(maxColors, 20)
99-
cca3dColorsCountBlade.max = Math.min(maxColors, 10)
100-
101-
// Adjust current values if they exceed new max
102-
if (cca1dColorsCountBlade.value > maxColors) cca1dColorsCountBlade.value = maxColors
103-
if (cca2dColorsCountBlade.value > maxColors) cca2dColorsCountBlade.value = maxColors
104-
if (cca3dColorsCountBlade.value > maxColors) cca3dColorsCountBlade.value = maxColors
105-
} else {
106-
// Reset to original max values
107-
cca1dColorsCountBlade.max = 5
108-
cca2dColorsCountBlade.max = 20
109-
cca3dColorsCountBlade.max = 10
110-
}
111-
112-
void reset() // Reset automaton with new palette
91+
paletteSelector.on("change", () => {
92+
void reset() // Just reset automaton with new palette
11393
})
11494

11595
const cca2dColorsCountBlade = pane.addBinding(
11696
{ cca2dColorsCount: 8 },
11797
"cca2dColorsCount",
118-
{ label: "Number of colors", min: 2, max: 20, step: 1 },
98+
{ label: "Number of colors", min: 2, max: 10, step: 1 },
11999
)
120100
const cca2dThresholdBlade = pane.addBinding(
121101
{ cca2dThreshold: 2 },
@@ -140,7 +120,7 @@ window.onload = () => {
140120
const entropyColorsCountBlade = pane.addBinding(
141121
{ entropyColorsCount: 4 },
142122
"entropyColorsCount",
143-
{ label: "Number of colors", min: 2, max: 20, step: 1 },
123+
{ label: "Number of colors", min: 2, max: 10, step: 1 },
144124
)
145125
const resolutionBlade = pane.addBinding({ resolution: 5 }, "resolution", {
146126
label: "Resolution",

0 commit comments

Comments
 (0)