Fix some errors in keyboard handler

This commit is contained in:
simon987 2022-03-05 20:33:45 -05:00
parent a10d6952ba
commit 9b81856353
3 changed files with 11 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -89,7 +89,6 @@ export default {
switch (e.key) { switch (e.key) {
case " ": { case " ": {
console.log("SPACE")
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
e.stopImmediatePropagation(); e.stopImmediatePropagation();
@ -98,16 +97,12 @@ export default {
[...document.getElementsByClassName("fslightbox-absoluted")].forEach(elem => { [...document.getElementsByClassName("fslightbox-absoluted")].forEach(elem => {
if (elem.style.transform === "translate(0px)" || elem.style.transform === "translate(0px, 0px)") { if (elem.style.transform === "translate(0px)" || elem.style.transform === "translate(0px, 0px)") {
const vid = elem.getElementsByTagName("video")[0]; const vid = elem.getElementsByTagName("video")[0];
console.log(elem)
console.log(vid)
if (vid) { if (vid) {
if (vid.paused) { if (vid.paused) {
vid.play(); vid.play();
console.log("PLAY")
} else { } else {
vid.pause() vid.pause()
console.log("PAUSE")
} }
} }
} }
@ -119,24 +114,28 @@ export default {
} }
case "ArrowUp": case "ArrowUp":
case "k": { case "k": {
if (!lightboxStore.data.isThumbing) { if (!lightboxStore.data.isThumbing && lightboxStore.core.thumbsToggler) {
lightboxStore.core.thumbsToggler.toggleThumbs(); lightboxStore.core.thumbsToggler.toggleThumbs();
} }
return false; return false;
} }
case "ArrowDown": case "ArrowDown":
case "j": { case "j": {
if (lightboxStore.data.isThumbing) { if (lightboxStore.data.isThumbing && lightboxStore.core.thumbsToggler) {
lightboxStore.core.thumbsToggler.toggleThumbs(); lightboxStore.core.thumbsToggler.toggleThumbs();
} }
return false; return false;
} }
case "h": { case "h": {
if (lightboxStore.core.stageManager.getPreviousSlideIndex) {
lightboxStore.core.slideIndexChanger.jumpTo(lightboxStore.core.stageManager.getPreviousSlideIndex()); lightboxStore.core.slideIndexChanger.jumpTo(lightboxStore.core.stageManager.getPreviousSlideIndex());
break; }
return false;
} }
case "l": { case "l": {
if (lightboxStore.core.stageManager.getNextSlideIndex) {
lightboxStore.core.slideIndexChanger.jumpTo(lightboxStore.core.stageManager.getNextSlideIndex()); lightboxStore.core.slideIndexChanger.jumpTo(lightboxStore.core.stageManager.getNextSlideIndex());
}
return false; return false;
} }
} }

File diff suppressed because one or more lines are too long