Add per-Mount scrolling with shared paint and input clipping
Verify Tessera GUI / verify (push) Failing after 7m33s
Verify Tessera GUI / verify (push) Failing after 7m33s
This commit is contained in:
@@ -22,6 +22,8 @@ pub struct Input {
|
||||
pub point: Option<[f32; 2]>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub press_point: Option<[f32; 2]>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub delta: Option<[f32; 2]>,
|
||||
}
|
||||
|
||||
fn default_window() -> u64 {
|
||||
@@ -33,6 +35,24 @@ impl Input {
|
||||
if self.window == 0 {
|
||||
return Err("window identity must be nonzero");
|
||||
}
|
||||
if self.kind == "scroll" {
|
||||
return match (self.point, self.press_point, self.delta) {
|
||||
(Some(point), None, Some(delta))
|
||||
if point
|
||||
.iter()
|
||||
.all(|v| v.is_finite() && (0.0..=1_000_000.0).contains(v))
|
||||
&& delta
|
||||
.iter()
|
||||
.all(|v| v.is_finite() && v.abs() <= 1_000_000.0) =>
|
||||
{
|
||||
Ok(())
|
||||
}
|
||||
_ => Err("scroll requires point and finite delta, with no press_point"),
|
||||
};
|
||||
}
|
||||
if self.delta.is_some() {
|
||||
return Err("delta is only accepted for scroll input");
|
||||
}
|
||||
match (self.point, self.press_point) {
|
||||
(None, None) => Ok(()),
|
||||
(Some(point), Some(press))
|
||||
|
||||
Reference in New Issue
Block a user