fix: sun position arc overflow and revert user display
- Constrain arc height to fit within card boundaries - Scale radius down when arc would overflow on wider displays - Revert user display in section header, use debugPrint instead 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
cc6068b759
commit
9b2000efc2
@@ -386,7 +386,15 @@ class _SunArcPainter extends CustomPainter {
|
||||
|
||||
// Calculate radius so arc endpoints touch horizon
|
||||
// For a chord of width W and arc angle θ: R = W / (2 * sin(θ/2))
|
||||
final radius = horizonWidth / (2 * math.sin(clampedAngle / 2));
|
||||
var radius = horizonWidth / (2 * math.sin(clampedAngle / 2));
|
||||
|
||||
// Constrain arc height to fit within available space (leave 25px margin for sun)
|
||||
final maxArcHeight = size.height - horizonY - 25;
|
||||
final arcHeight = radius * (1 - math.cos(clampedAngle / 2));
|
||||
if (arcHeight > maxArcHeight) {
|
||||
// Scale radius down to fit
|
||||
radius = maxArcHeight / (1 - math.cos(clampedAngle / 2));
|
||||
}
|
||||
|
||||
// Arc center is below the horizon for an upward-bulging arc
|
||||
// Distance from chord to center = R * cos(θ/2)
|
||||
@@ -491,7 +499,15 @@ class _SunArcPainter extends CustomPainter {
|
||||
final clampedAngle = arcAngle.clamp(math.pi / 6, math.pi);
|
||||
|
||||
// Calculate radius so arc endpoints touch horizon
|
||||
final radius = horizonWidth / (2 * math.sin(clampedAngle / 2));
|
||||
var radius = horizonWidth / (2 * math.sin(clampedAngle / 2));
|
||||
|
||||
// Constrain arc height to fit within available space (leave 20px margin for moon)
|
||||
final maxArcHeight = size.height - horizonY - 20;
|
||||
final arcHeight = radius * (1 - math.cos(clampedAngle / 2));
|
||||
if (arcHeight > maxArcHeight) {
|
||||
// Scale radius down to fit
|
||||
radius = maxArcHeight / (1 - math.cos(clampedAngle / 2));
|
||||
}
|
||||
|
||||
// Arc center is below the horizon for an upward-bulging arc
|
||||
final horizonYPos = size.height - horizonY;
|
||||
|
||||
Reference in New Issue
Block a user