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 24, 2023
1 parent 5389b53 commit d6a9ff4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.5.2 (June 24, 2023)
* twilights indicator redesign

# 1.5.1 (October 13, 2022)
* under the hood optimization

Expand Down
2 changes: 1 addition & 1 deletion manifest.xml
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="SmartArcsActiveApp" id="a60e6d3063374be4a685be5cd34425a6" launcherIcon="@Drawables.LauncherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watchface" version="1.5.1">
<iq:application entry="SmartArcsActiveApp" id="a60e6d3063374be4a685be5cd34425a6" launcherIcon="@Drawables.LauncherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watchface" version="1.5.2">
<iq:products>
<iq:product id="approachs62"/>
<iq:product id="d2air"/>
Expand Down
2 changes: 1 addition & 1 deletion manifest.xml.prod
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="SmartArcsActiveApp" id="a60e6d3063374be4a685be5cd34425a6" launcherIcon="@Drawables.LauncherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watchface" version="1.5.1">
<iq:application entry="SmartArcsActiveApp" id="a60e6d3063374be4a685be5cd34425a6" launcherIcon="@Drawables.LauncherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watchface" version="1.5.2">
<iq:products>
<iq:product id="approachs62"/>
<iq:product id="d2air"/>
Expand Down
37 changes: 27 additions & 10 deletions source/SmartArcsActiveView.mc
Original file line number Diff line number Diff line change
Expand Up @@ -905,9 +905,9 @@ class SmartArcsActiveView 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 @@ -916,31 +916,48 @@ class SmartArcsActiveView 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);
}
}
}

}

0 comments on commit d6a9ff4

Please sign in to comment.