From 1c5b39f22e28212cd43ecc0165d75083688691ac Mon Sep 17 00:00:00 2001 From: Radko Najman Date: Sun, 6 Mar 2022 11:03:06 +0100 Subject: [PATCH] twilights indicator fix --- CHANGELOG.md | 3 +++ manifest.xml | 2 +- manifest.xml.prod | 2 +- source/SmartArcsTripView.mc | 12 ++++++++++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a03eb0..9d0f81f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.3.1 (March 6, 2022) +* small bugfix for twilights indicator + # 1.3.0 (Jan 29, 2022) * added sunrise, sunset and civil twilights (powered by https://github.com/haraldh/SunCalc library) diff --git a/manifest.xml b/manifest.xml index 009f1d9..fc2b940 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,5 +1,5 @@ - + diff --git a/manifest.xml.prod b/manifest.xml.prod index 009f1d9..fc2b940 100644 --- a/manifest.xml.prod +++ b/manifest.xml.prod @@ -1,5 +1,5 @@ - + diff --git a/source/SmartArcsTripView.mc b/source/SmartArcsTripView.mc index 1287e7a..5b4f19c 100644 --- a/source/SmartArcsTripView.mc +++ b/source/SmartArcsTripView.mc @@ -1015,13 +1015,21 @@ class SmartArcsTripView extends WatchUi.WatchFace { //draw sunrise if (sunriseColor != offSettingFlag) { dc.setColor(sunriseColor, Graphics.COLOR_TRANSPARENT); - dc.drawArc(screenRadius, screenRadius, screenRadius - 17, Graphics.ARC_CLOCKWISE, sunriseStartAngle, sunriseEndAngle); + if (sunriseStartAngle > sunriseEndAngle) { + dc.drawArc(screenRadius, screenRadius, screenRadius - 17, Graphics.ARC_CLOCKWISE, sunriseStartAngle, sunriseEndAngle); + } else { + dc.drawArc(screenRadius, screenRadius, screenRadius - 17, Graphics.ARC_COUNTER_CLOCKWISE, sunriseStartAngle, sunriseEndAngle); + } } //draw sunset if (sunsetColor != offSettingFlag) { dc.setColor(sunsetColor, Graphics.COLOR_TRANSPARENT); - dc.drawArc(screenRadius, screenRadius, screenRadius - 13, Graphics.ARC_CLOCKWISE, sunsetStartAngle, sunsetEndAngle); + if (sunsetStartAngle > sunsetEndAngle) { + dc.drawArc(screenRadius, screenRadius, screenRadius - 13, Graphics.ARC_CLOCKWISE, sunsetStartAngle, sunsetEndAngle); + } else { + dc.drawArc(screenRadius, screenRadius, screenRadius - 13, Graphics.ARC_COUNTER_CLOCKWISE, sunsetStartAngle, sunsetEndAngle); + } } }