phetsims / circuit-construction-kit-common

"Circuit Construction Kit: Basics" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
10 stars 10 forks source link

Support customizable archetypes #876

Closed samreid closed 1 year ago

samreid commented 2 years ago

For https://github.com/phetsims/phet-io/issues/1856

samreid commented 1 year ago

Labeling for design meeting to determine priority/timeline

arouinfar commented 1 year ago

Design meeting 11/30/22 @arouinfar @samreid @matthew-blackman

There is some benefit in allowing instructional designers to customize the archetypes, and we would like to include it in this milestone.

Caveats

samreid commented 1 year ago

We discussed this in https://github.com/phetsims/phet-io/issues/1856#issuecomment-1371353323, the main decisions for this release are:

We also talked about a parallel solution for creating non-archetype defaults "Property" instances, but it seems too much like a parallel workaround. But now I'm wondering why the phetioArchetypeCustomizable elements aren't implemented like that somehow. Can we just create those ones? Or will that have all the baggage of the whole solution anyways?

samreid commented 1 year ago

Here is a line of code that customizes elements as they are created:

phetioClient.invoke( 
'circuitConstructionKitDc.introScreen.model.circuit.resistorGroup.elementCreatedEmitter', 
'addListener', [
      ( state, phetioID ) => phetioClient.invoke( phetioID + '.isEditableProperty', 'setValue', [ false ] )
]);

It can be pasted in the chrome dev tools while running studio. Or it can be added to a wrapper. Or after running Studio => Test, you can paste it in the launched sim. All of these cases work as expected. This seems like a workable solution that is flexible and easy to describe, and already well-supported. If a client requires a UI for customizing defaults or archetypes in studio, we can add a UI for this, or we can reconsider https://github.com/phetsims/phet-io/issues/1856.

@arouinfar can you please test this, and add a note about this to the sim-specific documentation? Or show me where I can do so?

samreid commented 1 year ago

I made a note of this in https://github.com/phetsims/circuit-construction-kit-common/issues/865, perhaps this issue can be closed and we will continue in https://github.com/phetsims/circuit-construction-kit-common/issues/865? Up to @arouinfar

arouinfar commented 1 year ago

Thanks @samreid! I tested it out in the console and it worked well. I copied your comment over into #865 to make it easier to find when writing up the examples doc. I don't think there's anything else to do in this issue, closing.