adjust odds manager mlb spacing

This commit is contained in:
Chuck
2025-09-10 13:19:45 -04:00
parent c1ccd6f44a
commit 61a56560f3

View File

@@ -1082,7 +1082,8 @@ class OddsTickerManager:
home_odds_width = int(temp_draw.textlength(home_odds_text, font=odds_font)) home_odds_width = int(temp_draw.textlength(home_odds_text, font=odds_font))
odds_width = max(away_odds_width, home_odds_width) odds_width = max(away_odds_width, home_odds_width)
# For baseball live games, ensure minimum width for graphical bases # For baseball live games, optimize width for graphical bases
is_baseball_live = False
if is_live and live_info and hasattr(self, '_bases_data'): if is_live and live_info and hasattr(self, '_bases_data'):
sport = None sport = None
for league_key, config in self.league_configs.items(): for league_key, config in self.league_configs.items():
@@ -1091,8 +1092,10 @@ class OddsTickerManager:
break break
if sport == 'baseball': if sport == 'baseball':
# Ensure minimum width for the graphical bases is_baseball_live = True
min_bases_width = 30 # Minimum width needed for the base diamond cluster # Use a more compact width for baseball games to minimize dead space
# The bases graphic only needs about 24px width, so we can be more efficient
min_bases_width = 24 # Reduced from 30 to minimize dead space
odds_width = max(odds_width, min_bases_width) odds_width = max(odds_width, min_bases_width)
# --- Calculate total width --- # --- Calculate total width ---
@@ -1166,20 +1169,11 @@ class OddsTickerManager:
if is_live and live_info: if is_live and live_info:
odds_color = (255, 0, 0) # Red for live games odds_color = (255, 0, 0) # Red for live games
# Check if this is a baseball live game # Draw odds content based on game type
is_baseball_live = False if is_baseball_live:
if is_live and live_info and hasattr(self, '_bases_data'):
sport = None
for league_key, config in self.league_configs.items():
if config.get('logo_dir') == game.get('logo_dir'):
sport = config.get('sport')
break
if sport == 'baseball':
is_baseball_live = True
# Draw graphical bases instead of text # Draw graphical bases instead of text
# Position bases closer to the right edge of odds column to reduce gap to gameplay stats # Position bases closer to team names (left side of odds column) for better spacing
bases_x = current_x + odds_width - 12 # Position at right side, offset by half cluster width (24/2 = 12) bases_x = current_x + 12 # Position at left side, offset by half cluster width (24/2 = 12)
# Shift bases down a bit more for better positioning # Shift bases down a bit more for better positioning
bases_y = (height // 2) + 2 # Move down 2 pixels from center bases_y = (height // 2) + 2 # Move down 2 pixels from center
@@ -1197,9 +1191,10 @@ class OddsTickerManager:
draw.text((current_x, odds_y_away), away_odds_text, font=odds_font, fill=odds_color) draw.text((current_x, odds_y_away), away_odds_text, font=odds_font, fill=odds_color)
draw.text((current_x, odds_y_home), home_odds_text, font=odds_font, fill=odds_color) draw.text((current_x, odds_y_home), home_odds_text, font=odds_font, fill=odds_color)
# For baseball live games, use reduced padding to bring gameplay stats closer to bases # Dynamic spacing: Use reduced padding for baseball games to minimize dead space
if is_baseball_live: if is_baseball_live:
current_x += odds_width + (h_padding // 2) # Use half padding for baseball games # Use minimal padding since bases are positioned at left of column
current_x += odds_width + (h_padding // 3) # Use 1/3 padding for baseball games
else: else:
current_x += odds_width + h_padding current_x += odds_width + h_padding