Keep planets visible near enlarged Moon
This commit is contained in:
parent
4e31217186
commit
f3019d044f
1 changed files with 14 additions and 0 deletions
|
|
@ -1858,6 +1858,7 @@ function updateSolarSystem(date, lst, W, H, horizonPx) {
|
|||
const moon = moonScreen ? {
|
||||
...moonScreen,
|
||||
radius: moonRadius,
|
||||
realRadius: realMoonRadius,
|
||||
phase,
|
||||
illuminated: moonIllumination.phase_fraction,
|
||||
brightAngle,
|
||||
|
|
@ -1877,6 +1878,13 @@ function updateSolarSystem(date, lst, W, H, horizonPx) {
|
|||
radius: Math.max(1.8, Math.min(5.2, 3.45 - illumination.mag * 0.46)),
|
||||
});
|
||||
}
|
||||
if (moon) {
|
||||
for (const planet of planets) {
|
||||
const distance = Math.hypot(planet.x - moon.x, planet.y - moon.y);
|
||||
const safeRadius = distance - planet.radius - 6;
|
||||
moon.radius = Math.max(moon.realRadius, Math.min(moon.radius, safeRadius));
|
||||
}
|
||||
}
|
||||
solarSystemFrame = { moon, planets };
|
||||
} catch (error) {
|
||||
console.error('[skeledance] falha nas efemérides:', error);
|
||||
|
|
@ -1907,6 +1915,12 @@ function drawSolarSystem(c) {
|
|||
const [r, g, b] = planet.color;
|
||||
c.save();
|
||||
c.globalAlpha = fade;
|
||||
c.shadowBlur = 0;
|
||||
c.strokeStyle = 'rgba(3,7,18,0.92)';
|
||||
c.lineWidth = Math.max(1.1, planet.radius * 0.42);
|
||||
c.beginPath();
|
||||
c.arc(planet.x, planet.y, planet.radius + 1.3, 0, Math.PI * 2);
|
||||
c.stroke();
|
||||
c.shadowColor = `rgba(${r},${g},${b},0.95)`;
|
||||
c.shadowBlur = Math.max(2.5, 5.5 - planet.magnitude * 0.45);
|
||||
c.fillStyle = `rgb(${r},${g},${b})`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue