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

Add an extended number widget with support for annotations #994

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AustinMroz
Copy link
Collaborator

Frequently, number widgets will have values with special meaning, but these values are not always intuitive. For example, setting cfg to 1.0 disables it even though cfg can be set to less than 1.

This adds three additional options to FLOAT and INT inputs. If any of these is present, the widget is converted to an annotatedNumber on node creation, similar to how multiline string inputs function.

  • reset adds a button to the side to the side of the node to reset it to some chosen value. This does not need to be the same as the default value.
  • disable similarly, adds a button to set the widget to quickly select a value that disables the widgets associated action. If both disable and reset are assigned values, reset takes priority and disable is only shown when the value is already at the assigned reset value
  • mappedValues is a map of potential widget values to strings. When the widget is assigned to the chosen value, the given string is displayed next to it.

annotatedNumber

While the implementation is currently functional, the design is tentative and feedback is appreciated.

Type checking is satisfied aside from the forced widget type

Widgets defined in python code as INT or FLOAT are now converted if the
options includes relevant keys. This grants functionality similar to the
multiline option on strings

Colors now correctly follow themes
Naming now uniformly refers to the widget as an Annotated Number and the
widget is now implemented as a proper typescript class

annotatedNumber widgets can optionally have an annotation function set.
This allows for extensions to set annotations on ranges of values.

Fixed the app import incorrectly having an extension
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

Successfully merging this pull request may close these issues.

1 participant