Skip to content

Commit

Permalink
Add missing required tandems, see #216
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisklus committed Jan 23, 2020
1 parent fb49c9d commit 46a0c77
Show file tree
Hide file tree
Showing 8 changed files with 564 additions and 14 deletions.
5 changes: 3 additions & 2 deletions js/common/view/EFACTemperatureAndColorSensorNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ define( require => {
cursor: 'pointer',

// phet-io
tandem: Tandem.OPTIONAL
tandem: Tandem.REQUIRED
}, options );

super( options );
Expand Down Expand Up @@ -71,7 +71,8 @@ define( require => {
},
endDrag: () => {
temperatureAndColorSensor.userControlledProperty.set( false );
}
},
tandem: options.tandem.createTandem( 'inputListener' )
} ) );
}
}
Expand Down
3 changes: 2 additions & 1 deletion js/intro/view/BeakerContainerView.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ define( require => {
this.grabNode,
modelViewTransform,
constrainPosition,
model.isPlayingProperty
model.isPlayingProperty,
options.tandem.createTandem( 'inputListener' )
) );
}

Expand Down
3 changes: 2 additions & 1 deletion js/intro/view/BlockNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ define( require => {
this,
modelViewTransform,
constrainPosition,
simIsPlayingProperty
simIsPlayingProperty,
options.tandem.createTandem( 'inputListener' )
) );
}

Expand Down
10 changes: 5 additions & 5 deletions js/intro/view/ThermalElementDragHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ define( require => {
* @param {ModelViewTransform2} modelViewTransform
* @param {function} constrainPosition
* @param {BooleanProperty} simIsPlayingProperty
* @param {Tandem} tandem
*/
constructor(
modelElement,
screenViewChildNode,
modelViewTransform,
constrainPosition,
simIsPlayingProperty
simIsPlayingProperty,
tandem
) {

const dragStartOffset = new Vector2( 0, 0 );
Expand All @@ -35,7 +37,6 @@ define( require => {

// allow moving a finger (touch) across a screenViewChildNode to pick it up
allowTouchSnag: true,

start: event => {

// make sure the sim is playing when an element is grabbed - this will resume the sim if it is paused
Expand All @@ -49,18 +50,17 @@ define( require => {
dragStartPosition.y - modelElementViewPosition.y
);
},

drag: event => {
const dragPosition = currentTarget.globalToParentPoint( event.pointer.point );
const modelElementViewPosition = dragPosition.minus( dragStartOffset );
const modelElementPosition = modelViewTransform.viewToModelPosition( modelElementViewPosition );
modelElement.positionProperty.set( constrainPosition( modelElement, modelElementPosition ) );
},

end: () => {
modelElement.userControlledProperty.set( false );
currentTarget = null;
}
},
tandem: tandem
} );
}
}
Expand Down
Loading

0 comments on commit 46a0c77

Please sign in to comment.