cocopon / tweakpane

:control_knobs: Compact GUI for fine-tuning parameters and monitoring value changes
https://tweakpane.github.io/docs/
MIT License
3.41k stars 85 forks source link

Numerical values passed as list of strings incorrectly treated as colors #601

Closed Sija closed 1 week ago

Sija commented 4 months ago

Image is worth a thousand words, so here it goes:

image
const object = {
  "ISO Speed": "3200",
};
const options = {
  "100": "100",
  "125": "125",
  "160": "160",
  "200": "200",
  "250": "250",
  "320": "320",
  "400": "400",
  "500": "500",
  "640": "640",
  "800": "800",
  "1000": "1000",
  "1250": "1250",
  "1600": "1600",
  "2000": "2000",
  "2500": "2500",
  "3200": "3200",
  "4000": "4000",
  "5000": "5000",
  "6400": "6400",
  "8000": "8000",
  "10000": "10000",
  "12800": "12800",
  "16000": "16000",
  "20000": "20000",
  "25600": "25600",
  "Auto": "Auto",
};

pane.addBinding(object, "ISO Speed", { options });
pane.addBinding(object, "ISO Speed", { view: "list", options }); // doesn't work either
cocopon commented 4 months ago

This is caused by a bug of parsing color string.

https://github.com/cocopon/tweakpane/blob/55631021a0e27dfedff9fb72b3fb39abccf10206/packages/core/src/input-binding/color/converter/color-string.ts#L211

'3200' should not be parsed as a color string, but it is. I'll fix it later.

cocopon commented 4 months ago

Fixed, please wait for the next release.

cocopon commented 1 week ago

Released in 4.0.4. Thank you for reporting the issue.