-
Notifications
You must be signed in to change notification settings - Fork 12
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
Text/RichText constructor and setTextProperty take different Property types. #1446
Comments
I was told to follow the pattern with Node.visibleProperty (I didn't invent this pattern!)
Perhaps we can improve this pattern @zepumph? Thoughts @pixelzoom? |
Node's visibleProperty is |
It's really weird, and problematic in practice, that the constructor takes a (readonly) |
My understanding was that we want to be able to access things that TProperty provides from getters, e.g.
That doesn't sound like a good argument to me, and perhaps we can change them all to TReadOnlyProperty? |
How about this @jonathanolson? If you agree with it than I can apply it to all Node Properties over in phetsims/axon#391 |
Just a ping here. Then I can proceed with phetsims/axon#391. |
I discussed with @jonathanolson and we like the above commit. @pixelzoom you can now set a DerivedProperty onto Text.stringProperty. Feel free to close! |
👍🏻 closing |
The
textProperty
parameter to Text/RichText constructors differs from setTextProperty:This makes it impossible to provide a DerivedProperty to Text/RichText via
setTextProperty
. Shouldn'tsetTextProperty
also take aTReadOnlyProperty<string>
?I have an immediate need for this in molecule-polarity RealMoleculeViewer.ts:
The assignment to
moleculeText.textProperty
results in this tsc error:I can workaround this in RealMoleculeViewer.ts by creating a new RichText node instead of calling
setTextProperty
. But that will be trouble when I need to instrument for PhET-iO.The text was updated successfully, but these errors were encountered: