mirror of
https://github.com/ThisIsBenny/iOS-Widgets.git
synced 2025-06-07 05:57:41 +00:00
Update VodafoneDE.js
This commit is contained in:
parent
889b5f2bf4
commit
66f45b42d4
1 changed files with 4 additions and 6 deletions
|
@ -376,7 +376,7 @@ function creatProgress(total, havegone) {
|
||||||
return context.getImage()
|
return context.getImage()
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDiagram(percentage, isFlat) {
|
function getDiagram(percentage, v) {
|
||||||
function drawArc(ctr, rad, w, deg) {
|
function drawArc(ctr, rad, w, deg) {
|
||||||
bgx = ctr.x - rad
|
bgx = ctr.x - rad
|
||||||
bgy = ctr.y - rad
|
bgy = ctr.y - rad
|
||||||
|
@ -429,7 +429,7 @@ function getDiagram(percentage, isFlat) {
|
||||||
canvas.setTextAlignedCenter()
|
canvas.setTextAlignedCenter()
|
||||||
canvas.setTextColor(textColor)
|
canvas.setTextColor(textColor)
|
||||||
canvas.setFont(Font.boldSystemFont(canvTextSize))
|
canvas.setFont(Font.boldSystemFont(canvTextSize))
|
||||||
if (isFlat) {
|
if (v.total >= 100000000) {
|
||||||
const infinitySize = canvSize / 2;
|
const infinitySize = canvSize / 2;
|
||||||
canvas.setFont(Font.boldSystemFont(infinitySize));
|
canvas.setFont(Font.boldSystemFont(infinitySize));
|
||||||
const verticalPosition = config.widgetFamily === "small" || "medium" || "large" || "extraLarge" ? infinitySize / 3 : infinitySize / 1;
|
const verticalPosition = config.widgetFamily === "small" || "medium" || "large" || "extraLarge" ? infinitySize / 3 : infinitySize / 1;
|
||||||
|
@ -690,8 +690,7 @@ if (data !== undefined) {
|
||||||
let v = data.usage[0]
|
let v = data.usage[0]
|
||||||
if (config.widgetFamily !== "accessoryInline") {
|
if (config.widgetFamily !== "accessoryInline") {
|
||||||
const percentage = v.total >= 100000000 ? '∞' : (100 / v.total * (showRemainingContingent ? v.remaining : v.used)).toFixed(0);
|
const percentage = v.total >= 100000000 ? '∞' : (100 / v.total * (showRemainingContingent ? v.remaining : v.used)).toFixed(0);
|
||||||
const isFlat = v.total >= 100000000
|
stack.addImage(getDiagram(percentage, v));
|
||||||
stack.addImage(getDiagram(percentage, isFlat));
|
|
||||||
}
|
}
|
||||||
if(config.widgetFamily === "accessoryRectangular"){
|
if(config.widgetFamily === "accessoryRectangular"){
|
||||||
stack.addSpacer(5)
|
stack.addSpacer(5)
|
||||||
|
@ -751,11 +750,10 @@ if (data !== undefined) {
|
||||||
column.centerAlignContent()
|
column.centerAlignContent()
|
||||||
|
|
||||||
const percentage = v.total > 100000000 ? 100 : (100 / v.total * (showRemainingContingent ? v.remaining : v.used)).toFixed(0);
|
const percentage = v.total > 100000000 ? 100 : (100 / v.total * (showRemainingContingent ? v.remaining : v.used)).toFixed(0);
|
||||||
const isFlat = v.total >= 100000000
|
|
||||||
const imageStack = column.addStack()
|
const imageStack = column.addStack()
|
||||||
imageStack.layoutHorizontally()
|
imageStack.layoutHorizontally()
|
||||||
imageStack.addSpacer()
|
imageStack.addSpacer()
|
||||||
imageStack.addImage(getDiagram(percentage, isFlat));
|
imageStack.addImage(getDiagram(percentage, v));
|
||||||
imageStack.addSpacer()
|
imageStack.addSpacer()
|
||||||
column.addSpacer(2)
|
column.addSpacer(2)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue