Feature: add slope measurement input
This commit is contained in:
parent
48ac539272
commit
fdf38daf5e
5 changed files with 65 additions and 7 deletions
0
src/UI/InputElement/Helpers/SlopeInput.svelte
Normal file
0
src/UI/InputElement/Helpers/SlopeInput.svelte
Normal file
|
@ -1,19 +1,12 @@
|
|||
import { ValidatorType } from "./Validators"
|
||||
import { UIEventSource } from "../../Logic/UIEventSource"
|
||||
|
||||
import { MapProperties } from "../../Models/MapProperties"
|
||||
import BaseUIElement from "../BaseUIElement"
|
||||
import WikidataSearchBox from "../Wikipedia/WikidataSearchBox"
|
||||
import Wikidata from "../../Logic/Web/Wikidata"
|
||||
import { Utils } from "../../Utils"
|
||||
import Locale from "../i18n/Locale"
|
||||
import { Feature } from "geojson"
|
||||
import { GeoOperations } from "../../Logic/GeoOperations"
|
||||
import OpeningHoursInput from "./Helpers/OpeningHoursInput.svelte"
|
||||
import SvelteUIElement from "../Base/SvelteUIElement"
|
||||
import DirectionInput from "./Helpers/DirectionInput.svelte"
|
||||
import DateInput from "./Helpers/DateInput.svelte"
|
||||
import ColorInput from "./Helpers/ColorInput.svelte"
|
||||
|
||||
export interface InputHelperProperties {
|
||||
/**
|
||||
|
|
13
src/UI/InputElement/Validators/SlopeValidator.ts
Normal file
13
src/UI/InputElement/Validators/SlopeValidator.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import NatValidator from "./NatValidator"
|
||||
|
||||
export default class SlopeValidator extends NatValidator {
|
||||
constructor() {
|
||||
super("slope", "Validates that the slope is a valid number")
|
||||
}
|
||||
isValid(str: string): boolean {
|
||||
if (str.endsWith("%") || str.endsWith("°")) {
|
||||
str = str.substring(0, str.length - 1)
|
||||
}
|
||||
return super.isValid(str)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue