Skip to content

Commit

Permalink
Improve enums, see #401
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Oct 11, 2021
1 parent f6951c1 commit 31a9685
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions js/common/model/LaserViewEnum.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Copyright 2021, University of Colorado Boulder
type ColorModeEnum = 'ray' | 'wave';
export default ColorModeEnum;
type LaserViewEnum = 'ray' | 'wave';
export default LaserViewEnum;
3 changes: 3 additions & 0 deletions js/common/model/RayTypeEnum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Copyright 2021, University of Colorado Boulder
type RayTypeEnum = 'incident' | 'reflected' | 'transmitted';
export default RayTypeEnum;
3 changes: 2 additions & 1 deletion js/intro/view/AngleNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Text from '../../../../scenery/js/nodes/Text.js';
import Panel from '../../../../sun/js/Panel.js';
import bendingLight from '../../bendingLight.js';
import LightRay from '../../common/model/LightRay.js';
import RayTypeEnum from '../../common/model/RayTypeEnum.js';

// constants
const CIRCLE_RADIUS = 50; // radius of the circular arc in stage coordinates
Expand Down Expand Up @@ -150,7 +151,7 @@ class AngleNode extends Node {
* @param type
* @returns {LightRay}
*/
const getRay = ( type: 'incident' | 'reflected' | 'transmitted' | null ) => { // TODO: enum
const getRay = ( type: RayTypeEnum | null ) => {
let selected = null;
for ( let i = 0; i < rays.length; i++ ) {
const ray = rays[ i ];
Expand Down

0 comments on commit 31a9685

Please sign in to comment.