pub struct ContactDeviceDescriptor {
pub x_range: Range,
pub y_range: Range,
pub x_unit: Unit,
pub y_unit: Unit,
pub pressure_range: Option<Range>,
pub width_range: Option<Range>,
pub height_range: Option<Range>,
}
Expand description
A ContactDeviceDescriptor
describes the possible values touch contact properties can take on.
This descriptor can be used, for example, to determine where on a screen a touch made contact.
§Example
// Determine the scaling factor between the display and the touch device's x range.
let scaling_factor =
display_width / (contact_descriptor._x_range.end - contact_descriptor._x_range.start);
// Use the scaling factor to scale the contact report's x position.
let hit_location =
scaling_factor * (contact_report.position_x - contact_descriptor._x_range.start);
Fields§
§x_range: Range
The range of possible x values for this touch contact.
y_range: Range
The range of possible y values for this touch contact.
x_unit: Unit
The unit of measure for x_range
.
y_unit: Unit
The unit of measure for y_range
.
pressure_range: Option<Range>
The range of possible pressure values for this touch contact.
width_range: Option<Range>
The range of possible widths for this touch contact.
height_range: Option<Range>
The range of possible heights for this touch contact.
Trait Implementations§
Source§impl Clone for ContactDeviceDescriptor
impl Clone for ContactDeviceDescriptor
Source§fn clone(&self) -> ContactDeviceDescriptor
fn clone(&self) -> ContactDeviceDescriptor
Returns a copy 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 ContactDeviceDescriptor
impl Debug for ContactDeviceDescriptor
Source§impl PartialEq for ContactDeviceDescriptor
impl PartialEq for ContactDeviceDescriptor
impl Eq for ContactDeviceDescriptor
impl StructuralPartialEq for ContactDeviceDescriptor
Auto Trait Implementations§
impl Freeze for ContactDeviceDescriptor
impl RefUnwindSafe for ContactDeviceDescriptor
impl Send for ContactDeviceDescriptor
impl Sync for ContactDeviceDescriptor
impl Unpin for ContactDeviceDescriptor
impl UnwindSafe for ContactDeviceDescriptor
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.