Skip to content

Commit

Permalink
Shorten boolean logic, see #119
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisklus committed Apr 4, 2022
1 parent d6e35fa commit 64068cb
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions js/common/view/CAVObjectNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,12 @@ class CAVObjectNode extends Node {
( mode, value, selfInputEnabled, objectsInputEnabled ) => {
const inputEnabled = value !== null && mode === AnimationMode.NONE && selfInputEnabled && objectsInputEnabled;

// if input is disabled and the ball is in the play area, show the darker version
if ( !inputEnabled && options.objectViewType === CAVObjectType.SOCCER_BALL && value !== null ) {
soccerBallDarkNode.visible = true;
soccerBallNode.visible = false;
}
else {
soccerBallDarkNode.visible = false;
soccerBallNode.visible = true;
if ( options.objectViewType === CAVObjectType.SOCCER_BALL ) {

// if input is disabled and the ball is in the play area, show the darker version
const showDisabledSoccerBall = !inputEnabled && value !== null;
soccerBallDarkNode.visible = showDisabledSoccerBall;
soccerBallNode.visible = !showDisabledSoccerBall;
}

this.inputEnabled = inputEnabled;
Expand Down

0 comments on commit 64068cb

Please sign in to comment.