forked from FOSS/BangleApps
Merge pull request #2397 from glemco/master
circlesclock: fixed crash if item has no image and cutting long textmaster
commit
44d6cdb6e4
|
@ -38,3 +38,4 @@
|
||||||
Add fast load capability
|
Add fast load capability
|
||||||
0.21: Remade all icons without a palette for dark theme
|
0.21: Remade all icons without a palette for dark theme
|
||||||
Now re-adds widgets if they were hidden when fast-loading
|
Now re-adds widgets if they were hidden when fast-loading
|
||||||
|
0.22: Fixed crash if item has no image and cutting long overflowing text
|
||||||
|
|
|
@ -183,9 +183,12 @@ let drawCircle = function(index, item, data) {
|
||||||
if (txt.endsWith(" bpm")) txt=txt.slice(0,-4); // hack for heart rate - remove the 'bpm' text
|
if (txt.endsWith(" bpm")) txt=txt.slice(0,-4); // hack for heart rate - remove the 'bpm' text
|
||||||
if(item.hasRange) percent = (data.v-data.min) / (data.max-data.min);
|
if(item.hasRange) percent = (data.v-data.min) / (data.max-data.min);
|
||||||
if(data.short) txt = data.short;
|
if(data.short) txt = data.short;
|
||||||
|
//long text can overflow and we do not draw there anymore..
|
||||||
|
if(txt.length>6) txt = txt.slice(0,5)+"\n"+txt.slice(5,10)
|
||||||
drawGauge(w, h3, percent, color);
|
drawGauge(w, h3, percent, color);
|
||||||
drawInnerCircleAndTriangle(w);
|
drawInnerCircleAndTriangle(w);
|
||||||
writeCircleText(w, txt);
|
writeCircleText(w, txt);
|
||||||
|
if(!img) return; //or get it from the clkinfo?
|
||||||
g.setColor(getCircleIconColor(index, color, percent))
|
g.setColor(getCircleIconColor(index, color, percent))
|
||||||
.drawImage(img, w - iconOffset, h3 + radiusOuter - iconOffset, {scale: 16/24});
|
.drawImage(img, w - iconOffset, h3 + radiusOuter - iconOffset, {scale: 16/24});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{ "id": "circlesclock",
|
{ "id": "circlesclock",
|
||||||
"name": "Circles clock",
|
"name": "Circles clock",
|
||||||
"shortName":"Circles clock",
|
"shortName":"Circles clock",
|
||||||
"version":"0.21",
|
"version":"0.22",
|
||||||
"description": "A clock with three or four circles for different data at the bottom in a probably familiar style",
|
"description": "A clock with three or four circles for different data at the bottom in a probably familiar style",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"screenshots": [{"url":"screenshot-dark.png"}, {"url":"screenshot-light.png"}, {"url":"screenshot-dark-4.png"}, {"url":"screenshot-light-4.png"}],
|
"screenshots": [{"url":"screenshot-dark.png"}, {"url":"screenshot-light.png"}, {"url":"screenshot-dark-4.png"}, {"url":"screenshot-light-4.png"}],
|
||||||
|
|
Loading…
Reference in New Issue