Skip to content

Commit

Permalink
#27 move color constants
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonLi8 committed May 22, 2020
1 parent bd856e8 commit 2d48d7c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 5 additions & 0 deletions js/common/CollisionLabColors.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ const CollisionLabColors = {
PANEL_COLORS: {
stroke: 'rgb( 190, 190, 190 )',
fill: 'rgb( 240, 240, 240 )'
},

KEYPAD_TEXT_COLORS: {
error: Color.RED,
default: Color.BLACK
}
};

Expand Down
12 changes: 4 additions & 8 deletions js/common/view/KeypadDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ import collisionLabStrings from '../../collisionLabStrings.js';
import CollisionLabColors from '../CollisionLabColors.js';
import CollisionLabConstants from '../CollisionLabConstants.js';

// constants
const TEXT_FILL_DEFAULT = 'black';
const TEXT_FILL_ERROR = 'red';

class KeypadDialog extends Dialog {

/**
Expand Down Expand Up @@ -132,8 +128,8 @@ class KeypadDialog extends Dialog {

// Observe when a key is pressed and reset text colors. Link is never disposed.
this.keypad.accumulatedKeysProperty.link( () => {
this.valueText.fill = TEXT_FILL_DEFAULT;
this.rangeText.fill = TEXT_FILL_DEFAULT;
this.valueText.fill = CollisionLabColors.KEYPAD_TEXT_COLORS.default;
this.rangeText.fill = CollisionLabColors.KEYPAD_TEXT_COLORS.default;
} );
}

Expand Down Expand Up @@ -203,8 +199,8 @@ class KeypadDialog extends Dialog {
* @private
*/
warnOutOfRange() {
this.valueText.fill = TEXT_FILL_ERROR;
this.rangeText.fill = TEXT_FILL_ERROR;
this.valueText.fill = CollisionLabColors.KEYPAD_TEXT_COLORS.error;
this.rangeText.fill = CollisionLabColors.KEYPAD_TEXT_COLORS.error;
this.keypad.setClearOnNextKeyPress( true );
}

Expand Down

0 comments on commit 2d48d7c

Please sign in to comment.