Skip to content

Commit

Permalink
bothHands context response should respect supportGoBeyondEdgeResponse…
Browse files Browse the repository at this point in the history
…s also, #457
  • Loading branch information
zepumph committed Jun 1, 2022
1 parent f260ffe commit 946d138
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions js/common/view/describers/BothHandsDescriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import IReadOnlyProperty from '../../../../../axon/js/IReadOnlyProperty.js';
import TickMarkDescriber from './TickMarkDescriber.js';
import DistanceResponseType from './DistanceResponseType.js';
import RatioInputModality from './RatioInputModality.js';
import optionize from '../../../../../phet-core/js/optionize.js';
import StrictOmit from '../../../../../phet-core/js/types/StrictOmit.js';

const ratioDistancePositionContextResponsePatternString = ratioAndProportionStrings.a11y.ratio.distancePositionContextResponse;

Expand All @@ -47,11 +49,19 @@ class BothHandsDescriber {
inProportionProperty, enabledRatioTermsRangeProperty, this.ratioLockedProperty );
}

getBothHandsContextResponse( recentlyMovedRatioTerm: RatioInputModality, options: HandContextResponseOptions = {} ): string {
const ratioLockedEdgeResponse = this.handPositionsDescriber.getGoBeyondContextResponse(
this.ratioTupleProperty.value, recentlyMovedRatioTerm );
if ( ratioLockedEdgeResponse ) {
return ratioLockedEdgeResponse;
getBothHandsContextResponse( recentlyMovedRatioTerm: RatioInputModality, providedOptions: HandContextResponseOptions ): string {

const options = optionize<HandContextResponseOptions, StrictOmit<HandContextResponseOptions, 'distanceResponseType'>>()( {
supportGoBeyondEdgeResponses: true
}, providedOptions );

if ( options.supportGoBeyondEdgeResponses ) {
const ratioLockedEdgeResponse = this.handPositionsDescriber.getGoBeyondContextResponse(
this.ratioTupleProperty.value, recentlyMovedRatioTerm );

if ( ratioLockedEdgeResponse ) {
return ratioLockedEdgeResponse;
}
}

return StringUtils.fillIn( ratioDistancePositionContextResponsePatternString, {
Expand Down

0 comments on commit 946d138

Please sign in to comment.