diff --git a/js/common/model/Direction.js b/js/common/model/Direction.js index d4e69266..629ed5d8 100644 --- a/js/common/model/Direction.js +++ b/js/common/model/Direction.js @@ -11,25 +11,32 @@ import Vector2 from '../../../../dot/js/Vector2.js'; import Enumeration from '../../../../phet-core/js/Enumeration.js'; import buildAMolecule from '../../buildAMolecule.js'; +// constants +const DirectionOrientation = Enumeration.byKeys( [ 'NORTH', 'EAST', 'SOUTH', 'WEST' ] ); + class DirectionValue { /** * @param {Vector2} vector + * @param {string} id */ - constructor( vector ) { + constructor( vector, id ) { // @public {Vector2} this.vector = vector; + // @public {number} + this.id = id; + // @public {DirectionValue} this.opposite = null; } } // Declare cardinal direction values -const NORTH = new DirectionValue( new Vector2( 0, 1 ) ); -const SOUTH = new DirectionValue( new Vector2( 0, -1 ) ); -const EAST = new DirectionValue( new Vector2( 1, 0 ) ); -const WEST = new DirectionValue( new Vector2( -1, 0 ) ); +const NORTH = new DirectionValue( new Vector2( 0, 1 ), DirectionOrientation.NORTH ); +const SOUTH = new DirectionValue( new Vector2( 0, -1 ), DirectionOrientation.SOUTH ); +const EAST = new DirectionValue( new Vector2( 1, 0 ), DirectionOrientation.EAST ); +const WEST = new DirectionValue( new Vector2( -1, 0 ), DirectionOrientation.WEST ); // Declare opposites NORTH.opposite = SOUTH;