-
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
Refine the tandems for color support #1251
Comments
Instrumented I think we should go ahead and rename the property to |
In phetsims/scenery-phet#515 (comment) @pixelzoom said:
|
…a tandem ending in ColorProperty, see #1251
…a tandem ending in ColorProperty, see phetsims/scenery#1251
…a tandem ending in ColorProperty, see phetsims/scenery#1251
I added assertions for that in the preceding commits. |
I moved the property to e.g., |
Every sim now has one, so I believe you should put it in general. I think it's very unlikely we will feature it. Once you do that, I'd just pass this issue to a designer to review the studio tree. Pick a sim that has an instrumented color Property. |
In #1257 (comment) you mention |
Thanks, after reading this documentation in Tandem I see that /**
* Many simulation elements are nested under "general". This tandem is for elements that exists in all sims. For a
* place to put simulation specific globals, see `GLOBAL`
*
* @constant
* @type {Tandem}
*/
const GENERAL = Tandem.ROOT.createTandem( window.phetio.PhetioIDUtils.GENERAL_COMPONENT_NAME ); By that logic, it seems like
As described in #1257, many ProfileColorProperties will need to be static, and we do not have a way to pass tandems statically.
How about |
I feel this seems antithetical to the primary points we (@samreid and @zepumph) are making over in #1257. We want to prefer putting colors in the spots they are used. If they are declared statically, then they probably just belong in a constants collection or something. Wouldn't it be based on sim-specific needs? |
@zepumph and I discussed, and agreed:
|
Is the tandem strucuture flat for colors, all elements appearing under Suppose that we have default colors for Slider, defined as static ProfileColorProperty instances in Slider.js. Which of these did you have in mind?
(3) makes the most sense to me. Hierarchical structure is more likely to also avoid name collisions. For example, what if I have a custom Slider, with its own sliderDefaultThumbFillProperty? A flat structure also has the problem that colors related to "slider" will not be grouped together in the tandem tree, unless you use a "slider" prefix on every tandem name, as I've done in (1) above. |
I'd like to see a convention something like this for instances that are defined at usage sites:
e.g.:
But that's even problematic, because class names are not unique across all repos. Maybe this?
e.g.:
|
For instances that are defined in RepoColor.js, I think we also need a convention that prevents namespace collisions with colors in other repos. Maybe something like this:
e.g.
I really don't want to have to rename FMWColor // Fill for all Panels
panelFillProperty: new ProfileColorProperty( 'panelFill', {
default: Color.grayColor( 245 )
} ), ... to something ugly/verbose in order to avoid name collision, like: // Fill for all Panels
fourieMakingWavesPanelFillProperty: new ProfileColorProperty( 'fourieMakingWavesPanelFillProperty', {
default: Color.grayColor( 245 ),
tandem: Tandem.COLORS.createTandem( 'fourieMakingWavesPanelFillProperty' )
} ), |
Also note in the above example that I've had to duplicate |
The last few comments have apparently been moved to related issue #1259 |
I addressed the recommendations from #1251 (comment), @zepumph can you please review? The subsequent comments will be addressed in #1259 |
All looks good to me. Thanks |
Thanks, closing. |
Reopening since CT is showing several errors like this:
|
This has been on CT since at least Nov 27. I confirmed that running "colorProfileProperty": {
"_data": {
"initialState": {
"units": null,
"validValues": [
"default"
],
"value": "default"
}
},
"_metadata": {
"phetioTypeName": "PropertyIO<StringIO>"
}
}, |
I saw that the API files were never regenerated after the work in this issue. They were generated many other times for other issues, but somehow we never picked up the @pixelzoom also hypothesized that the error may be related to the recent port of ProfileColorProperty and colorProfileProperty to TypeScript. I tried reverting ProfileColorProperty but I received the same error. |
I added the |
I'm quite tired of needing to specify the list to the stable phet-io sims, so I to help me review this issue, I made a After calling this, I found no differences in the api files. Ready to close? |
From phetsims/scenery-phet#515, there was a TODO
I have left the tandem alone for the color profile (thus maintaining backward compatibility), but it no longer matches the code and this would be a good opportunity to decide what the tandems should be like, both for the
colorProfileProperty
and for the individualProfileColorProperty
instances. @zepumph can you please make an an initial recommendation, and escalate to a phet-io design meeting if necessary?The text was updated successfully, but these errors were encountered: