| 478 | } |
| 479 | |
| 480 | fn relayout(&self, origin: Point2<f32>) { |
| 481 | let update_childs = match LayoutSystem::layout(self.node) { |
| 482 | Ok(layout) => { |
| 483 | let mut comp = self.as_ref().borrow_mut(); |
| 484 | comp.x = layout.location.x + origin.x; |
| 485 | comp.y = layout.location.y + origin.y; |
| 486 | comp.w = layout.size.width; |
| 487 | comp.h = layout.size.height; |
| 488 | |
| 489 | true |
| 490 | } |
| 491 | Err(e) => { |
| 492 | log::error!("{}", e); |
| 493 | false |
| 494 | } |
| 495 | }; |
| 496 | |
| 497 | if update_childs { |
| 498 | // self.leading.relayout(); |
| 499 | // self.title.relayout(); |
| 500 | // self.flexible_space.relayout(); |
| 501 | } |
| 502 | } |
| 503 | } |