pomoplus: refactor function names

touchHandler -> onTouchSoftwareButtons
switchGraphicsOnButton -> onButtonSwitchGraphics
pull/3541/head
thyttan 2024-08-31 22:23:05 +02:00
parent f20683cc4e
commit ff3228c8f2
1 changed files with 4 additions and 6 deletions

View File

@ -93,7 +93,7 @@ let hideButtons = ()=>{
} }
let graphicState = 0; // 0 - all is visible, 1 - widgets are hidden, 2 - widgets and buttons are hidden. let graphicState = 0; // 0 - all is visible, 1 - widgets are hidden, 2 - widgets and buttons are hidden.
let switchGraphicsOnButton = (n)=>{ let onButtonSwitchGraphics = (n)=>{
if (process.env.HWVERSION == 2) n=2; // Translate Bangle.js 2 button to Bangle.js 1 middle button. if (process.env.HWVERSION == 2) n=2; // Translate Bangle.js 2 button to Bangle.js 1 middle button.
if (n == 2) { if (n == 2) {
if (graphicState == 0) { if (graphicState == 0) {
@ -106,12 +106,11 @@ let switchGraphicsOnButton = (n)=>{
wu.show(); wu.show();
drawButtons(); drawButtons();
} }
graphicState = (graphicState+1) % 3; graphicState = (graphicState+1) % 3;
} }
} }
let touchHandler = (button, xy) => { let onTouchSoftwareButtons = (button, xy) => {
//If we support full touch and we're not touching the keys, ignore. //If we support full touch and we're not touching the keys, ignore.
//If we don't support full touch, we can't tell so just assume we are. //If we don't support full touch, we can't tell so just assume we are.
let isOutsideButtonArea = xy !== undefined && xy.y <= g.getHeight() - BUTTON_HEIGHT; let isOutsideButtonArea = xy !== undefined && xy.y <= g.getHeight() - BUTTON_HEIGHT;
@ -175,9 +174,8 @@ let touchHandler = (button, xy) => {
Bangle.setUI({ Bangle.setUI({
mode: "custom", mode: "custom",
touch: touchHandler, touch: onTouchSoftwareButtons,
btn: switchGraphicsOnButton btn: onButtonSwitchGraphics
}) })
let timerInterval; let timerInterval;