| 348 | } |
| 349 | |
| 350 | fn relayout(&self, origin: Point2<f32>) { |
| 351 | let update_childs = match LayoutSystem::layout(self.node) { |
| 352 | Ok(layout) => { |
| 353 | let mut comp = self.as_ref().borrow_mut(); |
| 354 | comp.x = layout.location.x + origin.x; |
| 355 | comp.y = layout.location.y + origin.y; |
| 356 | comp.w = layout.size.width; |
| 357 | comp.h = layout.size.height; |
| 358 | |
| 359 | true |
| 360 | } |
| 361 | Err(e) => { |
| 362 | log::error!("{}", e); |
| 363 | false |
| 364 | } |
| 365 | }; |
| 366 | |
| 367 | if update_childs { |
| 368 | // self.leading.relayout(); |
| 369 | // self.title.relayout(); |
| 370 | // self.flexible_space.relayout(); |
| 371 | } |
| 372 | } |
| 373 | } |