Skip to content

Commit b40968f

Browse files
authored
Fix lunar eclipse shadows for high res displays (#28)
* Improved start-up animation. * Fixed bug in drawing lunar eclipse shadows on high pixel density displays. (Unfortunately, this bug has been lurking since 2018-08-13.)
1 parent 78b9412 commit b40968f

5 files changed

Lines changed: 12 additions & 8 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "svc-ng",
3-
"version": "1.14.7",
3+
"version": "1.14.8",
44
"license": "MIT AND GPL-3.0-or-later",
55
"author": "Kerry Shetline <kerry@shetline.com>",
66
"scripts": {

src/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="about-dialog">
55
<img src="/assets/resources/svc_lunar_eclipse.png" alt="lunar eclipse" width="64" height="64">
66
<h2>Sky View Café NP</h2>
7-
Version 1.14.7<br><br>
7+
Version 1.14.8<br><br>
88
Copyright © 2016-2022 Kerry Shetline.
99
</div>
1010
</p-dialog>

src/app/svc/moon-drawer.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export class MoonDrawer {
7070
if (size === 0 && observer)
7171
size = ceil(solarSystem.getAngularDiameter(MOON, time_JDE, observer) * pixelsPerArcSec);
7272

73+
pixelsPerArcSec *= pixelRatio;
7374
size *= pixelRatio;
7475
// Make sure that the size is odd, so that one pixel can be the exact center of the image.
7576
size += (size + 1) % 2;
@@ -121,7 +122,7 @@ export class MoonDrawer {
121122
}
122123

123124
// I'm going to treat the umbra and penumbra of the Earth as imaginary circular
124-
// objects directly opposite from the Sun and located at the same distance from
125+
// objects directly opposite to the Sun and located at the same distance from
125126
// the Earth as the Moon.
126127
//
127128
// If you can imagine the typical diagram of how umbral and penumbral shadows are
@@ -145,8 +146,8 @@ export class MoonDrawer {
145146
const uRadius = round(ei.umbraRadius * pixelsPerArcSec) + 2;
146147
const pRadius = round(ei.penumbraRadius * pixelsPerArcSec) + 2;
147148

148-
u2 = uRadius * uRadius;
149-
p2 = pRadius * pRadius;
149+
u2 = uRadius ** 2;
150+
p2 = pRadius ** 2;
150151
}
151152
}
152153

@@ -191,7 +192,7 @@ export class MoonDrawer {
191192

192193
// Are we within the penumbra?
193194
if (sdx * sdx + sdy * sdy <= p2) {
194-
// Also within the umbra? Even darker a shadow.
195+
// Also within the umbra? Even darker shadow.
195196
if (sdx * sdx + sdy * sdy <= u2)
196197
gray /= 2.5;
197198

src/assets/about.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
<h2 class="header-sans"><a name="history">What's New / Version History</a></h2>
8585
<div style="padding-left: 1em; text-indent: -1em">
8686

87+
<p><b>1.14.8 2022-05-14:</b> Fixed bug in drawing lunar eclipse shadows on high pixel density displays.
88+
(I definitely need more user feedback! This bug must have existed since 2018-08-13.)</p>
89+
8790
<p><b>1.14.7 2022-04-30:</b> Fixed iOS keyboard input bug caused by iOS update.</p>
8891

8992
<p><b>1.14.6 2022-01-15:</b> Added an option to change the first day of the week for calendars from the locale

0 commit comments

Comments
 (0)