Improve 'slopes' input, add compass indicator

This commit is contained in:
Pieter Vander Vennet 2023-12-16 01:29:42 +01:00
parent b7175384f9
commit 7a3cb9fbdd
17 changed files with 268 additions and 108 deletions

View file

@ -1,8 +1,13 @@
import NatValidator from "./NatValidator"
import FloatValidator from "./FloatValidator"
export default class SlopeValidator extends NatValidator {
export default class SlopeValidator extends FloatValidator {
constructor() {
super("slope", "Validates that the slope is a valid number")
super(
"slope",
"Validates that the slope is a valid number." +
"The accompanying input element uses the gyroscope and the compass to determine the correct incline. The sign of the incline will be set automatically. The bearing of the way is compared to the bearing of the compass, as such, the device knows if it is measuring in the forward or backward direction."
)
}
isValid(str: string): boolean {
if (str.endsWith("%") || str.endsWith("°")) {