1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

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

View File

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