Add components example

Re-arrange generics on mouse event handler
Add TypeTag struct for dynamically tagged components
This commit is contained in:
Mikayla 2023-08-15 03:06:43 -07:00
parent 5ce7ccac32
commit e5eed29c72
No known key found for this signature in database
49 changed files with 585 additions and 155 deletions

View file

@ -19,7 +19,7 @@ pub fn dragged_item_receiver<Tag, D, F>(
split_margin: Option<f32>,
cx: &mut ViewContext<Pane>,
render_child: F,
) -> MouseEventHandler<Tag, Pane>
) -> MouseEventHandler<Pane>
where
Tag: 'static,
D: Element<Pane>,
@ -39,7 +39,7 @@ where
None
};
let mut handler = MouseEventHandler::<Tag, _>::above(region_id, cx, |state, cx| {
let mut handler = MouseEventHandler::above::<Tag, _>(region_id, cx, |state, cx| {
// Observing hovered will cause a render when the mouse enters regardless
// of if mouse position was accessed before
let drag_position = if state.hovered() { drag_position } else { None };