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
source§fn eq(&self, other: &ContactDeviceDescriptor) -> bool
fn eq(&self, other: &ContactDeviceDescriptor) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.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