Skip to content

Commit

Permalink
add full nested options support with numberDisplayParentNodeOptions, p…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Aug 27, 2024
1 parent 713407d commit d96b297
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions js/NumberControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ export type NumberControlLayoutFunction4Options = {
// spacing between slider and arrow buttons
arrowButtonSpacing?: number;

hasReadoutProperty?: TReadOnlyProperty<boolean> | null;
// Provided to the containing Node of the NumberDisplay
numberDisplayParentNodeOptions?: StrictOmit<NodeOptions, 'children'>;

// Supports Pendulum Lab's questionText where a question is substituted for the slider
createBottomContent?: ( ( box: HBox ) => Node ) | null;
Expand Down Expand Up @@ -762,7 +763,10 @@ export default class NumberControl extends WidthSizable( Node ) {

// spacing between slider and arrow buttons
arrowButtonSpacing: 5,
hasReadoutProperty: null,

numberDisplayParentNodeOptions: {
excludeInvisibleChildrenFromBounds: true
},

layoutInvisibleButtons: false,

Expand Down Expand Up @@ -801,11 +805,9 @@ export default class NumberControl extends WidthSizable( Node ) {
spacing: options.sliderPadding,
children: [
titleNode,
new Node( {
children: [ numberDisplay ],
visibleProperty: options.hasReadoutProperty || null,
excludeInvisibleChildrenFromBounds: true
} )
new Node( combineOptions<NodeOptions>( {
children: [ numberDisplay ]
}, options.numberDisplayParentNodeOptions ) )
],
layoutOptions: { stretch: true }
} ),
Expand Down

0 comments on commit d96b297

Please sign in to comment.