Skip to content

Commit a7a667c

Browse files
committed
Fix layout from #4281 after running the tests
1 parent 871ff59 commit a7a667c

8 files changed

Lines changed: 22 additions & 20 deletions

File tree

modules/Layout.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,16 @@ Layout.prototype.render = function (l) {
173173
gfx.setFont(l.font).setFontAlign(0,0,l.r).drawString(l.label, l.x+(l.w>>1), l.y+(l.h>>1));
174174
}
175175
}, "btn":function(l){"ram";
176-
var x = l.x+(0|l.pad), y = l.y+(0|l.pad),
177-
w = l.w-(l.pad<<1), h = l.h-(l.pad<<1);
178-
var btnborder = l.btnBorderCol!==undefined?l.btnBorderCol:gfx.theme.fg2,
179-
btnface = l.btnFaceCol!==undefined?l.btnFaceCol:gfx.theme.bg2;
180-
if(l.selected){
181-
btnface = gfx.theme.bgH; btnborder = gfx.theme.fgH;
176+
var x = l.x+(0|l.pad), y = l.y+(0|l.pad),
177+
w = l.w-(l.pad<<1), h = l.h-(l.pad<<1),
178+
btnborder = l.btnBorderCol!==undefined?l.btnBorderCol:gfx.theme.fg2,
179+
btnface = l.btnFaceCol!==undefined?l.btnFaceCol:gfx.theme.bg2,
180+
r = {x:x,y:y,w:w-1,h:h-1,r:10};
181+
if (l.selected){
182+
btnface = gfx.theme.bgH;
183+
btnborder = gfx.theme.fgH;
182184
}
183-
gfx.setColor(btnface).fillRect({x:x,y:y,w: w,h:h,r:10}).setColor(btnborder).drawRect({x:x,y:y,w: w,h:h,r:10});
185+
gfx.setColor(btnface).fillRect(r).setColor(btnborder).drawRect(r);
184186
if (l.col!==undefined) gfx.setColor(l.col);
185187
if (l.src) gfx.setBgColor(btnface).drawImage(
186188
"function"==typeof l.src?l.src():l.src,

modules/Layout.min.js

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Layout/bin/espruino

374 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

tests/Layout/tests/padding.bmp

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)