Skip to content

Commit

Permalink
allow SunConstants.componentEnabledListener to be overridden by optio…
Browse files Browse the repository at this point in the history
…ns in each sun component, phetsims/scenery#1112
  • Loading branch information
zepumph authored and marlitas committed Jun 28, 2022
1 parent ff675a8 commit d2b3ccb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion js/NumberPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ class NumberPicker extends Node {
arrowLineWidth: 0.25,
valueMaxWidth: null, // {number|null} - If non-null, it will cap the value's maxWidth to this value

// {function(boolean, Node, Object:options):void} - function for controlling the appearance when toggling enabled.
enabledAppearanceStrategy: SunConstants.componentEnabledListener,

/**
* Converts a value to a string to be displayed in a Text node. NOTE: If this function can give different strings
* to the same value depending on external state, it is recommended to rebuild the NumberPicker when that state
Expand Down Expand Up @@ -376,7 +379,7 @@ class NumberPicker extends Node {
this.mutate( options );

// No need to dispose because enabledProperty is disposed in Node
this.enabledProperty.link( SunConstants.getComponentEnabledListener( this, { disabledOpacity: options.disabledOpacity } ) );
this.enabledProperty.link( enabled => options.enabledAppearanceStrategy( enabled, this, { disabledOpacity: options.disabledOpacity } ) );

// Dilate based on consistent technique which brings into account transform of this node.
const focusBounds = this.localBounds.dilated( FocusHighlightPath.getDilationCoefficient( this ) );
Expand Down

0 comments on commit d2b3ccb

Please sign in to comment.