Skip to content

Commit

Permalink
add hintArrowsNode and mark model hintProperty readOnly, #236
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Sep 21, 2021
1 parent 2c81d29 commit b603941
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion js/friction/model/FrictionModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ class FrictionModel extends PhetioObject {

// @public {BooleanProperty} - Show hint icon. Only set by model and on a11y grab interaction.
this.hintProperty = new BooleanProperty( true, {
tandem: tandem.createTandem( 'hintProperty' )
tandem: tandem.createTandem( 'hintProperty' ),
phetioReadOnly: true,
phetioDocumentation: 'whether or not the sim is conveying the hint arrows. This is not editable, but can be ' +
'overridden by toggling the "hintArrowsNode.visibleProperty" in the view.'
} );

// @public {Number} (read-only) - drag and drop book coordinates conversion coefficient
Expand Down
9 changes: 8 additions & 1 deletion js/friction/view/magnifier/MagnifierNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ class MagnifierNode extends Node {
top: ARROW_TOP
} );

// Intermediate Node to support PhET-iO instrumentation that can control the visibility and bypass the sim reverting it (like via reset).
const hintArrowsNode = new Node( {
children: [ visualArrowIcon ],
tandem: options.tandem.createTandem( 'hintArrowsNode' ),
phetioDocumentation: 'the node that holds the visual hint, or "cue" arrows'
} );

// create and register the sound generators that will be used when the top book is picked up and dropped
const bookPickupSoundClip = new SoundClip( harpPickupSound, { initialOutputLevel: SOUND_LEVEL } );
soundManager.addSoundGenerator( bookPickupSoundClip );
Expand Down Expand Up @@ -184,7 +191,7 @@ class MagnifierNode extends Node {
this.topBookBackground.addChild( dragArea );

// add arrows before the drag area, then the grab cue hides the arrows
this.topBookBackground.addChild( visualArrowIcon );
this.topBookBackground.addChild( hintArrowsNode );

addRowCircles(
FrictionModel.MAGNIFIED_ATOMS_INFO.radius,
Expand Down

0 comments on commit b603941

Please sign in to comment.