basic image next and prev control with joystick
This commit is contained in:
parent
876da12599
commit
b921a52071
@ -210,6 +210,19 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||||||
modal.id = "lightboxModal";
|
modal.id = "lightboxModal";
|
||||||
modal.tabIndex = 0
|
modal.tabIndex = 0
|
||||||
modal.addEventListener('keydown', modalKeyHandler, true)
|
modal.addEventListener('keydown', modalKeyHandler, true)
|
||||||
|
window.addEventListener('gamepadconnected', (e) => {
|
||||||
|
console.log("Gamepad connected!")
|
||||||
|
const gamepad = e.gamepad;
|
||||||
|
setInterval(() => {
|
||||||
|
const xValue = gamepad.axes[0].toFixed(2);
|
||||||
|
if (xValue < -0.3) {
|
||||||
|
modalPrevImage();
|
||||||
|
} else if (xValue > 0.3) {
|
||||||
|
modalNextImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}, 350);
|
||||||
|
});
|
||||||
|
|
||||||
const modalControls = document.createElement('div')
|
const modalControls = document.createElement('div')
|
||||||
modalControls.className = 'modalControls gradio-container';
|
modalControls.className = 'modalControls gradio-container';
|
||||||
|
Loading…
Reference in New Issue
Block a user