Skip to content

Commit

Permalink
Add a one-way Property for forwarding the pressed property to the dis…
Browse files Browse the repository at this point in the history
…pensing property for the dropper, see phetsims/ph-scale#71
  • Loading branch information
jonathanolson committed Mar 5, 2018
1 parent 46c86ef commit 5bf59e7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/EyeDropperNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ define( function( require ) {
'use strict';

// modules
var BooleanProperty = require( 'AXON/BooleanProperty' );
var Circle = require( 'SCENERY/nodes/Circle' );
var Image = require( 'SCENERY/nodes/Image' );
var inherit = require( 'PHET_CORE/inherit' );
Expand Down Expand Up @@ -83,7 +84,11 @@ define( function( require ) {
background.y = -background.height;

// button, centered in the dropper's bulb
var button = new RoundMomentaryButton( false, true, this.dispensingProperty, {
var isPressedProperty = new BooleanProperty( false );
isPressedProperty.lazyLink( function( pressed ) {
self.dispensingProperty.value = pressed;
} );
var button = new RoundMomentaryButton( false, true, isPressedProperty, {
baseColor: 'red',
radius: 18,
tandem: options.tandem.createTandem( 'button' )
Expand Down

0 comments on commit 5bf59e7

Please sign in to comment.