Skip to content

Commit

Permalink
MaxWidth adjusted for collection panel texts. Doc update and remove u…
Browse files Browse the repository at this point in the history
…nused constant. #164
  • Loading branch information
Denz1994 committed Mar 9, 2020
1 parent 022d901 commit d70e927
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions js/common/view/CollectionBoxNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import Molecule3DNode from './view3d/Molecule3DNode.js';
import ShowMolecule3DButtonNode from './view3d/ShowMolecule3DButtonNode.js';

// constants
const MOLECULE_PADDING = 0;
const BLACK_BOX_PADDING = BAMConstants.HAS_3D ? 7 : 0;

class CollectionBoxNode extends VBox {
Expand All @@ -35,7 +34,7 @@ class CollectionBoxNode extends VBox {
super( options );
this.box = box;
this.moleculeNodes = [];
this.moleculeNodeMap = {}; // molecule ID => node, stores nodes for each moecule
this.moleculeNodeMap = {}; // molecule ID => node, stores nodes for each molecule
this.blinkTimeout = null; // NOT zero, since that could be a valid timeout ID for window.setTimeout!
this.boxNode = new Node();
this.moleculeIdThumbnailMap = {}; // maps moleculeId => Node (thumbnail view for the molecule)
Expand Down Expand Up @@ -213,7 +212,7 @@ class CollectionBoxNode extends VBox {
let x = 0;
moleculeNodes.forEach( moleculeNode => {
moleculeNode.setTranslation( x, ( maxHeight - moleculeNode.height ) / 2 );
x += moleculeNode.width + MOLECULE_PADDING;
x += moleculeNode.width;
} );
}

Expand Down
4 changes: 2 additions & 2 deletions js/common/view/CollectionPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CollectionPanel extends Panel {
font: new PhetFont( {
size: 22
} ),
maxWidth: BAMConstants.TEXT_MAX_WIDTH
maxWidth: BAMConstants.TEXT_MAX_WIDTH - 10
} );
this.layoutNode.addChild( yourMoleculesText );

Expand All @@ -63,7 +63,7 @@ class CollectionPanel extends Panel {
size: 16,
weight: 'bold'
} ),
maxWidth: BAMConstants.TEXT_MAX_WIDTH
maxWidth: BAMConstants.TEXT_MAX_WIDTH - 10
} );

// Manages changing the label of the current collection
Expand Down

0 comments on commit d70e927

Please sign in to comment.