pub struct TouchLayoutDiagnostics {
pub out_of_bounds: [bool; 16],
pub overlaps: [[bool; 16]; 16],
}Expand description
Bounded diagnostics for an already resolved layout, indexed by authored slot.
Unused slots and the overlap diagonal are false. Overlaps are symmetric and include look regions: an intentional background look region can overlap a button, but layout order still determines which control captures a finger. Touching edges count as overlaps because touch hit tests include boundaries. No controls are moved, removed or reordered by diagnostics.
use ferravex_math::{Rect, Vec2};
use ferravex_play::input::touch::{Control, Output, Region, TouchLayoutSettings};
let controls = [Control {
region: Region::Rect(Rect::new(0., 0., 60., 60.)),
output: Output::Button(0),
}; 2];
let report = TouchLayoutSettings::diagnose_layout(
&controls, Vec2::splat(200.), Rect::new(10., 10., 180., 180.),
)?;
assert!(report.out_of_bounds[0]);
assert!(report.overlaps[0][1] && report.overlaps[1][0]);
assert!(!report.is_clear());Fields§
§out_of_bounds: [bool; 16]True when any part of a control’s hit region lies outside the safe area.
overlaps: [[bool; 16]; 16]True when two distinct controls share any point in their hit regions.
Implementations§
Trait Implementations§
Source§impl Clone for TouchLayoutDiagnostics
impl Clone for TouchLayoutDiagnostics
Source§fn clone(&self) -> TouchLayoutDiagnostics
fn clone(&self) -> TouchLayoutDiagnostics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TouchLayoutDiagnostics
impl Debug for TouchLayoutDiagnostics
Source§impl Default for TouchLayoutDiagnostics
impl Default for TouchLayoutDiagnostics
Source§fn default() -> TouchLayoutDiagnostics
fn default() -> TouchLayoutDiagnostics
Returns the “default value” for a type. Read more
Source§impl PartialEq for TouchLayoutDiagnostics
impl PartialEq for TouchLayoutDiagnostics
impl Copy for TouchLayoutDiagnostics
impl Eq for TouchLayoutDiagnostics
impl StructuralPartialEq for TouchLayoutDiagnostics
Auto Trait Implementations§
impl Freeze for TouchLayoutDiagnostics
impl RefUnwindSafe for TouchLayoutDiagnostics
impl Send for TouchLayoutDiagnostics
impl Sync for TouchLayoutDiagnostics
impl Unpin for TouchLayoutDiagnostics
impl UnwindSafe for TouchLayoutDiagnostics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more