Merge pull request #223 from Joker-vD/labels-are-way-too-short

Map markers' labels are way too short.
This commit is contained in:
tobspr 2020-06-21 19:42:01 +02:00 committed by GitHub
commit 7cd0054c55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -28,6 +28,8 @@ import { ShapeDefinition } from "../../shape_definition";
*/
const SHAPE_LABEL_PLACEHOLDER = " ";
const MAX_LABEL_LENGTH = 71;
export class HUDWaypoints extends BaseHUDPart {
/**
* Creates the overview of waypoints
@ -220,7 +222,8 @@ export class HUDWaypoints extends BaseHUDPart {
id: "markerName",
label: null,
placeholder: "",
validator: val => val.length > 0 && (val.length < 15 || ShapeDefinition.isValidShortKey(val)),
validator: val =>
val.length > 0 && (val.length < MAX_LABEL_LENGTH || ShapeDefinition.isValidShortKey(val)),
});
const dialog = new DialogWithForm({
app: this.root.app,
@ -270,8 +273,8 @@ export class HUDWaypoints extends BaseHUDPart {
return 1;
}
return this.getWaypointLabel(a)
.padEnd(20, "0")
.localeCompare(this.getWaypointLabel(b).padEnd(20, "0"));
.padEnd(MAX_LABEL_LENGTH, "0")
.localeCompare(this.getWaypointLabel(b).padEnd(MAX_LABEL_LENGTH, "0"));
});
// Show notification about creation