NodeEditor
A graph of nodes with ports, connected by wires. Dragging a node moves it with the other selected nodes, dragging from an output draws a wire that connects to the input it is released on, dragging a wire off an input detaches it; an input has one wire at most. A click selects a node, with shift more; dragging on the background selects the nodes in the box, and delete removes the selected nodes. The wheel zooms around the pointer, dragging with the middle button or with alt pans. The changes can be undone, see org.openrndr.panel.History. Nodes are drawn in the colors of the style of the editor, the selected ones and wires in that of accent, ports and their wires in portColor.
Every change of nodes and wires fires an event, also those of undo and redo and those of the host: Events.added and Events.removed for nodes, Events.connected and Events.disconnected for wires, Events.moved for moves, so a model can follow the editor by its events alone.
Properties
the attributes of the element, which attribute selectors like [label="OK"] select, see setAttribute
the badges of a node, drawn next to each other on its top right corner, at the same size at every zoom, and over the nodes; a press on a badge neither selects nor moves the node, a click fires Events.badgeClicked. Call requestRedraw when the badges change
true when a wire can go from output to input, by default when their types are the same or either has none
true when the nodes whose GraphNode.compact is null are drawn compact
builds the menu that opens when the element is clicked with the right button, null for none
The radius of the corners of this in pixels, of its org.openrndr.panel.style.borderRadius: in pixels, or a percentage of its shorter side; at most half of it
what the element does in drag and drop, see DragAndDrop
the distance from the edges, in pixels, within which a drag pans the view
how fast the view pans, in pixels per second, with the pointer at an edge; it pans faster further past it
the history of the control manager of this element, null when it is not in one
the color of the outlines of the nodes that are highlighted, see highlightUpstream and highlightDownstream
true when hovering over an output highlights its downstream: the wires and nodes it leads to, through all outputs
the nodes and wires that are highlighted now, empty when nothing is
true when hovering over an input highlights its upstream: the wires and nodes that lead to it, through all inputs
an offset of the element from where it is laid out, while it moves there, see org.openrndr.panel.animateMoveFrom
false for elements that place their children themselves, like the spans of RichText
The largest scrollLeft: how far the content of the element extends beyond its right side, as found by the last layout.
The largest scrollTop: how far the content of the element extends beyond its bottom, as found by the last layout.
The transform of the element itself, in the coordinates of the window, around its transform origin; null when it has none
The area the element draws in, on the screen: its box and what is drawn around it, like knobs, focus rings and outlines. Only the areas of the elements that changed are drawn again, a control that draws further than this gives a larger area.
Records an edit of this element, named name, in the history so that it can be undone and redone, by default in org.openrndr.panel.editHistory. A program can take this over, like to wrap undo and redo so that they leave alone what others changed since, or to keep the edits in a history of its own.
the transform of the element by its own transform and those of its ancestors, null when there are none
how far the content of an element that scrolls is scrolled to the left, in pixels
where the content is scrolled to: the end of smooth scrolling, or the scroll position
Where text is typed in this element while it has the focus: the line of the caret, in the coordinates of the window, with the caret from its left edge. The control manager gives it to the window, so that input methods place their candidates and on-screen keyboards next to the caret; null for elements that do not take text.
the bindings of values of the element, checked every frame, see org.openrndr.panel.binding.bindValue
the points, in the coordinates of the graph, that a wire goes through on its way from its output to its input, like to go around nodes, or none for the direct way; drawn as one smooth curve that leaves the output and enters the input horizontally. Call requestRedraw when the routes change
Functions
Moves the element from from, a point of the window where its top-left corner was, to where it is laid out in the next frame, like when it moved to another place in a list
the area of the window of the badge of node with key, or with that index when the badges have no keys; null when it has none, like when the node is removed, or when the badge is out of view of the editor. For a popover that follows the badge when the graph pans and zooms, and hides while it is out of view: cm.popover({ editor.badgeArea(node, key) }) { ... }
Binds the value of this element to get and set: when changed happens, elementValue is set with set, and when get changes, setElementValue shows it in the element
true when the point position of the window is in the box of the element as it is drawn, transformed
sets the menu that opens when this element is clicked with the right button, see Element.contextMenu
removes wire
the nodes and wires as they are now, id gives the NodeModel.id of a node, by default its data as a string
p, a point of the window, in the coordinates of the graph
the height of the content of the element when it is width wide, for content that wraps; null when it has none
the styles of this element and its descendants are computed again before the next redraw
position, a point of the window, in the coordinates of the element before its transforms
a NodeEditor, init adds its nodes and wires
adds a NumberField
Called in every frame before the styles are computed, by the control manager, so that the element can change its children for what is in view, like a VirtualList
The layout is computed again before the next redraw, of the element and its descendants, and of the elements around it as far as its size can change theirs, see org.openrndr.panel.document.Document.layoutRequests
Draws the element again, what it shows changed. The layout is computed again when the size hints of the element changed; changes to the children, the classes, states and styles of elements and to scrolling lay out again by themselves, other changes that move or size elements call Element.requestLayout.
Replaces the nodes and wires by those of model, firing the events of the removals and the additions; create makes the node of a NodeModel, by default with its ports and with its id as data, or none to leave it out. Wires that do not fit their nodes, or that canConnect refuses, are left out. Not recorded in the history.
Scrolls the elements that scroll this element so that it is in view, with margin pixels around it, each by its StyleSheet.scrollBehavior
makes changed compact when compact is true, expands them when it is false, or lets them follow compactNodes when it is null; the change can be undone
Applies the provided styling function to the element's stylesheet. If the element does not already have a stylesheet, a new one is created and the function is applied to it.
Creates a Div element with the provided classes, and runs builder to populate the Div any time watchObject changes.