Skip to content

Commit

Permalink
Expand max ref length to 7 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
claysmalley committed Jun 13, 2024
1 parent 6186713 commit 45b2731
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 140 deletions.
49 changes: 3 additions & 46 deletions icons/shield_mx_mx_2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 3 additions & 46 deletions icons/shield_mx_mx_3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 3 additions & 46 deletions icons/shield_mx_mx_4.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion shieldlib/src/shield.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { TextPlacement } from "./shield_text";
import { StyleImage } from "maplibre-gl";

const narrowCharacters = /[1IJijl .-]/g;
const maxRefLength = 7;

function compoundShieldSize(
r: ShieldRenderingContext,
Expand All @@ -30,7 +31,7 @@ function compoundShieldSize(
}

export function isValidRef(ref: string): boolean {
return ref !== null && ref.length !== 0 && ref.length <= 6;
return ref !== null && ref.length !== 0 && ref.length <= maxRefLength;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/shieldtest.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<thead>
<tr>
<th>Network</th>
<th colspan="14">Graphic</th>
<th colspan="16">Graphic</th>
<th>Performance</th>
</tr>
</thead>
Expand Down
2 changes: 2 additions & 0 deletions src/shieldtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ let refs = [
"A 562",
"1138-2",
"A26/A7",
"GUA 10D",
"SS18var",
];

export function getShieldCanvas(network, ref, name) {
Expand Down

0 comments on commit 45b2731

Please sign in to comment.