mirror of https://github.com/espruino/BangleApps
wohrm: renderLshape() from renderUpperLimitBackground()
parent
e98690a853
commit
8c4f37e991
|
@ -23,46 +23,49 @@ let confidenceChanged = true;
|
||||||
|
|
||||||
let setterHighlightTimeout;
|
let setterHighlightTimeout;
|
||||||
|
|
||||||
function renderUpperLimitBackground() {
|
const upperLshape = {
|
||||||
var minX=125;
|
minX: 125,
|
||||||
var maxX=210;
|
maxX: 210,
|
||||||
var minY=40;
|
minY: 40,
|
||||||
var maxY=210;
|
maxY: 210,
|
||||||
var rectWidth=30;
|
rectWidth: 30,
|
||||||
var cornerRoundness=5;
|
cornerRoundness: 5,
|
||||||
var bgColor = 0;
|
bgColor: 0,
|
||||||
var fgColor = '#f00';
|
fgColor: '#f00'
|
||||||
g.setColor(fgColor);
|
};
|
||||||
|
|
||||||
g.fillRect(minX,minY, maxX, minY+rectWidth);
|
function renderLshape(p) {
|
||||||
g.fillRect(maxX-rectWidth, minY+rectWidth, maxX, maxY-cornerRoundness*2);
|
g.setColor(p.fgColor);
|
||||||
|
|
||||||
|
g.fillRect(p.minX,p.minY, p.maxX, p.minY+p.rectWidth);
|
||||||
|
g.fillRect(p.maxX-p.rectWidth, p.minY+p.rectWidth, p.maxX, p.maxY-p.cornerRoundness*2);
|
||||||
|
|
||||||
//Round top left corner
|
//Round top left corner
|
||||||
g.fillEllipse(minX-cornerRoundness*2,
|
g.fillEllipse(p.minX-p.cornerRoundness*2,
|
||||||
minY,
|
p.minY,
|
||||||
minX+cornerRoundness*2,
|
p.minX+p.cornerRoundness*2,
|
||||||
minY+rectWidth);
|
p.minY+p.rectWidth);
|
||||||
|
|
||||||
//Round top right corner
|
//Round top right corner
|
||||||
g.setColor(bgColor);
|
g.setColor(p.bgColor);
|
||||||
g.fillRect(maxX-cornerRoundness,minY, maxX, minY+cornerRoundness);
|
g.fillRect(p.maxX-p.cornerRoundness,p.minY, p.maxX, p.minY+p.cornerRoundness);
|
||||||
g.setColor(fgColor);
|
g.setColor(p.fgColor);
|
||||||
g.fillEllipse(maxX-cornerRoundness*4,minY,maxX,minY+cornerRoundness*2);
|
g.fillEllipse(p.maxX-p.cornerRoundness*4,p.minY,p.maxX,p.minY+p.cornerRoundness*2);
|
||||||
|
|
||||||
//Round inner corner
|
//Round inner corner
|
||||||
g.fillRect(maxX-rectWidth-cornerRoundness-1,
|
g.fillRect(p.maxX-p.rectWidth-p.cornerRoundness-1,
|
||||||
minY+rectWidth+1,
|
p.minY+p.rectWidth+1,
|
||||||
maxX-rectWidth-1,
|
p.maxX-p.rectWidth-1,
|
||||||
minY+rectWidth+cornerRoundness-1);
|
p.minY+p.rectWidth+p.cornerRoundness-1);
|
||||||
g.setColor(bgColor);
|
g.setColor(p.bgColor);
|
||||||
g.fillEllipse(maxX-rectWidth-cornerRoundness*4,
|
g.fillEllipse(p.maxX-p.rectWidth-p.cornerRoundness*4,
|
||||||
minY+rectWidth+1,
|
p.minY+p.rectWidth+1,
|
||||||
maxX-rectWidth-1,
|
p.maxX-p.rectWidth-1,
|
||||||
minY+rectWidth+cornerRoundness*3-1);
|
p.minY+p.rectWidth+p.cornerRoundness*3-1);
|
||||||
|
|
||||||
//Round bottom
|
//Round bottom
|
||||||
g.setColor(fgColor);
|
g.setColor(p.fgColor);
|
||||||
g.fillEllipse(maxX-rectWidth,maxY-cornerRoundness*4, maxX, maxY);
|
g.fillEllipse(p.maxX-p.rectWidth,p.maxY-p.cornerRoundness*4, p.maxX, p.maxY);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderLowerLimitBackground() {
|
function renderLowerLimitBackground() {
|
||||||
|
@ -317,7 +320,7 @@ Bangle.on('lcdPower', (on) => {
|
||||||
|
|
||||||
renderHomeIcon();
|
renderHomeIcon();
|
||||||
renderLowerLimitBackground();
|
renderLowerLimitBackground();
|
||||||
renderUpperLimitBackground();
|
renderLshape(upperLshape);
|
||||||
lowerLimitChanged = true;
|
lowerLimitChanged = true;
|
||||||
upperLimitChanged = true;
|
upperLimitChanged = true;
|
||||||
drawTrainingHeartRate();
|
drawTrainingHeartRate();
|
||||||
|
@ -331,7 +334,7 @@ g.clear();
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
renderLowerLimitBackground();
|
renderLowerLimitBackground();
|
||||||
renderUpperLimitBackground();
|
renderLshape(upperLshape);
|
||||||
|
|
||||||
if (typeof(BTN5) !== typeof(undefined)) {
|
if (typeof(BTN5) !== typeof(undefined)) {
|
||||||
renderHomeIcon();
|
renderHomeIcon();
|
||||||
|
|
Loading…
Reference in New Issue