Skip to content

Commit

Permalink
prevent success sounds from triggering every frame, see #142
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed May 10, 2022
1 parent 7ff37b3 commit a99f87d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js/quadrilateral/model/QuadrilateralShapeModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -932,11 +932,15 @@ class QuadrilateralShapeModel {

// set all positions
verticesWithProposedPositions.forEach( vertexWithProposedPosition => {
vertexWithProposedPosition.vertex.positionProperty.set( vertexWithProposedPosition.proposedPosition );

// this is a new Vector2 instance so even if x,y values are the same as the old value it will triggere
// listeners without this check
if ( !vertexWithProposedPosition.proposedPosition.equals( vertexWithProposedPosition.vertex.positionProperty.value ) ) {
vertexWithProposedPosition.vertex.positionProperty.set( vertexWithProposedPosition.proposedPosition );
}
} );

// un-defer all so that all Properties and calls callbacks
// debugger;
this.setPropertiesDeferred( false );
}

Expand Down

0 comments on commit a99f87d

Please sign in to comment.