Skip to content

Commit

Permalink
Remove supportsCustomMaterial, see #237 and #256
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Jul 18, 2024
1 parent fb875a8 commit 76d5c0f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
1 change: 0 additions & 1 deletion js/buoyancy/view/shapes/BuoyancyShapesScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ export default class BuoyancyShapesScreenView extends BuoyancyScreenView<Buoyanc

const materialControlNode = new MaterialControlNode( this.model.materialProperty, new Property( 1 ),
Material.SIMPLE_MASS_MATERIALS, this.popupLayer, {
supportCustomMaterial: false,
tandem: options.tandem.createTandem( 'materialControlNode' )
} );
const objectAShapeSizeControlNode = new ShapeSizeControlNode(
Expand Down
10 changes: 1 addition & 9 deletions js/common/view/MaterialControlNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ type SelfMaterialControlNodeOptions = {
// A label, if provided to be placed to the right of the ComboBox
labelNode?: Node | null;

// If a custom material should be added to the ComboBox
// TODO: delete this, https://github.com/phetsims/density-buoyancy-common/issues/256
supportCustomMaterial?: boolean;

// If a hidden material (Mystery materials for example) should be added to the ComboBox
// TODO: why can't this just be derived from if you pass in mystery material in the parameter? https://github.com/phetsims/density-buoyancy-common/issues/256
supportHiddenMaterial?: boolean;
Expand All @@ -55,7 +51,6 @@ export default class MaterialControlNode extends VBox {
const options = optionize<MaterialControlNodeOptions, SelfMaterialControlNodeOptions, VBoxOptions>()( {
syncCustomMaterialDensity: true,
labelNode: null,
supportCustomMaterial: true,
supportHiddenMaterial: false,
minCustomMass: 0.5,
maxCustomMass: 10,
Expand All @@ -80,9 +75,6 @@ export default class MaterialControlNode extends VBox {
const customMaterials = materials.filter( material => material.custom );
const mysteryMaterials = materials.filter( material => material.hidden );

if ( options.supportCustomMaterial ) {
assert && assert( customMaterials.length > 0, 'custom please' );
}
assert && assert( customMaterials.length <= 1, 'one or less custom materials please' );

const materialToItem = ( material: Material ) => {
Expand Down Expand Up @@ -116,7 +108,7 @@ export default class MaterialControlNode extends VBox {
// TODO: But hidden ones!!! https://github.com/phetsims/density-buoyancy-common/issues/270
const comboBox = new ComboBox( materialProperty, [
...regularMaterials.map( materialToItem ),
...( options.supportCustomMaterial ? customMaterials.map( materialToItem ) : [] ),
...customMaterials.map( materialToItem ),
...mysteryMaterials.map( materialToItem )
], listParent, {
xMargin: 8,
Expand Down

0 comments on commit 76d5c0f

Please sign in to comment.