Skip to content

Commit

Permalink
Handling visibility in listed mixins, see phetsims/chipper#1267
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Jul 14, 2022
1 parent 22b6ca7 commit f6dc456
Show file tree
Hide file tree
Showing 9 changed files with 181 additions and 182 deletions.
5 changes: 2 additions & 3 deletions js/layout/HeightSizable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ const HeightSizable = memoize( <SuperType extends Constructor>( type: SuperType
public readonly isHeightResizableProperty: TinyProperty<boolean> = new TinyProperty<boolean>( true );

// Flags so that we can change one (parent/local) value and not enter an infinite loop changing the other
// (scenery-internal) - would be private, but can't be with mixin constraints
public _preferredHeightChanging = false;
public _minimumHeightChanging = false;
private _preferredHeightChanging = false;
private _minimumHeightChanging = false;

// IMPORTANT: If you're mixing this in, typically don't pass options that HeightSizable would take through the
// constructor. It will hit Node's mutate() likely, and then will fail because we haven't been able to set the
Expand Down
5 changes: 2 additions & 3 deletions js/layout/WidthSizable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ const WidthSizable = memoize( <SuperType extends Constructor>( type: SuperType )
public readonly isWidthResizableProperty: TinyProperty<boolean> = new TinyProperty<boolean>( true );

// Flags so that we can change one (parent/local) value and not enter an infinite loop changing the other
// (scenery-internal) - would be private, but can't be with mixin constraints
public _preferredWidthChanging = false;
public _minimumWidthChanging = false;
private _preferredWidthChanging = false;
private _minimumWidthChanging = false;

// IMPORTANT: If you're mixing this in, typically don't pass options that WidthSizable would take through the
// constructor. It will hit Node's mutate() likely, and then will fail because we haven't been able to set the
Expand Down
7 changes: 3 additions & 4 deletions js/layout/constraints/FlowConfigurable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,11 @@ export type FlowConfigurableOptions = {
export type ExternalFlowConfigurableOptions = WithoutNull<FlowConfigurableOptions, Exclude<keyof FlowConfigurableOptions, 'minContentWidth' | 'minContentHeight' | 'maxContentWidth' | 'maxContentHeight'>>;

const FlowConfigurable = memoize( <SuperType extends Constructor>( type: SuperType ) => {
return class extends type {
return class FlowConfirableMixin extends type {

// (scenery-internal) - considered private, but TypeScript mixins won't support private
public _orientation: Orientation = Orientation.HORIZONTAL;
protected _orientation: Orientation = Orientation.HORIZONTAL;

// (scenery-internal) - considered private, but TypeScript mixins won't support private
// (scenery-internal)
public _align: LayoutAlign | null = null;
public _stretch: boolean | null = null;
public _leftMargin: number | null = null;
Expand Down
4 changes: 2 additions & 2 deletions js/layout/constraints/GridConfigurable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ export type GridConfigurableOptions = {
export type ExternalGridConfigurableOptions = WithoutNull<GridConfigurableOptions, Exclude<keyof GridConfigurableOptions, 'minContentWidth' | 'minContentHeight' | 'maxContentWidth' | 'maxContentHeight'>>;

const GridConfigurable = memoize( <SuperType extends Constructor>( type: SuperType ) => {
return class extends type {
return class GridConfigurableMixin extends type {

// (scenery-internal) - considered private, but TypeScript mixins won't support private
// (scenery-internal)
public _xAlign: LayoutAlign | null = null;
public _yAlign: LayoutAlign | null = null;
public _xStretch: boolean | null = null;
Expand Down
Loading

0 comments on commit f6dc456

Please sign in to comment.