-
Notifications
You must be signed in to change notification settings - Fork 6
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
Instrument FineCoarseSpinner with PhET-iO #460
Comments
Here is the list provided:
|
I think this is done with the above commits. To summarize, I
I tested with studio and event console and wrapper unit tests and built phet-io branded FAMB, everything seems to be working. @ariel-phet can you please assign a reviewer? Probably either @zepumph or @samreid, otherwise @pixelzoom because he is the author of FineCoarseSpinner? |
I'll have a look. |
Looks great, but one problem. If a client does this, either by misplacing the tandem for FineCoarseSpinner or attempting to set the tandem for ArrowButtons .... const spinner = new FineCoarseSpinner( ..., {
arrowButtonOptions: {
tandem: tandem.createTandem( ... )
}
} ); .... then Recommended to: (1) (2) When assembling options for each ArrowButton instance, use this form: const leftFineButton = new ArrowButton( 'left', function() {
valueProperty.value = valueProperty.value - options.deltaFine;
}, _.extend( {}, fineButtonOptions, { tandem: options.tandem.createTandem( 'leftFineButton' ) } ) ); |
@jessegreenberg said:
How did you test this? scenery-phet demo is currently not marked as supporting phet-io in package.json. And when I attempt to run the demo with |
I was able to test in FAMB because it's instrumented. So I'm guessing that this was tested in FAMB, but not in scenery-phet demo (which is probably OK). |
Sounds good, and similarly for NumberDisplay, right?
Sorry, not tested in scenery-phet demo. I searched for usages of FineCoarseSpinner to see where tandems were needed (since tandem is required) and noticed some instrumentation in the scenery-phet demo. |
Yes. assert && assert( options.numberDisplayOptions.tandem === undefined,
'FineCoarseSpinners sets numberDisplayOptions.tandem' );
options.numberDisplayOptions = _.extend( {
tandem: options.tandem.createTandem( 'numberDisplay' )
}, options.numberDisplayOptions ); |
Or if you prefer: options.numberDisplayOptions = options.numberDisplayOptions || {};
assert && assert( options.numberDisplayOptions.tandem === undefined,
'FineCoarseSpinners sets numberDisplayOptions.tandem' );
options.numberDisplayOptions.tandem = options.tandem.createTandem( 'numberDisplay' ); |
OK, thanks @pixelzoom, back to you. |
👍 Closing. |
Reopening for phetsims/gas-properties#191. Based on how we're instrumenting sims these days, FineCoarseSpinner seems over-instrumented. For example, all 4 buttons and the NumberDisplay can be hidden independently, resulting in some really unusable configurations, like: Here's an example of the current level of instrumentation, from gas-properties: FineCoarseSpinner is currently used only by gas-properties and forces-and-motion-basics, neither of which has been published as a PhET-iO version. So now would be the time to revise this. @arouinfar Would you like to revisit the instrumentation of FineCoarseSpinner? |
I should also mention that NumberSpinner has a similar over-instrumentation style. Both buttons and the NumberDisplay are fully instrumented, can be hidden separately etc. This is probably a symptom of the "instrument everything" approach that PhET followed for awhile. Or it may be a "feature" for being able to convert a NumberSpinner to a "display" by hiding the buttons (which does not explain why hiding the NumberDisplay is useful) -- not a good way to implement such a feature. NumberPicker seems to have a much more reasonable PhET-iO instrumentation. And in any case, NumberSpinner, NumberPicker, and FineCoarseSpinner are all "spinners" and should have similar PhET-iO instrumentations. See #460. |
@arouinfar and I discussed this in the context of phetsims/gas-properties#30. A better PhET-iO API for spinners would be:
|
Instrumentation was requested in phetsims/forces-and-motion-basics#274, but I have less familiarity with PhET-iO so I would like this to have its own issue for changes and review. Over slack I asked for assistance and got a nice list of steps for this process from @zepumph and @samreid, so I will start there.
The text was updated successfully, but these errors were encountered: