Skip to main content

GraphEditor

Struct GraphEditor 

Source
pub struct GraphEditor<'a, G: GraphAdapter> { /* private fields */ }
Expand description

A graph editor to render and manipulate a graph throw the GraphAdapter trait.

Implementations§

Source§

impl<'a, G: GraphAdapter> GraphEditor<'a, G>

Source

pub fn new(graph: G, id_source: impl Hash) -> Self

Creates a new GraphEditor.

Source§

impl<'a, G: GraphAdapter> GraphEditor<'a, G>

Source

pub fn look_at(self, pos: Pos) -> Self

Move the viewport to make pos on the center of the viewport.

Source

pub fn grid_stroke(self, stroke: impl Into<Stroke>) -> Self

The stroke used to render the background grid.

Use Stroke::NONE to disable the grid.

Source

pub fn view_aspect(self, view_aspect: f32) -> Self

width / height ratio of the editor region.

By default no fixed aspect ratio is set (and width/height will fill the ui it is in).

Source

pub fn width(self, width: f32) -> Self

Width of the editor. By default it will fill the ui it is in.

If you set Self::view_aspect, the width can be calculated from the height.

Source

pub fn height(self, height: f32) -> Self

Height of the editor. By default it will fill the ui it is in.

If you set Self::view_aspect, the height can be calculated from the width.

Source

pub fn connection_renderer( self, connection_renderer: impl Into<ConnectionRenderer>, ) -> Self

The ConnectionRenderer used to render the connections between sockets.

It can be one of the renderers defined in connection or a CustomConnectionRenderer.

Source

pub fn context_menu( self, add_contents: impl FnMut(&mut Ui, MenuContext<'_, G>) + 'a, ) -> Self

Defines a callback used to render the context menu of the editor.

See also Response::context_menu.

Source

pub fn node_context_menu( self, add_contents: impl FnMut(&mut Ui, NodeMenuContext<'_, G>) + 'a, ) -> Self

Defines a callback used to render the context menu of a node.

See also Response::context_menu.

Source

pub fn socket_context_menu( self, add_contents: impl FnMut(&mut Ui, SocketMenuContext<'_, G>) + 'a, ) -> Self

Defines a callback used to render the context menu of a sockets.

See also Response::context_menu.

Source§

impl<'a, G: GraphAdapter> GraphEditor<'a, G>

Source

pub fn show(self, ui: &mut Ui) -> GraphOutput

Show the graph editor.

Auto Trait Implementations§

§

impl<'a, G> !RefUnwindSafe for GraphEditor<'a, G>

§

impl<'a, G> !Send for GraphEditor<'a, G>

§

impl<'a, G> !Sync for GraphEditor<'a, G>

§

impl<'a, G> !UnwindSafe for GraphEditor<'a, G>

§

impl<'a, G> Freeze for GraphEditor<'a, G>
where G: Freeze, Option<Box<dyn FnMut(&mut Ui, MenuContext<'_, G>) + 'a>>: Freeze, Option<Box<dyn FnMut(&mut Ui, NodeMenuContext<'_, G>) + 'a>>: Freeze, Option<Box<dyn FnMut(&mut Ui, SocketMenuContext<'_, G>) + 'a>>: Freeze,

§

impl<'a, G> Unpin for GraphEditor<'a, G>
where G: Unpin, Option<Box<dyn FnMut(&mut Ui, MenuContext<'_, G>) + 'a>>: Unpin, Option<Box<dyn FnMut(&mut Ui, NodeMenuContext<'_, G>) + 'a>>: Unpin, Option<Box<dyn FnMut(&mut Ui, SocketMenuContext<'_, G>) + 'a>>: Unpin,

§

impl<'a, G> UnsafeUnpin for GraphEditor<'a, G>
where G: UnsafeUnpin, Option<Box<dyn FnMut(&mut Ui, MenuContext<'_, G>) + 'a>>: UnsafeUnpin, Option<Box<dyn FnMut(&mut Ui, NodeMenuContext<'_, G>) + 'a>>: UnsafeUnpin, Option<Box<dyn FnMut(&mut Ui, SocketMenuContext<'_, G>) + 'a>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.