Skip to content

Commit

Permalink
Bangle.js: Now clear entire top/bottom row if there are widgets in it (
Browse files Browse the repository at this point in the history
…fix #1790)
  • Loading branch information
gfwilliams committed Mar 31, 2020
1 parent 363a90a commit 87d8b8c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
Fix pretokenise of RegExp literals (fix #1786)
Add ability to turn off software I2C clock stretching (not accessible from JS)
Puck.js: disable clock stretching for built-in sensors
Bangle.js: Now clear entire top/bottom row if there are widgets in it (fix #1790)


2v04 : Allow \1..\9 escape codes in RegExp
Expand Down
7 changes: 2 additions & 5 deletions libs/js/banglejs/Bangle_drawWidgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@
wd.y = p.y;
p.x += wd.width*(1-2*p.r);
p.c++;
wd.draw(wd);
}
g.reset();
if (pos.tl.c) g.clearRect(0,0,pos.tl.x,23);
if (pos.bl.c) g.clearRect(0,h-24,pos.bl.x,h-1);
if (pos.tr.c) g.clearRect(pos.tr.x,0,w-1,23);
if (pos.br.c) g.clearRect(pos.br.x,h-24,w-1,h-1);
if (pos.tl.c || pos.tr.c) g.clearRect(0,0,w-1,23);
if (pos.bl.c || pos.br.c) g.clearRect(0,h-24,w-1,x,h-1);
for (wd of WIDGETS) wd.draw(wd);
}
})
6 changes: 4 additions & 2 deletions libs/js/banglejs/Bangle_drawWidgets.min.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
(function(){var w=g.getWidth(),h=g.getHeight();var pos={tl:{x:28,y:0,r:0,c:0},tr:{x:w-28,y:0,r:1,c:0},bl:{x:24,y:h-24,r:0,c:0},br:{x:w-24,y:h-24,r:1,c:0}};if(global.WIDGETS){for(var wd of WIDGETS){var p=pos[wd.area];if(!p)return;wd.x=p.x-p.r*wd.width;wd.y=p.y;p.x+=wd.width*(1-2*p.r);p.c++;wd.draw(wd)}
g.reset();if(pos.tl.c)g.clearRect(0,0,pos.tl.x,23);if(pos.bl.c)g.clearRect(0,h-24,pos.bl.x,h-1);if(pos.tr.c)g.clearRect(pos.tr.x,0,w-1,23);if(pos.br.c)g.clearRect(pos.br.x,h-24,w-1,h-1);for(wd of WIDGETS)wd.draw(wd)}})
(function(){var w=g.getWidth(),h=g.getHeight();var pos={tl:{x:28,y:0,r:0,c:0},tr:{x:w-28,y:0,r:1,c:0},bl:{x:24,y:h-24,r:0,c:0},br:{x:w-24,y:h-24,r:1,c:0}};if(global.WIDGETS){for(var wd of WIDGETS){var p=pos[wd.area];if(!p)return;wd.x=p.x-p.r*wd.width;wd.y=p.y;p.x+=wd.width*(1-2*p.r);p.c++}
g.reset();if(pos.tl.c||pos.tr.c)g.clearRect(0,0,w-1,23);if(pos.bl.c||pos.br.c)g.clearRect(0,h-24,w-1,x,h-1);for(wd of WIDGETS)wd.draw(wd)}})


0 comments on commit 87d8b8c

Please sign in to comment.