Skip to content

BorderAlertsDescriber

Overview

BorderAlertsDescriber is "sub-describer" used in MovementAlerter to manage its border alerts. Border alerts will be alerted either once when object movement intersects with the bounds. With the addition of an option, the border alert will be repeated for as long as the moving object is dragged against that bound, see repeatBorderAlerts. @author Michael Kauzmann (PhET Interactive Simulations)

Class BorderAlertsDescriber

Responsible for alerting when the temperature increases @param {Object} [options] @constructor

import { BorderAlertsDescriber } from 'scenerystack/scenery-phet';

Constructor

new BorderAlertsDescriber( options )

Instance Methods

setDirectionUtterance( alert, direction, utteranceOptions )

Wrap the direction property in an Utterance if not already one. Null is supported. @private @param {TAlertable} alert @param {DirectionEnum} direction @param {Object} [utteranceOptions] - if creating an Utterance, options to pass to it

getAlertAtBorder( position, key )

Based on a position and the border bounds, if the position is touching the bounds, then alert that we are at border. By passing in an optional key, you can prioritize that direction if you are at the corner. @private

@param {Vector2} position @param {string} [key] - prefer this direction key if provided @returns - null if there is nothing to alert

getAlertOnEndDrag( position, domEvent )

@public @param {Vector2} position @param {KeyboardEvent} [domEvent] - we don't get this from a mouse drag listener @returns - null if there is nothing to alert

reset()

@public

Static Methods

getDefaultTopAlert()

Default top alert for the border alerts @public

@returns {string}

Source Code

See the source for BorderAlertsDescriber.js in the scenery-phet repository.