Skip to content

Commit

Permalink
Added REVIEW comments regarding unlink() #29
Browse files Browse the repository at this point in the history
  • Loading branch information
Denz1994 committed Dec 21, 2018
1 parent 317d3ed commit 7787668
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions js/building/model/ShapePiece.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ define( require => {
this.dampedHarmonicTimeElapsed = 0;
this.trueTargetRotation = 0;

// REVIEW: Does this property need an unlink?
this.isUserControlledProperty.link( isUserControlled => {
if ( isUserControlled ) {
this.shadowProperty.value = 1;
Expand Down
2 changes: 2 additions & 0 deletions js/building/view/NumberPieceNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ define( require => {
options.dropListener && options.dropListener( wasTouch );
}
} );

// REVIEW: Does this need an unlink?
this.dragListener.isUserControlledProperty.link( controlled => {
numberPiece.isUserControlledProperty.value = controlled;
} );
Expand Down
1 change: 1 addition & 0 deletions js/building/view/ShapePieceNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ define( require => {
options.dropListener && options.dropListener( wasTouch );
}
} );
// REVIEW: Does this need an unlink?
this.dragListener.isUserControlledProperty.link( controlled => {
shapePiece.isUserControlledProperty.value = controlled;
} );
Expand Down
2 changes: 2 additions & 0 deletions js/game/view/FractionChallengeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ define( require => {
this.levelCompleteListener = score => {
this.levelCompleteNode.visible = score === this.challenge.targets.length;
};

// REVIEW: Does this listener need an unlink?
this.challenge.scoreProperty.link( this.levelCompleteListener );

// layout
Expand Down
2 changes: 2 additions & 0 deletions js/intro/view/EqualityLabScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ define( require => {
beakerIcon
]
} );
// REVIEW: Does this need an unlink?
model.representationProperty.link( representation => {
circularIcon.visible = representation === IntroRepresentation.CIRCLE;
horizontalIcon.visible = representation === IntroRepresentation.HORIZONTAL_BAR;
Expand Down Expand Up @@ -159,6 +160,7 @@ define( require => {
multipliedFractionNode.centerY = bottomAlignY;
multiplierSpinner.centerY = bottomAlignY;

// REVIEW: Does this need an unlink?
model.representationProperty.link( () => {
this.viewContainer.right = this.representationPanel.right;
} );
Expand Down
1 change: 1 addition & 0 deletions js/lab/view/LabShapePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ define( require => {
boxContainer
];

// REVIEW: Does this need an unlink?
this.representationProperty.link( representation => {
this.pieBox.visible = representation === BuildingRepresentation.PIE;
this.barBox.visible = representation === BuildingRepresentation.BAR;
Expand Down
5 changes: 5 additions & 0 deletions js/matcher/view/LevelNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ define( require => {
};

//show correct button depending on the previous actions
// REVIEW: Does this need an unlink?
model.buttonStatusProperty.link( function updateButtonStatus( value ) {
buttonOk.setVisible( value === 'ok' );
buttonCheck.setVisible( value === 'check' );
Expand All @@ -293,19 +294,23 @@ define( require => {
}
} );

// REVIEW: Doc typo?
//adjustion timer position if necessary
// REVIEW: Does this need an unlink?
model.gameModel.isTimerProperty.link( function( isTimer ) {
timeLabel.visible = isTimer;
vBox.right = model.gameModel.width - margin;
} );

//update timer
// REVIEW: Does this need an unlink?
model.timeProperty.link( function( newTime ) {
timeLabel.text = StringUtils.format( timeNumberSecString, Util.toFixed( newTime, 0 ) );
vBox.right = model.gameModel.width - margin;
} );

//update score
// REVIEW: Does this need an unlink?
model.scoreProperty.link( function( newScore ) {
scoreLabel.text = StringUtils.format( labelScoreString, newScore );
vBox.right = model.gameModel.width - margin;
Expand Down
1 change: 1 addition & 0 deletions js/matcher/view/LevelsContainerNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ define( require => {

this.levelNodes = [];

// REVIEW: Does this need an unlink?
model.currentLevelProperty.link( function( newLevel ) {
if ( newLevel > 0 ) {
//generate each node levelNode on demand, to make loading faster
Expand Down

0 comments on commit 7787668

Please sign in to comment.