[toolbar] Fix battery icon width when "half full battery" (#93)

This commit is contained in:
ArtichautCosmique
2021-12-08 22:12:52 +01:00
committed by GitHub
parent 47e3036afd
commit 665de51bae

View File

@@ -85,7 +85,7 @@ void BatteryView::drawRect(KDContext * ctx, KDRect rect) const {
// Middle: Half full battery
constexpr KDCoordinate middleChargeWidth = batteryInsideWidth/2;
ctx->fillRect(KDRect(batteryInsideX, 2, middleChargeWidth, k_batteryHeight-4), Palette::Battery);
ctx->fillRect(KDRect(batteryInsideX+middleChargeWidth, 2, middleChargeWidth, k_batteryHeight-4), KDColor::blend(Palette::Toolbar, Palette::Battery, 128));
ctx->fillRect(KDRect(batteryInsideX+middleChargeWidth, 2, middleChargeWidth+1, k_batteryHeight-4), KDColor::blend(Palette::Toolbar, Palette::Battery, 128));
} else {
assert(m_chargeState == Ion::Battery::Charge::FULL);
// Full but not plugged: Full battery