Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Mar 3, 2022
2 parents c997b89 + 27afee6 commit b9b75a0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
20 changes: 10 additions & 10 deletions js/layout/FlowConstraint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import TinyProperty from '../../../axon/js/TinyProperty.js';
import Bounds2 from '../../../dot/js/Bounds2.js';
import Orientation from '../../../phet-core/js/Orientation.js';
import arrayRemove from '../../../phet-core/js/arrayRemove.js';
import merge from '../../../phet-core/js/merge.js';
import optionize from '../../../phet-core/js/optionize.js';
import mutate from '../../../phet-core/js/mutate.js';
import { scenery, Node, Divider, FlowCell, FlowConfigurable, LayoutConstraint, FLOW_CONFIGURABLE_OPTION_KEYS, FlowConfigurableOptions, FlowConfigurableAlign } from '../imports.js';
import EnumerationValue from '../../../phet-core/js/EnumerationValue.js';
Expand Down Expand Up @@ -123,19 +123,19 @@ const internalToJustify = ( orientation: Orientation, justify: FlowConstraintJus
}
};

type FlowConstraintSelfOptions = {
type SelfOptions = {
spacing?: number;
lineSpacing?: number;
justify?: FlowHorizontalJustifys | FlowVerticalJustifys;
wrap?: boolean;
excludeInvisible?: boolean;
preferredWidthProperty: IProperty<number | null>;
preferredHeightProperty: IProperty<number | null>;
minimumWidthProperty: IProperty<number | null>;
minimumHeightProperty: IProperty<number | null>;
preferredWidthProperty?: IProperty<number | null>;
preferredHeightProperty?: IProperty<number | null>;
minimumWidthProperty?: IProperty<number | null>;
minimumHeightProperty?: IProperty<number | null>;
};

type FlowConstraintOptions = FlowConstraintSelfOptions & FlowConfigurableOptions;
type FlowConstraintOptions = SelfOptions & FlowConfigurableOptions;

// TODO: Have LayoutBox use this when we're ready
class FlowConstraint extends FlowConfigurable( LayoutConstraint ) {
Expand All @@ -156,16 +156,16 @@ class FlowConstraint extends FlowConfigurable( LayoutConstraint ) {
// will include margins, etc.)
layoutBoundsProperty: IProperty<Bounds2>;

constructor( ancestorNode: Node, options?: FlowConstraintOptions ) {
constructor( ancestorNode: Node, providedOptions?: FlowConstraintOptions ) {
assert && assert( ancestorNode instanceof Node );

options = merge( {
const options = optionize<FlowConstraintOptions, Pick<SelfOptions, 'preferredWidthProperty' | 'preferredHeightProperty' | 'minimumWidthProperty' | 'minimumHeightProperty'>>( {
// As options, so we could hook into a Node's preferred/minimum sizes if desired
preferredWidthProperty: new TinyProperty<number | null>( null ),
preferredHeightProperty: new TinyProperty<number | null>( null ),
minimumWidthProperty: new TinyProperty<number | null>( null ),
minimumHeightProperty: new TinyProperty<number | null>( null )
}, options );
}, providedOptions );

super( ancestorNode );

Expand Down
8 changes: 4 additions & 4 deletions js/layout/GridConstraint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ type GridConstraintSelfOptions = {
xSpacing?: number;
ySpacing?: number;

preferredWidthProperty: IProperty<number | null>;
preferredHeightProperty: IProperty<number | null>;
minimumWidthProperty: IProperty<number | null>;
minimumHeightProperty: IProperty<number | null>;
preferredWidthProperty?: IProperty<number | null>;
preferredHeightProperty?: IProperty<number | null>;
minimumWidthProperty?: IProperty<number | null>;
minimumHeightProperty?: IProperty<number | null>;
};

type GridConstraintOptions = GridConstraintSelfOptions & GridConfigurableOptions;
Expand Down
4 changes: 2 additions & 2 deletions js/layout/HeightSizable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const HEIGHT_SIZABLE_OPTION_KEYS = [
];

type HeightSizableSelfOptions = {
preferredHeight: number | null,
minimumHeight: number | null
preferredHeight?: number | null,
minimumHeight?: number | null
};

const HeightSizable = memoize( <SuperType extends Constructor>( type: SuperType ) => {
Expand Down
4 changes: 2 additions & 2 deletions js/layout/WidthSizable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const WIDTH_SIZABLE_OPTION_KEYS = [
];

type WidthSizableSelfOptions = {
preferredWidth: number | null,
minimumWidth: number | null
preferredWidth?: number | null,
minimumWidth?: number | null
};

const WidthSizable = memoize( <SuperType extends Constructor>( type: SuperType ) => {
Expand Down

0 comments on commit b9b75a0

Please sign in to comment.