Add code input for number props #364
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Experimenting on this issue #254
This PR aims to improve the regular number input (as seen for the
position,rotation,scaleprops) by adding a toggle to allow the user to input simple code expressions.In this context, a valid expression is an expression that can be resolved in isolation, eg.
2 + 2,Math.PI / 2,Math.sqrt(2)and so on. If a prop contains an identifier from an external variable (myVariable * 2), it then falls under the standard unhandled category.Recommended review path:
NumberInputand aStringInputto allow switching between number and code inputs.undefinedto end up as a string in the code when saving, we want to save actual expressions in the code (Math.PIinstead of"Math.PI")To be improved : there is no visible validation as of now, if an incorrect expression is saved, the prop value is silently replaced with
undefined