Skip to content

Commit

Permalink
Use ResetAllButton.isResettingAllProperty, see #290
Browse files Browse the repository at this point in the history
(cherry picked from commit d9a59d5)
samreid authored and matthew-blackman committed Apr 18, 2024
1 parent 0615f48 commit 6010dba
Showing 3 changed files with 4 additions and 34 deletions.
25 changes: 0 additions & 25 deletions js/common/model/isResettingAllProperty.ts

This file was deleted.

5 changes: 0 additions & 5 deletions js/common/view/PDLScreenView.ts
Original file line number Diff line number Diff line change
@@ -35,7 +35,6 @@ import FieldSignNode from './FieldSignNode.js';
import EraserButton from '../../../../scenery-phet/js/buttons/EraserButton.js';
import PDLPreferences from '../PDLPreferences.js';
import DerivedProperty from '../../../../axon/js/DerivedProperty.js';
import isResettingAllProperty from '../model/isResettingAllProperty.js';
import Multilink from '../../../../axon/js/Multilink.js';

type SelfOptions = {
@@ -125,13 +124,9 @@ export default abstract class PDLScreenView<T extends Field> extends ScreenView
this.resetAllButton = new ResetAllButton( {
tandem: options.tandem.createTandem( 'resetAllButton' ),
listener: () => {
isResettingAllProperty.value = true;

this.interruptSubtreeInput(); // cancel interactions that may be in progress
model.reset();
this.reset();

isResettingAllProperty.value = false;
},
phetioFeatured: true
} );
8 changes: 4 additions & 4 deletions js/measures/view/IntervalToolNode.ts
Original file line number Diff line number Diff line change
@@ -39,8 +39,8 @@ import AccessibleSlider, { AccessibleSliderOptions } from '../../../../sun/js/ac
import Bounds2 from '../../../../dot/js/Bounds2.js';
import DynamicProperty from '../../../../axon/js/DynamicProperty.js';
import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
import isResettingAllProperty from '../../common/model/isResettingAllProperty.js';
import Multilink from '../../../../axon/js/Multilink.js';
import ResetAllButton from '../../../../scenery-phet/js/buttons/ResetAllButton.js';

const edgeFilter = new BiquadFilterNode( phetAudioContext, {
type: 'lowpass',
@@ -487,7 +487,7 @@ export default class IntervalToolNode extends Node {

// When dragging an edge or resetting, update the drag bounds of the center so that it can't go out of bounds with the new separation.
Multilink.multilink( [ intervalTool.edge1Property, intervalTool.edge2Property, this.isCenterDraggingProperty,
this.isEdge1DraggingProperty, this.isEdge2DraggingProperty, isResettingAllProperty ],
this.isEdge1DraggingProperty, this.isEdge2DraggingProperty, ResetAllButton.isResettingAllProperty ],
( edge1, edge2, isCenterDragging, isEdge1Dragging, isEdge2Dragging, isResettingAll ) => {
const isDraggingEdgeOnly = ( isEdge1Dragging || isEdge2Dragging ) && !isCenterDragging;
if ( isDraggingEdgeOnly || isResettingAll ) {
@@ -524,7 +524,7 @@ export default class IntervalToolNode extends Node {

const createEdgeSonificationListener = ( otherEdgeProperty: { value: number } ) => {
return ( newValue: number, oldValue: number ) => {
if ( isResettingAllProperty.value ) {
if ( ResetAllButton.isResettingAllProperty.value ) {
return;
}

@@ -563,7 +563,7 @@ export default class IntervalToolNode extends Node {
} );

centerPositionSonificationProperty.lazyLink( ( newValue: number, oldValue: number ) => {
if ( this.isCenterDraggingProperty.value && !isResettingAllProperty.value ) {
if ( this.isCenterDraggingProperty.value && !ResetAllButton.isResettingAllProperty.value ) {
centerValueChangeSoundPlayer.playSoundIfThresholdReached( newValue, oldValue );
}
} );

0 comments on commit 6010dba

Please sign in to comment.