21 lines
409 B
JavaScript
21 lines
409 B
JavaScript
/**
|
|
* Convenience type for (x,y) coordinate values
|
|
*/
|
|
export class Position {
|
|
private constructor(public x: number = 0, public y: number = 0) {}
|
|
|
|
public static at(x: number, y: number): Position {
|
|
return new Position(x, y);
|
|
}
|
|
|
|
public static from(p: Position): Position {
|
|
return new Position(p.x, p.y);
|
|
}
|
|
|
|
public static default(): Position {
|
|
return new Position();
|
|
}
|
|
}
|
|
|
|
export default Position;
|