| 531 | } |
| 532 | |
| 533 | fn relayout(&self, origin: Point2<f32>) { |
| 534 | let update_childs = match LayoutSystem::layout(self.node) { |
| 535 | Ok(layout) => { |
| 536 | let mut comp = self.as_ref().borrow_mut(); |
| 537 | comp.x = layout.location.x + origin.x; |
| 538 | comp.y = layout.location.y + origin.y; |
| 539 | comp.w = layout.size.width; |
| 540 | comp.h = layout.size.height; |
| 541 | |
| 542 | true |
| 543 | } |
| 544 | Err(e) => { |
| 545 | log::error!("{}", e); |
| 546 | false |
| 547 | } |
| 548 | }; |
| 549 | |
| 550 | if update_childs { |
| 551 | let comp = self.as_ref().borrow(); |
| 552 | |
| 553 | // there some magic with three column layout internals |
| 554 | // so lets just get layouts aobaout topline |
| 555 | let leading = LayoutSystem::layout(self.topline.leading).unwrap(); |
| 556 | let central = LayoutSystem::layout(self.topline.central).unwrap(); |
| 557 | let tail = LayoutSystem::layout(self.topline.tail).unwrap(); |
| 558 | |
| 559 | self.leading.relayout(Point2 { |
| 560 | x: comp.x + leading.location.x, |
| 561 | y: comp.y + tail.location.y, |
| 562 | }); |
| 563 | self.middle.relayout(Point2 { |
| 564 | x: comp.x + central.location.x, |
| 565 | y: comp.y + central.location.y, |
| 566 | }); |
| 567 | |
| 568 | let tail_origin = Point2 { |
| 569 | x: comp.x + tail.location.x, |
| 570 | y: comp.y + tail.location.y, |
| 571 | }; |
| 572 | |
| 573 | // for action in self.actions.iter() { |
| 574 | // action.relayout(tail_origin); |
| 575 | // } |
| 576 | |
| 577 | // flefible space is a middle line which should in other layout |
| 578 | // self.flexible_space.relayout(Point2 { |
| 579 | // x: comp.x + tail.location.x, |
| 580 | // y: comp.y + tail.location.y, |
| 581 | // }); |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | fn update(&self, dt: f32) { |
| 586 | log::info!("Update NavigationToolbar"); |