evaera / matter

A modern ECS library for Roblox.
https://eryn.io/matter/
MIT License
144 stars 34 forks source link

Slider debugger widget returns 0 when panel is closed #66

Closed jackTabsCode closed 8 months ago

jackTabsCode commented 10 months ago

Assuming the following code in a system...

const value = widgets.slider({
    initial: 50,
    min: 1,
    max: 100
})

...value will read 0 if the panel is not open. Once the panel is opened, the widget will return the initial value. I expect the widget to return the initial value if the panel is not open.

I'm assuming this has to do with the panel using dummy handles when the panel is closed.

jackTabsCode commented 10 months ago

Looks like this is not a bug. https://eryn.io/matter/api/Debugger#getWidgets

I don't mind a checkbox or button starting with false, but a slider starting with 0 is, generally speaking, unexpected behavior. We specify an initial value in the slider's options, and it should use it when the debugger is closed. For what I was using the slider for, a value of 0 made me think there was something broken in my game.

Ukendio commented 10 months ago

I agree that this can be improved, have also ran into it being annoying so I will look into this soon :)