| 216 | } |
| 217 | |
| 218 | fn relayout(&self, origin: Point2<f32>) { |
| 219 | let update_childs = match LayoutSystem::layout(self.node) { |
| 220 | Ok(layout) => { |
| 221 | let mut comp = self.as_ref().borrow_mut(); |
| 222 | comp.x = layout.location.x + origin.x; |
| 223 | comp.y = layout.location.y + origin.y; |
| 224 | comp.w = layout.size.width; |
| 225 | comp.h = layout.size.height; |
| 226 | |
| 227 | true |
| 228 | } |
| 229 | Err(e) => { |
| 230 | log::error!("{}", e); |
| 231 | false |
| 232 | } |
| 233 | }; |
| 234 | |
| 235 | if update_childs { |
| 236 | // self.leading.relayout(); |
| 237 | // self.title.relayout(); |
| 238 | // self.flexible_space.relayout(); |
| 239 | } |
| 240 | } |
| 241 | } |