Skip to content

Commit 0ef9011

Browse files
author
thyttan
committed
messagegui: misc tweaks
1 parent 2e7f737 commit 0ef9011

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

apps/messagegui/app.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,14 @@ function showMessagesScroller(msg) {
280280
var bodyFont = fontBig;
281281
g.setFont(bodyFont);
282282
const FONT_HEIGHT = g.getFontHeight();
283-
let initScroll;
283+
let initScrollIdx;
284284
var titleLines = [];
285-
let allLines = [""];
285+
let allLines = [" "];
286286
let firstTitleLinePerMsg = [];
287287
let footerImgNeg, footerImgPos;
288288
for (let i=0 ; i<MESSAGES.length ; i++) {
289-
if (MSG_IDX === i) {initScroll = allLines.length*FONT_HEIGHT;}
289+
if (MSG_IDX === i) {initScrollIdx = allLines.length;
290+
}
290291
let msgIter = MESSAGES[i];
291292

292293
var lines = [];
@@ -325,7 +326,7 @@ function showMessagesScroller(msg) {
325326
let shownScrollIdxLast = 0;
326327

327328
E.showScroller({
328-
scroll : initScroll,
329+
scroll : initScrollIdx*FONT_HEIGHT,
329330
h : FONT_HEIGHT, // height of each menu item in pixels
330331
c : allLines.length, // number of menu items
331332
// a function to draw a menu item
@@ -340,7 +341,7 @@ function showMessagesScroller(msg) {
340341
setColor("#f00").drawImage(footerImgNeg,r.x+5+3,r.y).
341342
setColor("#0f0").drawImage(footerImgPos,r.w-64-5,r.y);
342343
}
343-
if (0===scrollIdx) {
344+
if (allLines[scrollIdx]===" ") {
344345
g.
345346
setColor("#f00").drawImage(atob("GBiBAAAYAAH/gAf/4A//8B//+D///D///H/P/n+H/n8P/n4f/vwAP/wAP34f/n8P/n+H/n/P/j///D///B//+A//8Af/4AH/gAAYAA=="), r.x, r.y-1).
346347
setColor(g.theme.fg2).drawImage(atob("GBgBABgAAf+AB//gD//wH//4P//8P//8fAA+fAA+f//+f//+/AA//AA/f//+f//+fAA+fAA+P//8P//8H//4D//wB//gAf+AABgA"),r.w-24,r.y-1);
@@ -387,6 +388,11 @@ function showMessagesScroller(msg) {
387388
E.stopEventPropagation();
388389
Bangle.removeListener("touch", touchHandler);
389390
if (btnWatch) {clearWatch(btnWatch); btnWatch = undefined;}
391+
} else if (xy && xy.type===0 && xy.x>175-30 && xy.y<30) {
392+
Bangle.emit("touch", 2, {x:Math.floor(APP_RECT.x2/2), y:Math.floor(APP_RECT.y2/2), type:0});
393+
E.stopEventPropagation();
394+
if (btnWatch) {clearWatch(btnWatch); btnWatch = undefined;}
395+
Bangle.removeListener("touch", touchHandler);
390396
}
391397
};
392398
Bangle.prependListener("touch", touchHandler);
@@ -401,7 +407,7 @@ function showMessagesScroller(msg) {
401407
setTimeout(()=>{
402408
if (!persist) {return load();}
403409
Bangle.removeListener("touch", touchHandler);
404-
Bangle.emit("touch", 1, {x:Math.floor(APP_RECT.x2/2), y:Math.floor(APP_RECT.y2/2), type:{back:true}});
410+
Bangle.emit("touch",1, {type:{back:true}});
405411
},0);
406412
}, BTN);
407413
}

0 commit comments

Comments
 (0)