forked from MTSR/mapserver
coord compat
This commit is contained in:
parent
89e6591f9a
commit
a99e9d48aa
@ -2,14 +2,31 @@
|
|||||||
export function hashCompat(){
|
export function hashCompat(){
|
||||||
|
|
||||||
if (window.location.hash) {
|
if (window.location.hash) {
|
||||||
let match = window.location.hash.match(/^#\/(\d*)\/(\d*)\/(\d*)$/m);
|
|
||||||
if (match) {
|
const parts = window.location.hash.replace("#", "").split("/");
|
||||||
window.location.hash = `#!/map/0/${match[1]}/${match[2]}/${match[3]}`;
|
if (parts.length == 0){
|
||||||
|
//invalid
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
match = window.location.hash.match(/^#\/(\d*)\/(\d*)\/(\d*)\/(\d*)$/m);
|
if (parts[0] == "map"){
|
||||||
if (match) {
|
//new link
|
||||||
window.location.hash = `#!/map/${match[1]}/${match[2]}/${match[3]}/${match[4]}`;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNaN(+parts[0])){
|
||||||
|
//NaN
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parts.length == 3){
|
||||||
|
//#1799.5/399/10
|
||||||
|
window.location.hash = `#!/map/0/${parts[0]}/${parts[1]}/${parts[2]}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parts.length == 4) {
|
||||||
|
//#0/-1799.5/399/10
|
||||||
|
window.location.hash = `#!/map/${parts[0]}/${parts[3]}/${parts[1]}/${parts[2]}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user