circlesclock: improved clkinfo handling
parent
bca82d185b
commit
0bd33f0efe
|
|
@ -31,3 +31,4 @@
|
||||||
0.16: Fix const error
|
0.16: Fix const error
|
||||||
Use widget_utils if available
|
Use widget_utils if available
|
||||||
0.17: Load circles from clkinfo
|
0.17: Load circles from clkinfo
|
||||||
|
0.18: Improved clkinfo handling
|
||||||
|
|
|
||||||
|
|
@ -690,17 +690,18 @@ function drawClkInfo(index, w) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var item = info.items[circleItemNum[index-1]];
|
var item = info.items[circleItemNum[index-1]];
|
||||||
//TODO do hide()+get() here
|
|
||||||
item.show();
|
item.show();
|
||||||
item.hide();
|
item.hide();
|
||||||
item=item.get();
|
var data=item.get();
|
||||||
var img = item.img;
|
var img = data.img;
|
||||||
|
var percent = 1; //fill up if no range
|
||||||
|
var txt = data.text;
|
||||||
if(!img) img = info.img;
|
if(!img) img = info.img;
|
||||||
let percent = (item.v-item.min) / item.max;
|
if(item.hasRange) percent = (data.v-data.min) / (data.max-data.min);
|
||||||
if(isNaN(percent)) percent = 1; //fill it up
|
if(item.short) txt = item.short;
|
||||||
drawGauge(w, h3, percent, color);
|
drawGauge(w, h3, percent, color);
|
||||||
drawInnerCircleAndTriangle(w);
|
drawInnerCircleAndTriangle(w);
|
||||||
writeCircleText(w, item.text);
|
writeCircleText(w, txt);
|
||||||
g.setColor(getCircleIconColor(type, color, percent))
|
g.setColor(getCircleIconColor(type, 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.17",
|
"version":"0.18",
|
||||||
"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"}],
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
var valuesCircleTypes = ["empty","weather", "sunprogress"];
|
var valuesCircleTypes = ["empty","weather", "sunprogress"];
|
||||||
var namesCircleTypes = ["empty","weather", "sun"];
|
var namesCircleTypes = ["empty","weather", "sun"];
|
||||||
clock_info.load().forEach(e=>{
|
clock_info.load().forEach(e=>{
|
||||||
//TODO filter for hasRange and other
|
|
||||||
if(!e.items.length || !e.items[0].name) {
|
if(!e.items.length || !e.items[0].name) {
|
||||||
//suppose unnamed are varying (like timers or events), pick the first
|
//suppose unnamed are varying (like timers or events), pick the first
|
||||||
item = e.items[0];
|
item = e.items[0];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue