Skip to content

Commit

Permalink
delete unused padding option, #344
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Malley <cmalley@pixelzoom.com>
  • Loading branch information
pixelzoom committed Aug 15, 2018
1 parent 17f6c65 commit 563ca55
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
13 changes: 4 additions & 9 deletions js/VerticalAquaRadioButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ define( function( require ) {
touchAreaXDilation: 0,
mouseAreaXDilation: 0,

//TODO #344 this is the total of left and right margins, replace with xMargin?
padding: 8,

// supertype options
// supertype options
spacing: 3, // vertical space between each button
tandem: Tandem.required,
Expand All @@ -65,14 +63,11 @@ define( function( require ) {
assert && assert( !options.children, 'VerticalAquaRadioButtonGroup sets children' );

// Determine the max item width
var maxWidth = 0;
var maxItemWidth = 0;
for ( var i = 0; i < items.length; i++ ) {
maxWidth = Math.max( maxWidth, items[ i ].node.width );
maxItemWidth = Math.max( maxItemWidth, items[ i ].node.width );
}

// Uniform button width
var buttonWidth = maxWidth + options.padding;

// Create a radio button for each item
options.children = [];
for ( i = 0; i < items.length; i++ ) {
Expand All @@ -81,7 +76,7 @@ define( function( require ) {

// Content for the radio button. Add an invisible strut, so that buttons have uniform width.
var content = new Node( {
children: [ new HStrut( buttonWidth + options.padding ), item.node ]
children: [ new HStrut( maxItemWidth ), item.node ]
} );

var radioButton = new AquaRadioButton( item.property, item.value, content,
Expand Down
19 changes: 7 additions & 12 deletions js/VerticalCheckboxGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ define( function( require ) {
* @param {Object[]} items - Each item describes a checkbox, and is an object with these properties:
* node: Node, // label for the button
* property: Property.<boolean>, // Property associated with the button
* indent: number, // how much to indent each check box from the left edge
* indent: number|undefined, // how much to indent each check box from the left edge
* [tandemName: Tandem] // optional tandem for PhET-iO
* @param {Object} [options]
* @constructor
Expand All @@ -35,13 +35,10 @@ define( function( require ) {
// {Object|null} options passed to constructor of the Checkbox
checkboxOptions: null,

// dilation of pointer areas, y dimension is computed
// dilation of pointer areas for each checkbox, y dimension is computed
touchAreaXDilation: 5,
mouseAreaXDilation: 5,

//TODO #344 this is the total of left and right margins, replace with xMargin?
padding: 8,

// supertype options
spacing: 10, // vertical spacing
align: 'left',
Expand All @@ -51,11 +48,10 @@ define( function( require ) {
// Verify that the client hasn't set options that we will be overwriting.
assert && assert( !options.children, 'VerticalCheckboxGroup sets children' );

//TODO #344 there's a bug here, indent for each item is not considered
// Determine the max item width
var maxWidth = 0;
var maxItemWidth = 0;
for ( var i = 0; i < items.length; i++ ) {
maxWidth = Math.max( maxWidth, items[ i ].node.width );
maxItemWidth = Math.max( maxItemWidth, items[ i ].node.width );
}

// Create a checkbox for each item
Expand All @@ -65,9 +61,9 @@ define( function( require ) {
var item = items[ i ];
var indent = item.indent || 0;

// Content for the checkbox. Add an invisible strut, so that buttons have uniform width.
// Content for the checkbox. Add an invisible strut, so that checkboxes have uniform width.
var content = new Node( {
children: [ new HStrut( maxWidth + options.padding - indent ), item.node ]
children: [ new HStrut( maxItemWidth - indent ), item.node ]
} );

var checkbox = new Checkbox( content, item.property, _.extend( {}, options.checkboxOptions, {
Expand All @@ -79,8 +75,7 @@ define( function( require ) {
checkbox.mouseArea = checkbox.localBounds.dilatedXY( options.mouseAreaXDilation, yDilation );
checkbox.touchArea = checkbox.localBounds.dilatedXY( options.touchAreaXDilation, yDilation );

//TODO #344 indent feature is missing from VerticalAquaRadioButtonGroup, should it be added?
//TODO #344 I can think of other ways to indent that don't involve 2 additional nodes
//TODO #344 add indent feature to VerticalAquaRadioButtonGroup
if ( item.indent ) {

// indent the checkbox from the left edge using a strut
Expand Down

0 comments on commit 563ca55

Please sign in to comment.