ignore out of bounds renders
This commit is contained in:
1 parent
a823b45af9
commit
57ef56511c
3 files changed
+16
-8
No files matched your search
@@ -36,8 +36,15 @@ pub(crate) fn render_vnode(
|
||||
location.x += parent_location.x;
|
||||
location.y += parent_location.y;
|
||||
|
||||
let Point { x, y } = location;
|
||||
let Size { width, height } = size;
|
||||
let Point { mut x, mut y } = location;
|
||||
x = x.floor();
|
||||
y = y.floor();
|
||||
let Size {
|
||||
mut width,
|
||||
mut height,
|
||||
} = size;
|
||||
width = width.ceil();
|
||||
height = height.ceil();
|
||||
|
||||
match &node.node_data.node_type {
|
||||
NodeType::Text { text } => {
|
||||
@@ -62,7 +69,7 @@ pub(crate) fn render_vnode(
|
||||
text,
|
||||
style: node.state.style.core,
|
||||
};
|
||||
let area = Rect::new(x as u16, y as u16, *width as u16, *height as u16);
|
||||
let area = Rect::new(x as u16, y as u16, width as u16, height as u16);
|
||||
|
||||
// the renderer will panic if a node is rendered out of range even if the size is zero
|
||||
if area.width > 0 && area.height > 0 {
|
||||
@@ -70,7 +77,7 @@ pub(crate) fn render_vnode(
|
||||
}
|
||||
}
|
||||
NodeType::Element { .. } => {
|
||||
let area = Rect::new(x as u16, y as u16, *width as u16, *height as u16);
|
||||
let area = Rect::new(x as u16, y as u16, width as u16, height as u16);
|
||||
|
||||
// the renderer will panic if a node is rendered out of range even if the size is zero
|
||||
if area.width > 0 && area.height > 0 {
|
||||
|
||||
Reference in new issue
Block a user