refactor(engine): deduplicate TABLEAU_FAN_FRAC constant (#59)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
funman300
2026-05-27 19:57:49 -07:00
parent 0437c36463
commit dbe728fef7
3 changed files with 4 additions and 9 deletions
+1 -6
View File
@@ -27,7 +27,7 @@ use crate::card_animation::CardAnimation;
use crate::events::{CardFaceRevealedEvent, CardFlippedEvent, StateChangedEvent};
use crate::font_plugin::FontResource;
use crate::game_plugin::GameMutation;
use crate::layout::{Layout, LayoutResource, LayoutSystem};
use crate::layout::{Layout, LayoutResource, LayoutSystem, TABLEAU_FAN_FRAC};
use crate::pause_plugin::PausedResource;
use crate::platform::USE_TOUCH_UI_LAYOUT;
use crate::resources::{DragState, GameStateResource};
@@ -40,11 +40,6 @@ use crate::ui_theme::{
TYPE_BODY, Z_STOCK_BADGE,
};
/// Fraction of card height used as vertical offset between face-up tableau cards.
/// Must match `layout::TABLEAU_FAN_FRAC` so the initial layout and the first
/// dynamic update from `update_tableau_fan_frac` produce identical spacing.
pub const TABLEAU_FAN_FRAC: f32 = 0.18;
/// Per-card vertical step for face-down tableau cards, as a fraction of
/// card height. Smaller than [`TABLEAU_FAN_FRAC`] because face-down cards
/// don't need their full body shown — only the back-pattern strip is
+1 -1
View File
@@ -75,7 +75,7 @@ const VERTICAL_GAP_FRAC: f32 = 0.2;
/// column must fit at this fraction). On desktop (height-limited) windows the
/// adaptive computation returns this value exactly; on portrait phones it
/// expands to fill available vertical space.
const TABLEAU_FAN_FRAC: f32 = 0.18;
pub const TABLEAU_FAN_FRAC: f32 = 0.18;
/// Minimum fraction for face-down tableau cards. Scales proportionally with
/// the adaptive face-up fraction so hit-testing and rendering stay in sync.
+2 -2
View File
@@ -52,9 +52,9 @@ use solitaire_core::game_state::GameState;
use solitaire_core::pile::PileType;
use solitaire_core::rules::{can_place_on_foundation, can_place_on_tableau};
use crate::card_plugin::{TABLEAU_FACEDOWN_FAN_FRAC, TABLEAU_FAN_FRAC};
use crate::card_plugin::TABLEAU_FACEDOWN_FAN_FRAC;
use crate::events::MoveRequestEvent;
use crate::layout::{Layout, LayoutResource};
use crate::layout::{Layout, LayoutResource, TABLEAU_FAN_FRAC};
use crate::pause_plugin::PausedResource;
use crate::resources::{DragState, GameStateResource};
use crate::settings_plugin::SettingsResource;