(direction: Direction)
| 3 | |
| 4 | export class DirectionUtil { |
| 5 | public static convertDirectionToVector(direction: Direction): IPoint { |
| 6 | switch (direction) { |
| 7 | case Direction.RIGHT: |
| 8 | return {x: 1, y: 0}; |
| 9 | case Direction.LEFT: |
| 10 | return {x: -1, y: 0}; |
| 11 | case Direction.TOP: |
| 12 | return {x: 0, y: 1}; |
| 13 | case Direction.BOTTOM: |
| 14 | return {x: 0, y: -1}; |
| 15 | case Direction.TOP_RIGHT: |
| 16 | return {x: 1, y: 1}; |
| 17 | case Direction.TOP_LEFT: |
| 18 | return {x: -1, y: 1}; |
| 19 | case Direction.BOTTOM_RIGHT: |
| 20 | return {x: 1, y: -1}; |
| 21 | case Direction.BOTTOM_LEFT: |
| 22 | return {x: -1, y: -1}; |
| 23 | case Direction.CENTER: |
| 24 | return {x: 0, y: 0}; |
| 25 | default: |
| 26 | return null; |
| 27 | } |
| 28 | } |
| 29 | } |
no outgoing calls
no test coverage detected