Skip to content

Commit

Permalink
Vertically center number cards in accordion box, see #46
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisklus committed Feb 27, 2022
1 parent 0faecfc commit 1ac7193
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions js/common/view/CASAccordionBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Shape from '../../../../kite/js/Shape.js';

type CASAccordionBoxSelfOptions = {
valueReadoutsNode: ValueReadoutsNode | null;
contentNodeOffsetY: number;
};
export type CASAccordionBoxOptions =
CASAccordionBoxSelfOptions
Expand All @@ -41,7 +42,6 @@ class CASAccordionBox extends AccordionBox {
titleNode: Node, layoutBounds: Bounds2, providedOptions: CASAccordionBoxOptions ) {

const options = optionize<CASAccordionBoxOptions, CASAccordionBoxSelfOptions, AccordionBoxOptions>( {
tandem: Tandem.REQUIRED,
titleAlignX: 'left',
titleXSpacing: 8,
cornerRadius: 6,
Expand All @@ -55,7 +55,8 @@ class CASAccordionBox extends AccordionBox {
expandCollapseButtonOptions: {
sideLength: BUTTON_SIDE_LENGTH
},
titleNode: titleNode
titleNode: titleNode,
tandem: Tandem.REQUIRED
}, providedOptions );

const backgroundNode = new Rectangle( {
Expand All @@ -82,9 +83,9 @@ class CASAccordionBox extends AccordionBox {
checkboxPanel.centerY = fullBackgroundBounds.centerY;
backgroundNode.addChild( checkboxPanel );

// TODO for CK: content has no height at time of instantiation, so does not end up in the correct place.
// TODO-UX: SR says: Perhaps use x and y instead of center which requires bounds
contentNode.centerY = fullBackgroundBounds.centerY;
// TODO: SR says: Perhaps use x and y instead of center in order to vertically center the content, then
// options.contentNodeOffsetY should be omitted
contentNode.centerY = fullBackgroundBounds.centerY + options.contentNodeOffsetY;
backgroundNode.addChild( contentNode );

if ( options.valueReadoutsNode ) {
Expand Down
1 change: 0 additions & 1 deletion js/common/view/DotPlotNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ type DotPlotNodeSelfOptions = {};
export type DotPlotNodeOptions = NodeOptions & RequiredTandem;

// TODO: Name needs to be inclusive of line plots too
// TODO-UX: The tick marks interfere with the Xs on the plot
class DotPlotNode extends Node {

private readonly dotLayer: Node;
Expand Down
1 change: 1 addition & 0 deletions js/common/view/MeanOrMedianScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class MeanOrMedianScreenView extends SoccerScreenView {
titleNode,
this.layoutBounds, {
tandem: accordionBoxTandem,
contentNodeOffsetY: options.isMedianScreen ? -8 : 0,
centerX: this.layoutBounds.centerX,
top: this.questionBar.bottom + CASConstants.SCREEN_VIEW_Y_MARGIN,

Expand Down

0 comments on commit 1ac7193

Please sign in to comment.