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

Method add_item

src/elements/list.rs:75–96  ·  view source on GitHub ↗

offset_x: f32 = 0.0, offset_y: f32 = 0.0

(&self, item: &dyn Element, offset_x: f32, offset_y: f32)

Source from the content-addressed store, hash-verified

73
74 // offset_x: f32 = 0.0, offset_y: f32 = 0.0
75 pub fn add_item(&self, item: &dyn Element, offset_x: f32, offset_y: f32) {
76 let childbounds = &self.view.container.children_bounds();
77
78 item.set_y_local(item.y_local() + (childbounds.y_local + childbounds.h) + offset_y);
79 item.set_x_local(item.x_local() + offset_x);
80
81 self.view.add(item);
82
83 // item.mouse_input = true;
84 let mut items = self.items.borrow_mut();
85 items.push(item.id());
86
87 // item.onmouseup.listen(box |e| {
88 // // self.item_mouseup(e, item.id())
89 // });
90 // item.onmouseenter.listen(box |e| {
91 // // self.item_mouseenter(e, item.id())
92 // });
93 // item.onmouseleave.listen(box |e| {
94 // // self.item_mouseleave(e, item.id())
95 // });
96 }
97
98 fn item_mouseenter(&self, event: &MouseEvent, ctrl: Id) {
99 let items = self.items.borrow();

Callers

nothing calls this directly

Calls 8

children_boundsMethod · 0.80
set_y_localMethod · 0.80
y_localMethod · 0.80
set_x_localMethod · 0.80
x_localMethod · 0.80
pushMethod · 0.80
addMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected