pub struct FlowCanvas {
pub graph: Graph,
pub history: History,
pub event_queue: Vec<FlowEvent>,
/* private fields */
}Fields§
§graph: Graph§history: History§event_queue: Vec<FlowEvent>Implementations§
Source§impl FlowCanvas
impl FlowCanvas
Sourcepub fn new(graph: Graph, cx: &mut Context<'_, Self>) -> Self
pub fn new(graph: Graph, cx: &mut Context<'_, Self>) -> Self
Examples found in repository?
examples/extension.rs (line 26)
7fn main() {
8 Application::new().run(|cx| {
9 let mut graph = Graph::new();
10
11 graph
12 .create_node("number")
13 .position(100.0, 100.0)
14 .size(300.0, 150.0)
15 .output()
16 .build(&mut graph);
17
18 graph
19 .create_node("")
20 .position(300.0, 400.0)
21 .input()
22 .build(&mut graph);
23
24 cx.open_window(WindowOptions::default(), |_, cx| {
25 cx.new(|fc| {
26 let mut flow = FlowCanvas::new(graph, fc)
27 .plugin(SelectionPlugin::new())
28 .plugin(NodeInteractionPlugin::new())
29 .plugin(ViewportPlugin::new())
30 .plugin(Background::new())
31 .plugin(NodePlugin::new().register_node("number", NumberNode {}));
32 flow.init_plugins();
33 flow
34 })
35 })
36 .unwrap();
37 });
38}More examples
examples/bench.rs (line 21)
4fn main() {
5 Application::new().run(|cx| {
6 let mut graph = Graph::new();
7
8 for j in 0..100 {
9 for i in 0..100 {
10 graph
11 .create_node("")
12 .position(200.0 * i as f32, 200.0 * j as f32)
13 .input()
14 .output()
15 .build(&mut graph);
16 }
17 }
18
19 cx.open_window(WindowOptions::default(), |_, cx| {
20 cx.new(|fc| {
21 let mut flow = FlowCanvas::new(graph, fc)
22 .plugin(SelectionPlugin::new())
23 .plugin(NodeInteractionPlugin::new())
24 .plugin(ViewportPlugin::new())
25 .plugin(Background::new())
26 .plugin(NodePlugin::new())
27 .plugin(PortInteractionPlugin::new())
28 .plugin(EdgePlugin::new())
29 .plugin(DeletePlugin::new())
30 .plugin(HistoryPlugin::new());
31 flow.init_plugins();
32 flow
33 })
34 })
35 .unwrap();
36 });
37}examples/basic.rs (line 30)
4fn main() {
5 Application::new().run(|cx| {
6 let mut graph = Graph::new();
7
8 graph
9 .create_node("")
10 .position(100.0, 100.0)
11 .output()
12 .build(&mut graph);
13
14 graph
15 .create_node("")
16 .position(300.0, 400.0)
17 .input()
18 .output()
19 .build(&mut graph);
20
21 graph
22 .create_node("")
23 .position(500.0, 500.0)
24 .input()
25 .output()
26 .build(&mut graph);
27
28 cx.open_window(WindowOptions::default(), |_, cx| {
29 cx.new(|fc| {
30 let mut flow = FlowCanvas::new(graph, fc)
31 .plugin(SelectionPlugin::new())
32 .plugin(NodeInteractionPlugin::new())
33 .plugin(ViewportPlugin::new())
34 .plugin(Background::new())
35 .plugin(NodePlugin::new())
36 .plugin(PortInteractionPlugin::new())
37 .plugin(EdgePlugin::new())
38 .plugin(DeletePlugin::new())
39 .plugin(HistoryPlugin::new());
40 flow.init_plugins();
41 flow
42 })
43 })
44 .unwrap();
45 });
46}Sourcepub fn plugin(self, plugin: impl Plugin + 'static) -> Self
pub fn plugin(self, plugin: impl Plugin + 'static) -> Self
Examples found in repository?
examples/extension.rs (line 27)
7fn main() {
8 Application::new().run(|cx| {
9 let mut graph = Graph::new();
10
11 graph
12 .create_node("number")
13 .position(100.0, 100.0)
14 .size(300.0, 150.0)
15 .output()
16 .build(&mut graph);
17
18 graph
19 .create_node("")
20 .position(300.0, 400.0)
21 .input()
22 .build(&mut graph);
23
24 cx.open_window(WindowOptions::default(), |_, cx| {
25 cx.new(|fc| {
26 let mut flow = FlowCanvas::new(graph, fc)
27 .plugin(SelectionPlugin::new())
28 .plugin(NodeInteractionPlugin::new())
29 .plugin(ViewportPlugin::new())
30 .plugin(Background::new())
31 .plugin(NodePlugin::new().register_node("number", NumberNode {}));
32 flow.init_plugins();
33 flow
34 })
35 })
36 .unwrap();
37 });
38}More examples
examples/bench.rs (line 22)
4fn main() {
5 Application::new().run(|cx| {
6 let mut graph = Graph::new();
7
8 for j in 0..100 {
9 for i in 0..100 {
10 graph
11 .create_node("")
12 .position(200.0 * i as f32, 200.0 * j as f32)
13 .input()
14 .output()
15 .build(&mut graph);
16 }
17 }
18
19 cx.open_window(WindowOptions::default(), |_, cx| {
20 cx.new(|fc| {
21 let mut flow = FlowCanvas::new(graph, fc)
22 .plugin(SelectionPlugin::new())
23 .plugin(NodeInteractionPlugin::new())
24 .plugin(ViewportPlugin::new())
25 .plugin(Background::new())
26 .plugin(NodePlugin::new())
27 .plugin(PortInteractionPlugin::new())
28 .plugin(EdgePlugin::new())
29 .plugin(DeletePlugin::new())
30 .plugin(HistoryPlugin::new());
31 flow.init_plugins();
32 flow
33 })
34 })
35 .unwrap();
36 });
37}examples/basic.rs (line 31)
4fn main() {
5 Application::new().run(|cx| {
6 let mut graph = Graph::new();
7
8 graph
9 .create_node("")
10 .position(100.0, 100.0)
11 .output()
12 .build(&mut graph);
13
14 graph
15 .create_node("")
16 .position(300.0, 400.0)
17 .input()
18 .output()
19 .build(&mut graph);
20
21 graph
22 .create_node("")
23 .position(500.0, 500.0)
24 .input()
25 .output()
26 .build(&mut graph);
27
28 cx.open_window(WindowOptions::default(), |_, cx| {
29 cx.new(|fc| {
30 let mut flow = FlowCanvas::new(graph, fc)
31 .plugin(SelectionPlugin::new())
32 .plugin(NodeInteractionPlugin::new())
33 .plugin(ViewportPlugin::new())
34 .plugin(Background::new())
35 .plugin(NodePlugin::new())
36 .plugin(PortInteractionPlugin::new())
37 .plugin(EdgePlugin::new())
38 .plugin(DeletePlugin::new())
39 .plugin(HistoryPlugin::new());
40 flow.init_plugins();
41 flow
42 })
43 })
44 .unwrap();
45 });
46}Sourcepub fn init_plugins(&mut self)
pub fn init_plugins(&mut self)
Examples found in repository?
examples/extension.rs (line 32)
7fn main() {
8 Application::new().run(|cx| {
9 let mut graph = Graph::new();
10
11 graph
12 .create_node("number")
13 .position(100.0, 100.0)
14 .size(300.0, 150.0)
15 .output()
16 .build(&mut graph);
17
18 graph
19 .create_node("")
20 .position(300.0, 400.0)
21 .input()
22 .build(&mut graph);
23
24 cx.open_window(WindowOptions::default(), |_, cx| {
25 cx.new(|fc| {
26 let mut flow = FlowCanvas::new(graph, fc)
27 .plugin(SelectionPlugin::new())
28 .plugin(NodeInteractionPlugin::new())
29 .plugin(ViewportPlugin::new())
30 .plugin(Background::new())
31 .plugin(NodePlugin::new().register_node("number", NumberNode {}));
32 flow.init_plugins();
33 flow
34 })
35 })
36 .unwrap();
37 });
38}More examples
examples/bench.rs (line 31)
4fn main() {
5 Application::new().run(|cx| {
6 let mut graph = Graph::new();
7
8 for j in 0..100 {
9 for i in 0..100 {
10 graph
11 .create_node("")
12 .position(200.0 * i as f32, 200.0 * j as f32)
13 .input()
14 .output()
15 .build(&mut graph);
16 }
17 }
18
19 cx.open_window(WindowOptions::default(), |_, cx| {
20 cx.new(|fc| {
21 let mut flow = FlowCanvas::new(graph, fc)
22 .plugin(SelectionPlugin::new())
23 .plugin(NodeInteractionPlugin::new())
24 .plugin(ViewportPlugin::new())
25 .plugin(Background::new())
26 .plugin(NodePlugin::new())
27 .plugin(PortInteractionPlugin::new())
28 .plugin(EdgePlugin::new())
29 .plugin(DeletePlugin::new())
30 .plugin(HistoryPlugin::new());
31 flow.init_plugins();
32 flow
33 })
34 })
35 .unwrap();
36 });
37}examples/basic.rs (line 40)
4fn main() {
5 Application::new().run(|cx| {
6 let mut graph = Graph::new();
7
8 graph
9 .create_node("")
10 .position(100.0, 100.0)
11 .output()
12 .build(&mut graph);
13
14 graph
15 .create_node("")
16 .position(300.0, 400.0)
17 .input()
18 .output()
19 .build(&mut graph);
20
21 graph
22 .create_node("")
23 .position(500.0, 500.0)
24 .input()
25 .output()
26 .build(&mut graph);
27
28 cx.open_window(WindowOptions::default(), |_, cx| {
29 cx.new(|fc| {
30 let mut flow = FlowCanvas::new(graph, fc)
31 .plugin(SelectionPlugin::new())
32 .plugin(NodeInteractionPlugin::new())
33 .plugin(ViewportPlugin::new())
34 .plugin(Background::new())
35 .plugin(NodePlugin::new())
36 .plugin(PortInteractionPlugin::new())
37 .plugin(EdgePlugin::new())
38 .plugin(DeletePlugin::new())
39 .plugin(HistoryPlugin::new());
40 flow.init_plugins();
41 flow
42 })
43 })
44 .unwrap();
45 });
46}pub fn handle_event(&mut self, event: FlowEvent, cx: &mut Context<'_, Self>)
Trait Implementations§
Source§impl Render for FlowCanvas
impl Render for FlowCanvas
Auto Trait Implementations§
impl Freeze for FlowCanvas
impl !RefUnwindSafe for FlowCanvas
impl !Send for FlowCanvas
impl !Sync for FlowCanvas
impl Unpin for FlowCanvas
impl UnsafeUnpin for FlowCanvas
impl !UnwindSafe for FlowCanvas
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more