| 324 | } |
| 325 | |
| 326 | fn relayout(&self, origin: Point2<f32>) { |
| 327 | let update_childs = match LayoutSystem::layout(self.node) { |
| 328 | Ok(layout) => { |
| 329 | let mut comp = self.as_ref().borrow_mut(); |
| 330 | comp.x = layout.location.x + origin.x; |
| 331 | comp.y = layout.location.y + origin.y; |
| 332 | comp.w = layout.size.width; |
| 333 | comp.h = layout.size.height; |
| 334 | |
| 335 | true |
| 336 | } |
| 337 | Err(e) => { |
| 338 | log::error!("{}", e); |
| 339 | false |
| 340 | } |
| 341 | }; |
| 342 | |
| 343 | if update_childs { |
| 344 | // self.leading.relayout(); |
| 345 | // self.title.relayout(); |
| 346 | // self.flexible_space.relayout(); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | fn update(&self, dt: f32) { |
| 351 | log::info!("Update AlignElement"); |