Skip to content

Commit

Permalink
Hide the battery resistance readout when its value is the minimum, see
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Apr 1, 2021
1 parent 8903609 commit b7fa22a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/view/ValueNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import VBox from '../../../scenery/js/nodes/VBox.js';
import Color from '../../../scenery/js/util/Color.js';
import Panel from '../../../sun/js/Panel.js';
import CCKCConstants from '../CCKCConstants.js';
import CCKCQueryParameters from '../CCKCQueryParameters.js';
import circuitConstructionKitCommonStrings from '../circuitConstructionKitCommonStrings.js';
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
import Capacitor from '../model/Capacitor.js';
Expand Down Expand Up @@ -97,8 +98,8 @@ class ValueNode extends Panel {
} );

// If the children should change, update them here
if ( lastInternalResistance === null || ( internalResistance === 0 || lastInternalResistance === 0 ) ) {
const desiredChildren = internalResistance > 0 ? [ voltageText, resistanceNode ] : [ voltageText ];
if ( lastInternalResistance === null || ( internalResistance <= CCKCQueryParameters.batteryMinimumResistance || lastInternalResistance <= CCKCQueryParameters.batteryMinimumResistance ) ) {
const desiredChildren = internalResistance > CCKCQueryParameters.batteryMinimumResistance ? [ voltageText, resistanceNode ] : [ voltageText ];

// Only set children if changed
if ( contentNode.getChildrenCount() !== desiredChildren.length ) {
Expand Down

0 comments on commit b7fa22a

Please sign in to comment.