Skip to content

Commit

Permalink
twilights indicator redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
okdar committed Jun 23, 2023
1 parent 2d22a9c commit 9fd332e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.7.2 (June 23, 2023)
* twilights indicator redesign

# 1.7.1 (October 24, 2022)
* code optimization

Expand Down
3 changes: 0 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<p align="center" width="100%">
<img src="stand_with_ukraine.png">
</p>
<p align="center" width="100%">
<img src="suite.png">
</p>
Expand Down
2 changes: 1 addition & 1 deletion manifest.xml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- This is a generated file. It is highly recommended that you DO NOT edit this file. --><iq:manifest xmlns:iq="http://www.garmin.com/xml/connectiq" version="3">
<iq:application entry="SmartArcsApp" id="f9b0f982693411e9a9231681be663d3e" launcherIcon="@Drawables.LauncherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watchface" version="1.7.1">
<iq:application entry="SmartArcsApp" id="f9b0f982693411e9a9231681be663d3e" launcherIcon="@Drawables.LauncherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watchface" version="1.7.2">
<iq:products>
<iq:product id="approachs62"/>
<iq:product id="d2air"/>
Expand Down
2 changes: 1 addition & 1 deletion manifest.xml.beta
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- This is a generated file. It is highly recommended that you DO NOT edit this file. --><iq:manifest xmlns:iq="http://www.garmin.com/xml/connectiq" version="3">
<iq:application entry="SmartArcsApp" id="2eafd80f81794ced90db35ccfcb29945" launcherIcon="@Drawables.LauncherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watchface" version="1.7.26">
<iq:application entry="SmartArcsApp" id="2eafd80f81794ced90db35ccfcb29945" launcherIcon="@Drawables.LauncherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watchface" version="1.7.31">
<iq:products>
<iq:product id="approachs62"/>
<iq:product id="d2air"/>
Expand Down
35 changes: 26 additions & 9 deletions source/SmartArcsView.mc
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand All @@ -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);
}
}
Expand Down

0 comments on commit 9fd332e

Please sign in to comment.