mirror of https://github.com/espruino/BangleApps
When message body is < 1 line wide, use large font.
parent
6872c38a8d
commit
4274503bff
|
@ -270,9 +270,18 @@ function showMessage(msgid) {
|
|||
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1});
|
||||
}});
|
||||
}
|
||||
var bodyFont = fontMedium;
|
||||
lines = g.setFont(bodyFont).wrapString(msg.body, g.getWidth()-10);
|
||||
var body = (lines.length>4) ? lines.slice(0,4).join("\n")+"..." : lines.join("\n");
|
||||
// If body of message is only one line, use large font.
|
||||
var body=msg.body, bodyFont = fontLarge, lines;
|
||||
if (body) {
|
||||
var w = g.getWidth()-48;
|
||||
if (g.setFont(bodyFont).stringWidth(body) > w)
|
||||
bodyFont = fontMedium;
|
||||
if (g.setFont(bodyFont).stringWidth(body) > w) {
|
||||
lines = g.setFont(bodyFont).wrapString(msg.body, g.getWidth()-10);
|
||||
body = (lines.length>4) ? lines.slice(0,4).join("\n")+"..." : lines.join("\n");
|
||||
}
|
||||
}
|
||||
|
||||
layout = new Layout({ type:"v", c: [
|
||||
{type:"h", fillx:1, bgCol:colBg, c: [
|
||||
{ type:"btn", src:getMessageImage(msg), col:getMessageImageCol(msg), pad: 3, cb:()=>{
|
||||
|
|
Loading…
Reference in New Issue