forked from MapComplete/MapComplete
More refactoring
This commit is contained in:
parent
5d0fe31c41
commit
41e6a2c760
147 changed files with 1540 additions and 1797 deletions
17
UI/InputElement/Validators/DirectionValidator.ts
Normal file
17
UI/InputElement/Validators/DirectionValidator.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { Validator } from "../ValidatedTextField"
|
||||
import IntValidator from "./IntValidator";
|
||||
|
||||
export default class DirectionValidator extends IntValidator {
|
||||
constructor() {
|
||||
super(
|
||||
"direction",
|
||||
"A geographical direction, in degrees. 0° is north, 90° is east, ... Will return a value between 0 (incl) and 360 (excl)"
|
||||
)
|
||||
}
|
||||
|
||||
reformat(str): string {
|
||||
const n = Number(str) % 360
|
||||
return "" + n
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue