MCPcopy Create free account
hub / github.com/angular-rust/ux-components / set_size

Method set_size

src/elements/material_app.rs:393–439  ·  view source on GitHub ↗
(&self, w: f32, h: f32)

Source from the content-addressed store, hash-verified

391 }
392
393 fn set_size(&self, w: f32, h: f32) {
394 log::info!("Set Size MaterialAppElement {}x{}", w, h);
395
396 // let (dw, dh) = {
397 // let mut comp = self.as_ref().borrow_mut();
398
399 // assert!(
400 // !comp.destroyed,
401 // "Widget was already destroyed but is being interacted with"
402 // );
403
404 // comp.updating = true;
405
406 // // we calculate here delta from prev size to emit this value
407 // // and relayout childs
408 // let dw = w - comp.w;
409 // let dh = h - comp.h;
410
411 // comp.w = w;
412 // comp.h = h;
413
414 // comp.updating = false;
415
416 // (dw, dh)
417 // };
418
419 // self.bounds_changed(0.0, 0.0, dw, dh);
420
421 // just compute layout, update size and relayout whole widget tree
422 {
423 let mut comp = self.as_ref().borrow_mut();
424 comp.w = w;
425 comp.h = h;
426 }
427
428 let _ = LayoutSystem::compute_layout(
429 self.node,
430 geometry::Size {
431 width: number::Number::Defined(w),
432 height: number::Number::Defined(h),
433 },
434 );
435
436 // println!("{:#?}", LayoutSystem::layout(self.node).unwrap());
437
438 self.relayout(Point2 { x: 0.0, y: 0.0 });
439 }
440
441 fn relayout(&self, origin: Point2<f32>) {
442 let update_childs = match LayoutSystem::layout(self.node) {

Callers

nothing calls this directly

Calls 2

as_refMethod · 0.45
relayoutMethod · 0.45

Tested by

no test coverage detected