mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 21:33:00 +00:00
Fix overlapping issue in weather display - Add padding between sections to prevent overlap - Adjust x-coordinate calculations to properly space elements - Ensure each section has 14px usable width (16px - 2px padding) - Center elements within their sections for better visual appearance
This commit is contained in:
@@ -325,11 +325,12 @@ class WeatherManager:
|
|||||||
# Calculate layout for 64x32 matrix
|
# Calculate layout for 64x32 matrix
|
||||||
hours_to_show = min(4, len(self.hourly_forecast)) # Show up to 4 hours
|
hours_to_show = min(4, len(self.hourly_forecast)) # Show up to 4 hours
|
||||||
section_width = 16 # 64/4 = 16 pixels per section
|
section_width = 16 # 64/4 = 16 pixels per section
|
||||||
|
padding = 1 # Add small padding between sections
|
||||||
|
|
||||||
for i in range(hours_to_show):
|
for i in range(hours_to_show):
|
||||||
forecast = self.hourly_forecast[i]
|
forecast = self.hourly_forecast[i]
|
||||||
x = i * section_width
|
x = i * section_width + padding
|
||||||
center_x = x + section_width // 2
|
center_x = x + (section_width - 2 * padding) // 2
|
||||||
|
|
||||||
# Draw hour at top - using extra small font
|
# Draw hour at top - using extra small font
|
||||||
hour_text = forecast['hour']
|
hour_text = forecast['hour']
|
||||||
@@ -387,11 +388,12 @@ class WeatherManager:
|
|||||||
# Calculate layout for 64x32 matrix
|
# Calculate layout for 64x32 matrix
|
||||||
days_to_show = min(4, len(self.daily_forecast)) # Show up to 4 days
|
days_to_show = min(4, len(self.daily_forecast)) # Show up to 4 days
|
||||||
section_width = 16 # 64/4 = 16 pixels per section
|
section_width = 16 # 64/4 = 16 pixels per section
|
||||||
|
padding = 1 # Add small padding between sections
|
||||||
|
|
||||||
for i in range(days_to_show):
|
for i in range(days_to_show):
|
||||||
forecast = self.daily_forecast[i]
|
forecast = self.daily_forecast[i]
|
||||||
x = i * section_width
|
x = i * section_width + padding
|
||||||
center_x = x + section_width // 2
|
center_x = x + (section_width - 2 * padding) // 2
|
||||||
|
|
||||||
# Draw day name at top - using small font
|
# Draw day name at top - using small font
|
||||||
day_text = forecast['date'] # Already in "Fri" format
|
day_text = forecast['date'] # Already in "Fri" format
|
||||||
|
|||||||
Reference in New Issue
Block a user