Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BooleanController.setValue does not coerce non-boolean values #133

Open
thomb6n opened this issue Jan 28, 2024 · 4 comments
Open

BooleanController.setValue does not coerce non-boolean values #133

thomb6n opened this issue Jan 28, 2024 · 4 comments

Comments

@thomb6n
Copy link

thomb6n commented Jan 28, 2024

When I add a checkbox for a property that can be either true or false, like the wireframe, everything works when using setValue(true) or setValue(false). When I use setValue(1) however, the debug panel shows the checkbox checked, but it doesn't apply the right value to the property. In the case of the wireframe, it still shows all the faces.

@georgealways
Copy link
Owner

Got it—so you're expecting setValue to convert that parameter to a true/false value before actually assigning the property? Curious which 3D library you're using. And after you do this, the value of whatever.wireframe === 1? Thanks

@georgealways georgealways changed the title Bug when using setValue() on a true/false property (checkbox) BooleanController.setValue does not coerce non-boolean values Jan 28, 2024
@thomb6n
Copy link
Author

thomb6n commented Jan 28, 2024

I'm using Three.js. I think converting would be the best solution, an alternative might be to throw an error when not providing true of false instead of having the checkbox checked in the GUI. In my case, "cube.wireframe" was checked as being enabled in the GUI, but it was not actually enabled.

@georgealways
Copy link
Owner

Thanks—let me think on this a little. None of the other controllers do any validating/converting. Right now I like how setValue is "what you set is what you get", but it might be worth making an exception for booleans.

@thomb6n
Copy link
Author

thomb6n commented Jan 28, 2024

No worries, it's not a big deal to me, just felt like a small "bug" worth letting you know about. Thanks for considering!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants