Skip to content

Commit

Permalink
Close all valves when sync button is clicked, see: #3
Browse files Browse the repository at this point in the history
  • Loading branch information
marlitas committed Jun 8, 2022
1 parent 345db51 commit 18d2b50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion js/intro/model/IntroModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ export default class IntroModel extends MeanShareAndBalanceModel {

public override syncData(): void {
super.syncData();
// Will trigger the closure of al pipes. pipe.isOpenProperty = false
this.isAutoSharingProperty.set( false );
this.pipeGroup.forEach( pipe => pipe.isOpenProperty.set( false ) );
this.matchCupWaterLevels();
}

Expand Down
5 changes: 3 additions & 2 deletions js/intro/model/PipeModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type PipeModelOptions = SelfOptions & PhetioObjectOptions;
export default class PipeModel extends PhetioObject {

public readonly isOpenProperty: BooleanProperty;
public readonly isCurrentlyClickedProperty: BooleanProperty;
public readonly isCurrentlyClickedProperty= new BooleanProperty( false );
public readonly x: number;
public readonly y: number;
public static PipeModelIO: IOType<PipeModel>;
Expand All @@ -47,14 +47,15 @@ export default class PipeModel extends PhetioObject {
this.isOpenProperty = new BooleanProperty( options.isOpen, {
tandem: options.tandem.createTandem( 'isOpenProperty' )
} );

this.x = options.x;
this.y = options.y;
this.isCurrentlyClickedProperty = new BooleanProperty( false );
}

public override dispose(): void {
super.dispose();
this.isOpenProperty.dispose();
this.isCurrentlyClickedProperty.dispose();
}
}

Expand Down

0 comments on commit 18d2b50

Please sign in to comment.