Conversation
philpax
left a comment
There was a problem hiding this comment.
Great work! I need to test it, but keen to see if it works :)
| hooks.use_frame({ | ||
| to_owned![id, mouse_over_count]; | ||
| move |world| { | ||
| if let Some(id) = *id.lock() { |
There was a problem hiding this comment.
suggest let Some(id) = *id.lock() else { return; } to cut one layer of indentation
| Self { inner } | ||
| } | ||
| } | ||
| impl ElementComponent for DragArea { |
There was a problem hiding this comment.
suggest using the #[element_component] macro
| // if *state > 0 && next == 0 { | ||
| // // println!("mouse leave"); | ||
| // ambient_guest_bridge::window::set_cursor(world, CursorIcon::Default); | ||
| // } |
| hooks.use_runtime_message::<messages::WindowMouseInput>({ | ||
| to_owned![id, mouse_over_count, set_moving]; | ||
| move |world, event| { | ||
| if let Some(id) = *id.lock() { |
| } | ||
|
|
||
| let ltw = world.get(*to_id, local_to_world()).unwrap(); | ||
| let (_, _, new_to_pos) = Mat4::to_scale_rotation_translation(<w); |
There was a problem hiding this comment.
Can you use translation() for this, or is that not updated for UI code?
There was a problem hiding this comment.
I used translation() before but this will require its parent's translation() as well. The DragArea is the parent while the main body and the dots are children.
| println!("no start id"); | ||
| } | ||
| } else { | ||
| println!("dropped to none inlet"); |
| } | ||
|
|
||
| for id in in_id.lock().iter() { | ||
| if !event.pressed && event.button == 0 { |
There was a problem hiding this comment.
invert condition and use continue to remove indentation
| nodes | ||
| .iter() | ||
| .map(move |node| { | ||
| println!("node: {:?}", node); |
|
|
||
| #[element_component] | ||
| fn App(_hooks: &mut Hooks) -> Element { | ||
| Graph::el() |
There was a problem hiding this comment.
What does this Graph spawn? Or is it an empty graph?
There was a problem hiding this comment.
Additionally, how do you interact with the graph and get values out of it?
There was a problem hiding this comment.
Might be a good idea to e.g. make a calculator using this, so you can see how it works
There was a problem hiding this comment.
Additionally, how do you interact with the graph and get values out of it?
Good question. I haven't got any idea yet on how to store the data structure. Still drafting this
There was a problem hiding this comment.
What does this
Graphspawn? Or is it an empty graph?
It's just temporary. Might be good to change it to GraphEditor or something else, and perhaps this whole thing should be put into the editor folder.
|
|
||
| #[element_component] | ||
| /// A Graph Element that you can put lots of nodes | ||
| pub fn Graph(hooks: &mut Hooks) -> Element { |
2023-07-06.13-39-27.mp4