menusmall: use Bangle.appRect
parent
f2f500e474
commit
310bf60ed7
|
|
@ -1,2 +1,2 @@
|
||||||
0.01: New App!
|
0.01: New App!
|
||||||
0.02: add `wrap` option
|
0.02: add `wrap` option, use Bangle.appRect
|
||||||
|
|
@ -1,28 +1,23 @@
|
||||||
"";//not entirely sure why we need this - related to how bootupdate adds these to .boot0
|
"";//not entirely sure why we need this - related to how bootupdate adds these to .boot0
|
||||||
E.showMenu = function(items) {
|
E.showMenu = function(items) {
|
||||||
g.clear(1).flip(); // clear screen if no menu supplied
|
g.clearRect(Bangle.appRect); // clear screen if no menu supplied
|
||||||
Bangle.drawWidgets();
|
|
||||||
if (!items) {
|
if (!items) {
|
||||||
Bangle.setUI();
|
Bangle.setUI();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var w = g.getWidth();
|
|
||||||
var h = g.getHeight();
|
|
||||||
var menuItems = Object.keys(items);
|
var menuItems = Object.keys(items);
|
||||||
var options = items[""];
|
var options = items[""];
|
||||||
if (options) menuItems.splice(menuItems.indexOf(""),1);
|
if (options) menuItems.splice(menuItems.indexOf(""),1);
|
||||||
if (!(options instanceof Object)) options = {};
|
if (!(options instanceof Object)) options = {};
|
||||||
options.fontHeight=14;
|
options.fontHeight = options.fontHeight|14;
|
||||||
options.x=0;
|
|
||||||
options.x2=w-1;
|
|
||||||
options.y=24;
|
|
||||||
options.y2=h-12;
|
|
||||||
if (options.selected === undefined)
|
if (options.selected === undefined)
|
||||||
options.selected = 0;
|
options.selected = 0;
|
||||||
var x = 0|options.x;
|
var ar = Bangle.appRect;
|
||||||
var x2 = options.x2||(g.getWidth()-1);
|
var x = ar.x;
|
||||||
var y = 0|options.y;
|
var x2 = ar.x2;
|
||||||
var y2 = options.y2||(g.getHeight()-1);
|
var y = ar.y;
|
||||||
|
var y2 = ar.y2 - 11; // padding at end for arrow
|
||||||
if (options.title)
|
if (options.title)
|
||||||
y += 15;
|
y += 15;
|
||||||
var loc = require("locale");
|
var loc = require("locale");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue