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();
|
let mut scope = crate::render_scope::RenderScope::new();
|
||||||
scope.set_parent_transform(transform.clone());
|
scope.set_parent_transform(transform.clone());
|
||||||
|
|
||||||
|
transform.width = 0;
|
||||||
transform.height = 0;
|
transform.height = 0;
|
||||||
let mut renderer = DivRenderer(&mut transform);
|
let mut renderer = DivRenderer(&mut transform);
|
||||||
for widget in &self.children {
|
for widget in &self.children {
|
||||||
|
|||||||
@@ -176,6 +176,9 @@ impl RawTransform {
|
|||||||
let child_bottom = self.y + self.height;
|
let child_bottom = self.y + self.height;
|
||||||
let parent_bottom = parent.y + parent.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 child_bottom > parent_bottom {
|
||||||
if parent_bottom > self.y {
|
if parent_bottom > self.y {
|
||||||
self.height = parent_bottom - self.y;
|
self.height = parent_bottom - self.y;
|
||||||
@@ -183,6 +186,14 @@ impl RawTransform {
|
|||||||
self.height = 0;
|
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