Even width and height comparisons
This commit is contained in:
@@ -49,6 +49,7 @@ impl Element for Div {
|
||||
let mut scope = crate::render_scope::RenderScope::new();
|
||||
scope.set_parent_transform(transform.clone());
|
||||
|
||||
transform.width = 0;
|
||||
transform.height = 0;
|
||||
let mut renderer = DivRenderer(&mut transform);
|
||||
for widget in &self.children {
|
||||
|
||||
@@ -176,6 +176,9 @@ impl RawTransform {
|
||||
let child_bottom = self.y + self.height;
|
||||
let parent_bottom = parent.y + parent.height;
|
||||
|
||||
let child_right = self.x + self.width;
|
||||
let parent_right = parent.x + parent.width;
|
||||
|
||||
if child_bottom > parent_bottom {
|
||||
if parent_bottom > self.y {
|
||||
self.height = parent_bottom - self.y;
|
||||
@@ -183,6 +186,14 @@ impl RawTransform {
|
||||
self.height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if child_right > parent_right {
|
||||
if parent_right > self.x {
|
||||
self.width = parent_right - self.x;
|
||||
} else {
|
||||
self.width = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user