move scale factors to constraints
Some checks failed
GDScript Auto-Formatting / Auto-Format GDScript Code (pull_request) Failing after 12s
GDScript Linting / GDScript Code Quality Check (pull_request) Failing after 11s

This commit is contained in:
2025-09-27 21:20:15 +04:00
parent 9b83bec37d
commit 77971497a4
5 changed files with 16 additions and 8 deletions

View File

@@ -170,9 +170,9 @@ func _update_visual_feedback() -> void:
var scale_multiplier: float var scale_multiplier: float
if is_selected: if is_selected:
# Selected: bright and 20% larger than original board size # Selected: bright and larger than original board size
target_modulate = Color(1.2, 1.2, 1.2, 1.0) target_modulate = Color(1.2, 1.2, 1.2, 1.0)
scale_multiplier = 1.2 scale_multiplier = UIConstants.TILE_SELECTED_SCALE
DebugManager.log_debug( DebugManager.log_debug(
( (
"SELECTING tile (%d,%d): target scale %.2fx, current scale %s" "SELECTING tile (%d,%d): target scale %.2fx, current scale %s"
@@ -181,9 +181,9 @@ func _update_visual_feedback() -> void:
"Match3" "Match3"
) )
elif is_highlighted: elif is_highlighted:
# Highlighted: subtle glow and 10% larger than original board size # Highlighted: subtle glow and larger than original board size
target_modulate = Color(1.1, 1.1, 1.1, 1.0) target_modulate = Color(1.1, 1.1, 1.1, 1.0)
scale_multiplier = 1.1 scale_multiplier = UIConstants.TILE_HIGHLIGHTED_SCALE
DebugManager.log_debug( DebugManager.log_debug(
( (
"HIGHLIGHTING tile (%d,%d): target scale %.2fx, current scale %s" "HIGHLIGHTING tile (%d,%d): target scale %.2fx, current scale %s"
@@ -194,7 +194,7 @@ func _update_visual_feedback() -> void:
else: else:
# Normal state: white and original board size # Normal state: white and original board size
target_modulate = Color.WHITE target_modulate = Color.WHITE
scale_multiplier = 1.0 scale_multiplier = UIConstants.TILE_NORMAL_SCALE
DebugManager.log_debug( DebugManager.log_debug(
( (
"NORMALIZING tile (%d,%d): target scale %.2fx, current scale %s" "NORMALIZING tile (%d,%d): target scale %.2fx, current scale %s"

View File

@@ -87,7 +87,7 @@ func _update_visual_selection() -> void:
for i in range(menu_buttons.size()): for i in range(menu_buttons.size()):
var button: Button = menu_buttons[i] var button: Button = menu_buttons[i]
if i == current_menu_index: if i == current_menu_index:
button.scale = original_button_scales[i] * 1.1 button.scale = original_button_scales[i] * UIConstants.BUTTON_HOVER_SCALE
button.modulate = Color(1.2, 1.2, 1.0) button.modulate = Color(1.2, 1.2, 1.0)
else: else:
button.scale = original_button_scales[i] button.scale = original_button_scales[i]

View File

@@ -212,7 +212,7 @@ func _update_visual_selection() -> void:
if control == language_stepper: if control == language_stepper:
language_stepper.set_highlighted(true) language_stepper.set_highlighted(true)
else: else:
control.scale = original_control_scales[i] * 1.05 control.scale = original_control_scales[i] * UIConstants.UI_CONTROL_HIGHLIGHT_SCALE
control.modulate = Color(1.1, 1.1, 0.9) control.modulate = Color(1.1, 1.1, 0.9)
else: else:
# Reset highlighting # Reset highlighting

View File

@@ -175,7 +175,7 @@ func set_current_value(value: String) -> void:
func set_highlighted(highlighted: bool) -> void: func set_highlighted(highlighted: bool) -> void:
is_highlighted = highlighted is_highlighted = highlighted
if highlighted: if highlighted:
scale = original_scale * 1.05 scale = original_scale * UIConstants.UI_CONTROL_HIGHLIGHT_SCALE
modulate = Color(1.1, 1.1, 0.9) modulate = Color(1.1, 1.1, 0.9)
else: else:
scale = original_scale scale = original_scale

View File

@@ -11,8 +11,16 @@ const MIN_RESOLUTION := Vector2i(720, 480)
# Animation constants # Animation constants
const FADE_DURATION := 0.3 const FADE_DURATION := 0.3
# Scale factor constants for consistent UI interactions
const BUTTON_HOVER_SCALE := 1.1 const BUTTON_HOVER_SCALE := 1.1
const BUTTON_PRESS_SCALE := 0.95 const BUTTON_PRESS_SCALE := 0.95
const UI_CONTROL_HIGHLIGHT_SCALE := 1.1
# Game-specific scale constants
const TILE_SELECTED_SCALE := 1.1
const TILE_HIGHLIGHTED_SCALE := 1.1
const TILE_NORMAL_SCALE := 1.0
# UI spacing constants # UI spacing constants
const UI_MARGIN := 20 const UI_MARGIN := 20