Skip to content

Commit b2719e5

Browse files
committed
Fix: Go back in gamepad menus
1 parent 249640d commit b2719e5

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1111

1212
### 🐛 Bug Fixes
1313

14-
- Gamepad icons not showing in distribution version
14+
- Gamepad icons not showing in distribution version [`249640d`](https://github.com/ollm/OpenComic/commit/249640d57f3d5768661b63c0ddf8525a02e44d25)
15+
- Go back in gamepad menus
1516

1617
## [v1.0.0-beta.2](https://github.com/ollm/OpenComic/releases/tag/v1.0.0-beta.2) (03-09-2023)
1718

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
* Floating magnifying glass
3838
* Reading in scroll or slide
3939
* 🎮 Gamepad navigation
40-
* [Changelog](https://github.com/ollm/OpenComic/blob/v1.0.0-beta.2/CHANGELOG.md)
40+
41+
You can see the changes between versions in the [Changelog](https://github.com/ollm/OpenComic/blob/master/CHANGELOG.md)
4142

4243
## Installation and Starting for development
4344
__Requirements__: Git, Node and NPM

scripts/events.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,8 @@ function hideHoverText()
456456
}
457457
}
458458

459+
var fromGamepadMenu = false;
460+
459461
function activeMenu(query, query2 = false, posX = 'left', posY = 'top')
460462
{
461463
let menu = document.querySelector(query);
@@ -510,7 +512,7 @@ function activeMenu(query, query2 = false, posX = 'left', posY = 'top')
510512
menuSimple.style.left = '';
511513
}
512514

513-
if(posY == 'top')
515+
if(posY == 'top' || posY == 'gamepad')
514516
{
515517
menuSimple.style.bottom = '';
516518
menuSimple.style.top = (top + height + 8)+'px';
@@ -526,6 +528,8 @@ function activeMenu(query, query2 = false, posX = 'left', posY = 'top')
526528
else
527529
menu.classList.remove('menu-gamepad');
528530

531+
fromGamepadMenu = (posX == 'gamepad' && posY != 'gamepad') ? true : false;
532+
529533
shortcuts.pause();
530534
gamepad.updateBrowsableItems('menu', true);
531535
}
@@ -575,6 +579,9 @@ function desactiveMenu(query, query2 = false)
575579
gamepad.cleanBrowsableItems();
576580

577581
shortcuts.play();
582+
583+
if(fromGamepadMenu)
584+
gamepad.showMenu();
578585
}
579586

580587
// Dialogs

scripts/gamepad.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -591,16 +591,16 @@ function highlightItemContextMenu()
591591
new Function(current.element.getAttribute('oncontextmenu')).call(current.element);
592592
}
593593

594-
function showMenu(index = false)
594+
function showMenu()
595595
{
596-
let query = index ? '#index-menu-gamepad' : '#reading-menu-gamepad';
596+
let query = !onReading ? '#index-menu-gamepad' : '#reading-menu-gamepad';
597597

598598
if(document.querySelector(query+' .menu-simple.a'))
599599
events.desactiveMenu(query);
600600
else
601-
events.activeMenu(query, false, 'gamepad');
601+
events.activeMenu(query, false, 'gamepad', 'gamepad');
602602

603-
if(index)
603+
if(!onReading)
604604
{
605605
let viewIcon = document.querySelector('.menu-gamepad-view-icon');
606606
if(!viewIcon) return;
@@ -709,7 +709,7 @@ setButtonEvent('browsableItems', [0, 2, 3, 9, 12, 13, 14, 15, 16], function(key)
709709
else if(key == 15)
710710
highlightClosestItem(1);
711711
else if(!onReading && (key == 9 || key == 16))
712-
showMenu(true);
712+
showMenu();
713713

714714
});
715715

0 commit comments

Comments
 (0)