wohrm: parameterized centerBar
parent
0d172f1db0
commit
09e7330ae0
|
|
@ -47,6 +47,14 @@ const lowerLshape = {
|
||||||
fgColor: '#00f'
|
fgColor: '#00f'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const centerBar = {
|
||||||
|
minY: (upperLshape.minY + upperLshape.maxY - upperLshape.rectWidth)/2,
|
||||||
|
maxY: (upperLshape.minY + upperLshape.maxY + upperLshape.rectWidth)/2,
|
||||||
|
confidenceWidth: 10,
|
||||||
|
minX: 55,
|
||||||
|
maxX: 165
|
||||||
|
};
|
||||||
|
|
||||||
function fillEllipse(x, y, x2, y2) {
|
function fillEllipse(x, y, x2, y2) {
|
||||||
g.fillEllipse(Math.min(x, x2),
|
g.fillEllipse(Math.min(x, x2),
|
||||||
Math.min(y, y2),
|
Math.min(y, y2),
|
||||||
|
|
@ -136,13 +144,16 @@ function renderUpperLimit() {
|
||||||
function renderCurrentHeartRate() {
|
function renderCurrentHeartRate() {
|
||||||
if(!hrChanged) { return; }
|
if(!hrChanged) { return; }
|
||||||
|
|
||||||
g.setColor(255,255,255);
|
g.setColor(1, 1, 1);
|
||||||
g.fillRect(55, 110, 165, 150);
|
g.fillRect(centerBar.minX, centerBar.minY,
|
||||||
|
centerBar.maxX, centerBar.maxY);
|
||||||
|
|
||||||
g.setColor(0,0,0);
|
g.setColor(0,0,0);
|
||||||
g.setFontVector(24);
|
g.setFontVector(24);
|
||||||
g.setFontAlign(1, -1, 0);
|
g.setFontAlign(1, 0, 0);
|
||||||
g.drawString(currentHeartRate, 130, 117);
|
g.drawString(currentHeartRate,
|
||||||
|
upperLshape.minX+upperLshape.cornerRoundness,
|
||||||
|
(centerBar.minY+centerBar.maxY)/2);
|
||||||
|
|
||||||
//Reset alignment to defaults
|
//Reset alignment to defaults
|
||||||
g.setFontAlign(-1, -1, 0);
|
g.setFontAlign(-1, -1, 0);
|
||||||
|
|
@ -181,8 +192,8 @@ function renderConfidenceBars(){
|
||||||
g.setColor(255, 255, 255);
|
g.setColor(255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
g.fillRect(45, 110, 55, 150);
|
g.fillRect(centerBar.minX-centerBar.confidenceWidth, centerBar.minY, centerBar.minX, centerBar.maxY);
|
||||||
g.fillRect(165, 110, 175, 150);
|
g.fillRect(centerBar.maxX, centerBar.minY, centerBar.maxX+centerBar.confidenceWidth, centerBar.maxY);
|
||||||
|
|
||||||
confidenceChanged = false;
|
confidenceChanged = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue