feat(engine,data): add tap-to-select touch input mode (#70)

- Add TouchInputMode enum (OneTap | TapToSelect) to solitaire_data settings
- Create TouchSelectionPlugin with TouchSelectionState resource and highlight
- Branch handle_double_tap: OneTap → existing auto-move, TapToSelect → two-tap flow
- Add Settings UI toggle row (Touch Input Mode) with TouchInputModeText marker
- Register TouchSelectionPlugin in CoreGamePlugin

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
funman300
2026-05-28 14:04:40 -07:00
parent 6e407a3ea7
commit 927598202e
6 changed files with 361 additions and 8 deletions
+23
View File
@@ -62,6 +62,21 @@ pub enum SyncBackend {
},
}
/// Touch input mode — controls what a single tap on a face-up card does.
///
/// Defaults to `OneTap` so existing behaviour is unchanged on upgrade.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
pub enum TouchInputMode {
/// A single tap immediately moves the card to its best destination
/// (foundation-first, then tableau). This is the original behaviour.
#[default]
OneTap,
/// A first tap *selects* the card/stack and highlights it; a second
/// tap on a valid destination pile performs the move. Tapping the
/// selection again, or an empty / invalid target, cancels without moving.
TapToSelect,
}
/// Persisted window size (in logical pixels) and screen position
/// (top-left corner, in physical pixels) — restored on next launch.
///
@@ -264,6 +279,13 @@ pub struct Settings {
/// Defaults to `1` (the first site created in a fresh Matomo install).
#[serde(default = "default_matomo_site_id")]
pub matomo_site_id: u32,
/// Touch input mode — `OneTap` (default) auto-moves on first tap;
/// `TapToSelect` requires an explicit destination tap. Only affects
/// touch/Android; desktop mouse input is unchanged. Older
/// `settings.json` files deserialize cleanly to `OneTap` via
/// `#[serde(default)]`.
#[serde(default)]
pub touch_input_mode: TouchInputMode,
}
fn default_draw_mode() -> DrawMode {
@@ -397,6 +419,7 @@ impl Default for Settings {
analytics_enabled: false,
matomo_url: None,
matomo_site_id: default_matomo_site_id(),
touch_input_mode: TouchInputMode::OneTap,
}
}
}