score: allow user to mirror score buttons on b1

pull/828/head
Mika Dede 2021-10-10 17:26:35 +02:00
parent 23ec132b4d
commit f6f1a1c352
No known key found for this signature in database
GPG Key ID: 546586DC38D45BBD
2 changed files with 17 additions and 2 deletions

View File

@ -33,9 +33,10 @@ function setupInputWatchers(init) {
Bangle.setUI('updown', v => {
if (v) {
if (isBangle1) {
handleInput(Math.floor(((v*-1)+2)/2))
let i = settings.mirrorScoreButtons ? v * -1 : v;
handleInput(Math.floor((i+2)/2));
} else {
handleInput(Math.floor((v+2)/2)+3)
handleInput(Math.floor((v+2)/2)+3);
}
}
});

View File

@ -1,6 +1,13 @@
(function () {
return (function (back, inApp, ret) {
const isBangle1 = process.env.BOARD === 'BANGLEJS'
function fillSettingsWithDefaults(settings) {
if (isBangle1) {
if (settings.mirrorScoreButtons == null) {
settings.mirrorScoreButtons = false;
}
}
if (settings.winSets == null) {
settings.winSets = 2;
}
@ -100,6 +107,13 @@
}
m['< Back'] = function () { back(settings, changed); };
m['Presets'] = function () { E.showMenu(presetMenu(back)); };
if (isBangle1) {
m['Mirror Buttons'] = {
value: settings.mirrorScoreButtons,
format: m => offon[~~m],
onchange: m => setAndSave('mirrorScoreButtons', m),
};
}
m['Sets to win'] = {
value: settings.winSets,
min:1,