fix space -> home not working if location in hash
This commit is contained in:
parent
b66c5113a1
commit
f09faa3944
1 changed files with 9 additions and 7 deletions
|
@ -201,6 +201,14 @@ export default defineComponent({
|
||||||
|
|
||||||
// Process start element
|
// Process start element
|
||||||
const start = processStart(svg);
|
const start = processStart(svg);
|
||||||
|
if (start) {
|
||||||
|
console.info("[SVG] Found start element.");
|
||||||
|
window.addEventListener("keydown", (ev) => {
|
||||||
|
if (ev.key === " ") {
|
||||||
|
panToElement(start, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Pan to start element or location in hash
|
// Pan to start element or location in hash
|
||||||
const locationMatch = window.location.href.match(/#([\-0-9.]+),([\-0-9.]+),([0-9.]+)z/);
|
const locationMatch = window.location.href.match(/#([\-0-9.]+),([\-0-9.]+),([0-9.]+)z/);
|
||||||
|
@ -216,14 +224,8 @@ export default defineComponent({
|
||||||
);
|
);
|
||||||
pz.zoomAbs(window.innerWidth / 2, window.innerHeight / 2, parseFloat(z));
|
pz.zoomAbs(window.innerWidth / 2, window.innerHeight / 2, parseFloat(z));
|
||||||
} else if (start) {
|
} else if (start) {
|
||||||
console.info("[SVG] Found start element.");
|
console.debug(`[SVGCONTENT] Panning to start anchor.`);
|
||||||
panToElement(start, false);
|
panToElement(start, false);
|
||||||
|
|
||||||
window.addEventListener("keydown", (ev) => {
|
|
||||||
if (ev.key === " ") {
|
|
||||||
panToElement(start, true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anchors
|
// Anchors
|
||||||
|
|
Loading…
Reference in a new issue