Temp work around of safari map load bug
This commit is contained in:
parent
d066b262fa
commit
87952491f0
@ -119,18 +119,22 @@ function SelectMapModal({
|
|||||||
let fileGridY = defaultMapSize;
|
let fileGridY = defaultMapSize;
|
||||||
let name = "Unknown Map";
|
let name = "Unknown Map";
|
||||||
if (file.name) {
|
if (file.name) {
|
||||||
// Match against a regex to find the grid size in the file name
|
// TODO: match all not supported on safari, find alternative
|
||||||
// e.g. Cave 22x23 will return [["22x22", "22", "x", "23"]]
|
if (file.name.matchAll) {
|
||||||
const gridMatches = [...file.name.matchAll(/(\d+) ?(x|X) ?(\d+)/g)];
|
// Match against a regex to find the grid size in the file name
|
||||||
if (gridMatches.length > 0) {
|
// e.g. Cave 22x23 will return [["22x22", "22", "x", "23"]]
|
||||||
const lastMatch = gridMatches[gridMatches.length - 1];
|
const gridMatches = [...file.name.matchAll(/(\d+) ?(x|X) ?(\d+)/g)];
|
||||||
const matchX = parseInt(lastMatch[1]);
|
if (gridMatches.length > 0) {
|
||||||
const matchY = parseInt(lastMatch[3]);
|
const lastMatch = gridMatches[gridMatches.length - 1];
|
||||||
if (!isNaN(matchX) && !isNaN(matchY)) {
|
const matchX = parseInt(lastMatch[1]);
|
||||||
fileGridX = matchX;
|
const matchY = parseInt(lastMatch[3]);
|
||||||
fileGridY = matchY;
|
if (!isNaN(matchX) && !isNaN(matchY)) {
|
||||||
|
fileGridX = matchX;
|
||||||
|
fileGridY = matchY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove file extension
|
// Remove file extension
|
||||||
name = file.name.replace(/\.[^/.]+$/, "");
|
name = file.name.replace(/\.[^/.]+$/, "");
|
||||||
// Removed grid size expression
|
// Removed grid size expression
|
||||||
|
Loading…
Reference in New Issue
Block a user