From 9fd332ef8fc14618850ad400de7d4ea816d9fa94 Mon Sep 17 00:00:00 2001 From: R Date: Fri, 23 Jun 2023 22:58:30 +0200 Subject: [PATCH] twilights indicator redesign --- CHANGELOG.md | 3 +++ docs/index.md | 3 --- manifest.xml | 2 +- manifest.xml.beta | 2 +- source/SmartArcsView.mc | 35 ++++++++++++++++++++++++++--------- 5 files changed, 31 insertions(+), 14 deletions(-) mode change 100644 => 100755 manifest.xml mode change 100644 => 100755 source/SmartArcsView.mc diff --git a/CHANGELOG.md b/CHANGELOG.md index c18cbac..de287a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.7.2 (June 23, 2023) +* twilights indicator redesign + # 1.7.1 (October 24, 2022) * code optimization diff --git a/docs/index.md b/docs/index.md index acd2493..44156c7 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,3 @@ -

- -

diff --git a/manifest.xml b/manifest.xml old mode 100644 new mode 100755 index 505a9f1..a764638 --- a/manifest.xml +++ b/manifest.xml @@ -1,5 +1,5 @@ - + diff --git a/manifest.xml.beta b/manifest.xml.beta index 6868481..2bb6feb 100644 --- a/manifest.xml.beta +++ b/manifest.xml.beta @@ -1,5 +1,5 @@ - + diff --git a/source/SmartArcsView.mc b/source/SmartArcsView.mc old mode 100644 new mode 100755 index 7fecd87..0f4b0a0 --- a/source/SmartArcsView.mc +++ b/source/SmartArcsView.mc @@ -1005,9 +1005,9 @@ class SmartArcsView extends WatchUi.WatchFace { ((sunriseEndAngle < sunsetStartAngle) && (sunriseEndAngle > sunsetEndAngle)) || ((sunsetStartAngle < sunriseStartAngle) && (sunsetStartAngle > sunriseEndAngle)) || ((sunsetEndAngle < sunriseStartAngle) && (sunsetEndAngle > sunriseEndAngle))) { - sunArcsOffset = 13; + sunArcsOffset = 10; } else { - sunArcsOffset = 17; + sunArcsOffset = 12; } } } @@ -1016,28 +1016,45 @@ class SmartArcsView extends WatchUi.WatchFace { var timeInfo = Time.Gregorian.info(time, Time.FORMAT_SHORT); var angle = ((timeInfo.hour % 12) * 60.0) + timeInfo.min; angle = angle / (12 * 60.0) * Math.PI * 2; - return -(angle - Math.PI/2) * 180 / Math.PI; + return Math.toDegrees(-angle + Math.PI/2); } function drawSun(dc) { - dc.setPenWidth(7); + dc.setPenWidth(1); + + var arcWidth = 9; + if (sunArcsOffset == 10) { + arcWidth = 7; + } //draw sunrise if (sunriseColor != offSettingFlag) { - dc.setColor(sunriseColor, Graphics.COLOR_TRANSPARENT); if (sunriseStartAngle > sunriseEndAngle) { - dc.drawArc(screenRadius, screenRadius, screenRadius - 17, Graphics.ARC_CLOCKWISE, sunriseStartAngle, sunriseEndAngle); + dc.setColor(sunriseColor, Graphics.COLOR_TRANSPARENT); + var step = (sunriseStartAngle - sunriseEndAngle) / arcWidth; + for (var i = 0; i < arcWidth; i++) { + if (sunArcsOffset == 10) { + dc.drawArc(screenRadius, screenRadius, screenRadius - 20 + i, Graphics.ARC_CLOCKWISE, sunriseStartAngle - (step * i), sunriseEndAngle); + } else { + dc.drawArc(screenRadius, screenRadius, screenRadius - 12 - i, Graphics.ARC_CLOCKWISE, sunriseStartAngle - (step * i), sunriseEndAngle); + } + } } else { - dc.drawArc(screenRadius, screenRadius, screenRadius - 17, Graphics.ARC_COUNTER_CLOCKWISE, sunriseStartAngle, sunriseEndAngle); + dc.setColor(sunriseColor, Graphics.COLOR_TRANSPARENT); + dc.drawArc(screenRadius, screenRadius, screenRadius - 17, Graphics.ARC_COUNTER_CLOCKWISE, sunriseStartAngle, sunriseEndAngle); } } //draw sunset if (sunsetColor != offSettingFlag) { - dc.setColor(sunsetColor, Graphics.COLOR_TRANSPARENT); if (sunsetStartAngle > sunsetEndAngle) { - dc.drawArc(screenRadius, screenRadius, screenRadius - sunArcsOffset, Graphics.ARC_CLOCKWISE, sunsetStartAngle, sunsetEndAngle); + dc.setColor(sunsetColor, Graphics.COLOR_TRANSPARENT); + var step = (sunsetStartAngle - sunsetEndAngle) / arcWidth; + for (var i = 0; i < arcWidth; i++) { + dc.drawArc(screenRadius, screenRadius, screenRadius - sunArcsOffset - i, Graphics.ARC_CLOCKWISE, sunsetStartAngle, sunsetEndAngle + (step * i)); + } } else { + dc.setColor(sunsetColor, Graphics.COLOR_TRANSPARENT); dc.drawArc(screenRadius, screenRadius, screenRadius - sunArcsOffset, Graphics.ARC_COUNTER_CLOCKWISE, sunsetStartAngle, sunsetEndAngle); } }