refactor(engine): deduplicate TABLEAU_FAN_FRAC constant (#59)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -27,7 +27,7 @@ use crate::card_animation::CardAnimation;
|
|||||||
use crate::events::{CardFaceRevealedEvent, CardFlippedEvent, StateChangedEvent};
|
use crate::events::{CardFaceRevealedEvent, CardFlippedEvent, StateChangedEvent};
|
||||||
use crate::font_plugin::FontResource;
|
use crate::font_plugin::FontResource;
|
||||||
use crate::game_plugin::GameMutation;
|
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::pause_plugin::PausedResource;
|
||||||
use crate::platform::USE_TOUCH_UI_LAYOUT;
|
use crate::platform::USE_TOUCH_UI_LAYOUT;
|
||||||
use crate::resources::{DragState, GameStateResource};
|
use crate::resources::{DragState, GameStateResource};
|
||||||
@@ -40,11 +40,6 @@ use crate::ui_theme::{
|
|||||||
TYPE_BODY, Z_STOCK_BADGE,
|
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
|
/// Per-card vertical step for face-down tableau cards, as a fraction of
|
||||||
/// card height. Smaller than [`TABLEAU_FAN_FRAC`] because face-down cards
|
/// card height. Smaller than [`TABLEAU_FAN_FRAC`] because face-down cards
|
||||||
/// don't need their full body shown — only the back-pattern strip is
|
/// don't need their full body shown — only the back-pattern strip is
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ const VERTICAL_GAP_FRAC: f32 = 0.2;
|
|||||||
/// column must fit at this fraction). On desktop (height-limited) windows the
|
/// column must fit at this fraction). On desktop (height-limited) windows the
|
||||||
/// adaptive computation returns this value exactly; on portrait phones it
|
/// adaptive computation returns this value exactly; on portrait phones it
|
||||||
/// expands to fill available vertical space.
|
/// 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
|
/// Minimum fraction for face-down tableau cards. Scales proportionally with
|
||||||
/// the adaptive face-up fraction so hit-testing and rendering stay in sync.
|
/// the adaptive face-up fraction so hit-testing and rendering stay in sync.
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ use solitaire_core::game_state::GameState;
|
|||||||
use solitaire_core::pile::PileType;
|
use solitaire_core::pile::PileType;
|
||||||
use solitaire_core::rules::{can_place_on_foundation, can_place_on_tableau};
|
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::events::MoveRequestEvent;
|
||||||
use crate::layout::{Layout, LayoutResource};
|
use crate::layout::{Layout, LayoutResource, TABLEAU_FAN_FRAC};
|
||||||
use crate::pause_plugin::PausedResource;
|
use crate::pause_plugin::PausedResource;
|
||||||
use crate::resources::{DragState, GameStateResource};
|
use crate::resources::{DragState, GameStateResource};
|
||||||
use crate::settings_plugin::SettingsResource;
|
use crate::settings_plugin::SettingsResource;
|
||||||
|
|||||||
Reference in New Issue
Block a user