tiling: Crop input region to tile

This commit is contained in:
Victoria Brekenfeld 2023-05-30 16:22:29 +02:00
parent 954843bc43
commit 9531b3798e
2 changed files with 37 additions and 25 deletions

View file

@ -202,11 +202,16 @@ impl Workspace {
.space
.element_under(location)
.or_else(|| {
self.tiling_layer.mapped().find_map(|(_, mapped, loc)| {
let test_point = location - loc.to_f64() + mapped.geometry().loc.to_f64();
mapped
.is_in_input_region(&test_point)
.then_some((mapped, loc - mapped.geometry().loc))
self.tiling_layer.mapped().find_map(|(_, mapped, geo)| {
geo.contains(location.to_i32_round())
.then(|| {
let test_point =
location - geo.loc.to_f64() + mapped.geometry().loc.to_f64();
mapped
.is_in_input_region(&test_point)
.then_some((mapped, geo.loc - mapped.geometry().loc))
})
.flatten()
})
})
}