mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix scissor panics when window height is 1
This commit is contained in:
@ -708,10 +708,17 @@ impl IcedRenderer {
|
|||||||
}
|
}
|
||||||
.intersection(self.window_scissor);
|
.intersection(self.window_scissor);
|
||||||
|
|
||||||
if intersection.is_valid() {
|
if intersection.is_valid() && intersection.size().map(|s| s > 0).reduce_and() {
|
||||||
intersection
|
intersection
|
||||||
} else {
|
} else {
|
||||||
Aabr::new_empty(Vec2::zero())
|
// Create a aabr with width 1 and height 1, technically
|
||||||
|
// it would be more correct to do it with 0,0 but that's
|
||||||
|
// a validation error in wgpu so enjoy your funky pixel
|
||||||
|
// in the top left of your screen
|
||||||
|
Aabr {
|
||||||
|
min: Vec2::zero(),
|
||||||
|
max: Vec2::one(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Not expecting this case: new_scissor == current_scissor
|
// Not expecting this case: new_scissor == current_scissor
|
||||||
|
@ -283,7 +283,7 @@ impl Ui {
|
|||||||
pub fn handle_event(&mut self, event: Event) {
|
pub fn handle_event(&mut self, event: Event) {
|
||||||
match event.0 {
|
match event.0 {
|
||||||
Input::Resize(w, h) => {
|
Input::Resize(w, h) => {
|
||||||
if w > 1.0 && h > 1.0 {
|
if w > 0.0 && h > 0.0 {
|
||||||
self.window_resized = Some(Vec2::new(w, h))
|
self.window_resized = Some(Vec2::new(w, h))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -673,7 +673,7 @@ impl Ui {
|
|||||||
}
|
}
|
||||||
.intersection(window_scissor);
|
.intersection(window_scissor);
|
||||||
|
|
||||||
if intersection.is_valid() {
|
if intersection.is_valid() && intersection.size().map(|s| s > 0).reduce_and() {
|
||||||
intersection
|
intersection
|
||||||
} else {
|
} else {
|
||||||
// TODO: What should we return here
|
// TODO: What should we return here
|
||||||
|
Reference in New Issue
Block a user