Skip to content

Commit

Permalink
Moving ResetAllButton.isResettingAllProperty => top level file, avoid…
Browse files Browse the repository at this point in the history
…s circular dependency for phetsims/scenery-phet#894
  • Loading branch information
jonathanolson committed Dec 18, 2024
1 parent c80a6f5 commit 6a969c7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions js/balance-point/view/BeamTiltSoundGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
import Range from '../../../../dot/js/Range.js';
import { EmptySelfOptions } from '../../../../phet-core/js/optionize.js';
import ResetAllButton from '../../../../scenery-phet/js/buttons/ResetAllButton.js';
import isResettingAllProperty from '../../../../scenery-phet/js/isResettingAllProperty.js';
import SoundClip from '../../../../tambo/js/sound-generators/SoundClip.js';
import SoundGenerator, { SoundGeneratorOptions } from '../../../../tambo/js/sound-generators/SoundGenerator.js';
import boundaryReached_mp3 from '../../../../tambo/sounds/boundaryReached_mp3.js';
Expand Down Expand Up @@ -38,7 +38,7 @@ class BeamTiltSoundGenerator extends SoundGenerator {
let timeOfLastPlay = Number.NEGATIVE_INFINITY;

beamTiltProperty.lazyLink( tiltAngle => {
if ( !ResetAllButton.isResettingAllProperty.value &&
if ( !isResettingAllProperty.value &&
beamTiltProperty.value !== 0 &&
( fulcrumIsDraggingProperty.value || isBeamAnimating() ) &&
phet.joist.elapsedTime > timeOfLastPlay + MIN_TIME_BETWEEN_CREAK_PLAYS ) {
Expand Down
6 changes: 3 additions & 3 deletions js/common/view/MeanPredictionChangeSoundGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
import dotRandom from '../../../../dot/js/dotRandom.js';
import Utils from '../../../../dot/js/Utils.js';
import { combineOptions } from '../../../../phet-core/js/optionize.js';
import ResetAllButton from '../../../../scenery-phet/js/buttons/ResetAllButton.js';
import isResettingAllProperty from '../../../../scenery-phet/js/isResettingAllProperty.js';
import NoiseGenerator, { NoiseGeneratorOptions } from '../../../../tambo/js/sound-generators/NoiseGenerator.js';
import meanShareAndBalance from '../../meanShareAndBalance.js';

Expand Down Expand Up @@ -61,7 +61,7 @@ class MeanPredictionChangeSoundGenerator extends NoiseGenerator {
this.changeRateUpdateTime = this.audioContext.currentTime;

// Turn off sound generation when a reset occurs.
ResetAllButton.isResettingAllProperty.lazyLink( () => {
isResettingAllProperty.lazyLink( () => {
this.stop( this.audioContext.currentTime + NOISE_OFF_TIME );
this.setOutputLevel( 0, NOISE_STOP_TIME_CONSTANT );
this.predictionChangeRate = 0;
Expand All @@ -72,7 +72,7 @@ class MeanPredictionChangeSoundGenerator extends NoiseGenerator {
// generation, and the step function will turn it off later once the interaction ends.
meanPredictionProperty.lazyLink( ( newPrediction, oldPrediction ) => {

if ( !ResetAllButton.isResettingAllProperty.value ) {
if ( !isResettingAllProperty.value ) {

const now = this.audioContext.currentTime;

Expand Down
4 changes: 2 additions & 2 deletions js/fair-share/view/AllocationModeSoundGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { TimerListener } from '../../../../axon/js/Timer.js';
import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
import LinearFunction from '../../../../dot/js/LinearFunction.js';
import optionize, { EmptySelfOptions } from '../../../../phet-core/js/optionize.js';
import ResetAllButton from '../../../../scenery-phet/js/buttons/ResetAllButton.js';
import erase_mp3 from '../../../../scenery-phet/sounds/erase_mp3.js';
import SoundClip from '../../../../tambo/js/sound-generators/SoundClip.js';
import SoundGenerator, { SoundGeneratorOptions } from '../../../../tambo/js/sound-generators/SoundGenerator.js';
Expand All @@ -26,6 +25,7 @@ import shareWhooshSound_mp3 from '../../../sounds/shareWhooshSound_mp3.js';
import MeanShareAndBalanceConstants from '../../common/MeanShareAndBalanceConstants.js';
import meanShareAndBalance from '../../meanShareAndBalance.js';
import { ApplesAnimationState, DistributionMode } from '../model/FairShareModel.js';
import isResettingAllProperty from '../../../../scenery-phet/js/isResettingAllProperty.js';

type SelfOptions = EmptySelfOptions;
type AllocationModeSoundPlayerOptions = SoundGeneratorOptions & SelfOptions;
Expand Down Expand Up @@ -103,7 +103,7 @@ class AllocationModeSoundGenerator extends SoundGenerator {
shareCompletedSoundTimer = null;
}

if ( !ResetAllButton.isResettingAllProperty.value ) {
if ( !isResettingAllProperty.value ) {
if ( mode === DistributionMode.SYNC ) {
syncSoundClip.play();
}
Expand Down
4 changes: 2 additions & 2 deletions js/level-out/view/LevelOutScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { combineOptions } from '../../../../phet-core/js/optionize.js';
import PickRequired from '../../../../phet-core/js/types/PickRequired.js';
import StrictOmit from '../../../../phet-core/js/types/StrictOmit.js';
import ModelViewTransform2 from '../../../../phetcommon/js/view/ModelViewTransform2.js';
import ResetAllButton from '../../../../scenery-phet/js/buttons/ResetAllButton.js';
import { AlignBox, Node } from '../../../../scenery/js/imports.js';
import sharedSoundPlayers from '../../../../tambo/js/sharedSoundPlayers.js';
import soundManager from '../../../../tambo/js/soundManager.js';
Expand All @@ -33,6 +32,7 @@ import NotepadCupNode from './NotepadCupNode.js';
import PipeNode from './PipeNode.js';
import TableCupNode from './TableCupNode.js';
import WaterBalanceSoundGenerator from './WaterBalanceSoundGenerator.js';
import isResettingAllProperty from '../../../../scenery-phet/js/isResettingAllProperty.js';

type LevelOutScreenViewOptions = PickRequired<MeanShareAndBalanceScreenViewOptions, 'tandem'> & StrictOmit<ScreenViewOptions, 'children'>;

Expand Down Expand Up @@ -190,7 +190,7 @@ export default class LevelOutScreenView extends MeanShareAndBalanceScreenView {
const switchToRightSoundPlayer = sharedSoundPlayers.get( 'switchToRight' );

model.pipesOpenProperty.lazyLink( pipesOpen => {
if ( !ResetAllButton.isResettingAllProperty.value ) {
if ( !isResettingAllProperty.value ) {
pipesOpen ? switchToRightSoundPlayer.play() : switchToLeftSoundPlayer.play();
}
} );
Expand Down

0 comments on commit 6a969c7

Please sign in to comment.