Skip to content

Commit

Permalink
Step the electrons if there's current flow in the coil, and the elect…
Browse files Browse the repository at this point in the history
…rons are visible, #122
  • Loading branch information
pixelzoom committed Mar 29, 2024
1 parent 438d421 commit dc44ca0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/common/model/Coil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ export default class Coil extends PhetioObject {
}

public step( dt: number ): void {
if ( this.electronsVisibleProperty.value ) {
this.electronsProperty.value.forEach( electron => electron.step( dt ) );

// REVIEW - Shouldn't this only be fired when the electrons have moved? Or renamed to electronsSteppedEmitter
// Step the electrons if there's current flow in the coil, and the electrons are visible.
if ( this.currentAmplitudeProperty.value !== 0 && this.electronsVisibleProperty.value ) {
this.electronsProperty.value.forEach( electron => electron.step( dt ) );
this.electronsMovedEmitter.emit();
}
}
Expand Down

0 comments on commit dc44ca0

Please sign in to comment.