Skip to content

Commit

Permalink
big ComboBox refactors, phetsims/sun#430, phetsims/sun#428, phetsims/…
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jan 15, 2019
1 parent e45bda7 commit ebf8f5d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
11 changes: 4 additions & 7 deletions js/common/GasPropertiesConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@ define( require => {
SIM_TIME_STEP: 0.2, // ps

COMBO_BOX_OPTIONS: {
itemHighlightFill: 'rgba( 255, 0, 0, 0.1 )',
highlightFill: 'rgba( 255, 0, 0, 0.1 )',
align: 'right',
buttonXMargin: 5,
buttonYMargin: 2,
buttonCornerRadius: 5,
itemXMargin: 2,
itemYMargin: 2,
buttonLineWidth: 0.4
cornerRadius: 5,
xMargin: 5,
yMargin: 4
},

// Options common to all NumberDisplay items that are used in ComboBoxes
Expand Down
8 changes: 3 additions & 5 deletions js/common/view/CollisionCounterNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,9 @@ define( require => {
const comboBox = new ComboBox( comboBoxItems, collisionCounter.averagingTimeProperty, comboBoxListParent, {
listPosition: 'below',
align: 'right',
buttonXMargin: 5,
buttonYMargin: 2,
buttonCornerRadius: 5,
itemXMargin: 2,
itemYMargin: 2
xMargin: 6,
yMargin: 3,
cornerRadius: 5
} );

// all of the stuff that appear on the counter
Expand Down
3 changes: 3 additions & 0 deletions js/common/view/PressureDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ define( require => {
// modules
const ComboBoxDisplay = require( 'SCENERY_PHET/ComboBoxDisplay' );
const gasProperties = require( 'GAS_PROPERTIES/gasProperties' );
const GasPropertiesConstants = require( 'GAS_PROPERTIES/common/GasPropertiesConstants' );
const PressureGauge = require( 'GAS_PROPERTIES/common/model/PressureGauge' );
const Range = require( 'DOT/Range' );

Expand All @@ -30,6 +31,8 @@ define( require => {
*/
constructor( pressureGauge, listParent, options ) {

options = _.extend( {}, GasPropertiesConstants.COMBO_BOX_OPTIONS, options );

const items = [
{
choice: PressureGauge.Units.KILOPASCALS,
Expand Down
3 changes: 3 additions & 0 deletions js/common/view/TemperatureDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ define( require => {
// modules
const ComboBoxDisplay = require( 'SCENERY_PHET/ComboBoxDisplay' );
const gasProperties = require( 'GAS_PROPERTIES/gasProperties' );
const GasPropertiesConstants = require( 'GAS_PROPERTIES/common/GasPropertiesConstants' );
const Range = require( 'DOT/Range' );
const Thermometer = require( 'GAS_PROPERTIES/common/model/Thermometer' );

Expand All @@ -30,6 +31,8 @@ define( require => {
*/
constructor( thermometer, listParent, options ) {

options = _.extend( {}, GasPropertiesConstants.COMBO_BOX_OPTIONS, options );

const items = [
{
choice: Thermometer.Units.KELVIN,
Expand Down

0 comments on commit ebf8f5d

Please sign in to comment.