TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::NodeViewState Struct Reference

How one view shows a NodeGraph: its pan and zoom, what's selected in it, what the user is doing in it, what it shows over the canvas and the callbacks that act on what it shows. More...

#include <gui_controls/gui_node_view_types.h>

Inheritance diagram for tachyon::NodeViewState:

Classes

struct  MarqueeStart
 What a marquee starts from: the selection before it, put back by Escape, and the modifiers held at its press. More...

Public Attributes

std::unordered_set< tachyon::ID > selectedTransitionIDs
 selected transition stableIDs
std::function< void(int node)> onOpenState
 A double-click on a state that holds a machine of its own (NodeModel::subMachine): open it, typically by showing that machine's view and extending breadcrumb.
std::function< void(int transition)> onTransitionContextMenu
 As onNodeContextMenu, for transition transition (an index into transitions): a right click on its arrow or label opens it and selects the transition.
std::unordered_set< tachyon::ID > selectedFrameIDs
 Selected frame stableIDs.
std::function< void(int frame)> onFrameContextMenu
 As onNodeContextMenu, for frame frame (an index into frames): a right click on its title opens it and selects the frame.
std::vector< std::string > breadcrumb
 Breadcrumb overlay at the canvas top-left, shown when non-empty.
std::function< void(int)> onBreadcrumb
 called with the clicked segment index
bool showZoomControls = true
 zoom overlay, bottom-left
bool showMinimap = true
 minimap overlay, bottom-right
float minZoom = 0.1f
 The zoom range (1 = 100%) the wheel, the keys and the zoom controls stay in.
float maxZoom = 4.0f
bool virtualizeLayout = true
 Lays out (and calls renderBody for) only the nodes in or near view: one far out of view stands in as its box, at its last size, with its sockets, so wires, the minimap and selection still have it.
float minimapScale = 0.0f
 Last frame's minimap mapping (canvas = origin + minimap pixels / scale), for clicks.
tachyon::float2 minimapOrigin {}
PendingConnection pendingConnection
 internal: the wire being dragged
tachyon::float3x2 transform
 identity = centered view (no pan/zoom)
tachyon::int2 lastInnerSize { 0, 0 }
 last frame's canvas size, for centering
tachyon::IntRect lastCanvasRect {}
 Last frame's canvas padding box, in screen pixels (as events have them), for NodeViewScreenToCanvas and NodeViewCanvasToScreen.
tachyon::int2 lastGridOrigin {}
 Last frame's canvas border box less its content box: node.pos is measured from the border box, NodeViewScreenToCanvas's points from the content box.
tachyon::ID revealedFocusID = tachyon::ID::Invalid()
 internal: the focus last scrolled into view
tachyon::ID focusedNodeID = tachyon::ID::Invalid()
 internal: the node holding the focus last frame
CommandMode commandMode = CommandMode::Default
 Command mode set while the canvas has focus.
std::unordered_set< tachyon::ID > selectedNodeIDs
 Selected node stableIDs.
std::function< void()> onSelectionChanged
 Called when the selection changed, once per RenderNodeView that finds it changed: by the user (clicks, the marquee, keys), a removed node, or the app itself.
uint32_t selectionGeneration = 0
 Goes up by one each time onSelectionChanged would be called, for an app that would rather compare it than be called.
std::unordered_set< tachyon::ID > reportedSelection
 internal: the selection last reported
std::unordered_set< tachyon::ID > reportedFrameSelection
 internal: the frames selected last reported
tachyon::ID lastClickedNodeID = tachyon::ID::Invalid()
 StableID of the last clicked node.
DoubleClickTracker nodeDoubleClick
 Double-click-to-collapse, per view so views (and test frames) don't share it.
tachyon::Gesture< MarqueeStart > marquee
 A press on the empty background: a marquee once it moves the drag distance.
tachyon::int2 marqueeCurrentScreen {}
std::vector< CachedWireHandle > wireHandleCache
 Last frame's draggable segments, since grab elements are laid out before routing.
WireSegmentDrag wireDrag
tachyon::HoverPart< std::optional< uint32_t > > hoveredWire
 The wire under the mouse (by WireKey), from the last frame: highlighted, removed by a middle click, and offered for deletion by a right click.
std::function< void(PropertyEndpoint from, bool fromOutput, float2 canvasPos)> onWireDroppedOnCanvas
 A new wire was released over the empty canvas (not on a node), e.g.
std::optional< uint32_t > wireMenuWire
 the wire the open context menu is for
float2 wireMenuPos {}
 internal: where on the canvas it was opened
std::function< void(float2 canvasPos)> onCanvasContextMenu
 Builds the canvas's context menu (MenuItem and the like), each frame while it's open; without it there's none.
std::function< void(int node)> onNodeContextMenu
 As onCanvasContextMenu, for node node (an index into nodes): opened by a right click on it, which selects it if it wasn't, or from the keys while one is selected (the one clicked last).
std::optional< float2 > canvasMenuPos
 internal: where the open canvas menu is for
std::optional< tachyon::ID > nodeMenuNode
 internal: the stableID the open node menu is for
std::optional< tachyon::ID > frameMenuFrame
 internal: the stableID the open frame menu is for
FrameDrag frameDrag
 internal: a frame being moved or resized
DoubleClickTracker frameDoubleClick
 internal: a double-click on a title renames
std::optional< tachyon::ID > renamingFrame
 internal: the frame whose title is being edited
std::string renameText
 internal: its title as edited so far
bool renameFocused = false
 internal: the field has had the focus
int32_t gridSize = 0
 internal: the grid the view was last drawn with
std::vector< tachyon::IntRect > frameBoxes
 Internal: each frame's box as last drawn, by index (node.pos space): a collapsed one's node-like box, an empty rect for one hidden in a collapsed frame.
tachyon::Gesture< tachyon::float3x2 > pan
 Internal: the view dragged (middle, or Alt + left); once dragged, not a click.
tachyon::Gesture menuPress
 internal: a right press; its release without a drag opens a menu
tachyon::Gesture nodeDrag
 internal: the press on a node; moves the selection once dragged
tachyon::Gesture< tachyon::float3x2 > minimapDrag
 Internal: a press in the minimap; the transform before it, put back by Escape.
tachyon::Gesture transitionDrag
 Internal: a transition being drawn from a state's edge, the state it leaves, and where the pointer is (screen).
tachyon::ID transitionFrom = tachyon::ID::Invalid()
tachyon::int2 transitionPointer {}
bool transitionPicking = false
 Internal: a transition started from a menu (StartTransition): it follows the pointer until a click on a state finishes it, or a click elsewhere or Escape drops it.
tachyon::HoverPart< tachyon::ID > stateEdgeHover
 Internal: the state whose edge is under the pointer (a transition starts there).
tachyon::HoverPart< std::optional< tachyon::ID > > hoveredTransition
 Internal: the transition under the pointer, from the last frame: highlighted, and what a click selects.
DoubleClickTracker transitionClicks
 internal: a double-click on a transition relabels it
std::vector< std::pair< tachyon::ID, tachyon::IntRect > > transitionLabelBoxes
 Internal: each transition's label chip as last laid out (node.pos space): a click on it is a click on its transition.
std::optional< tachyon::ID > renamingTransition
 internal: the transition whose label is being edited
std::optional< tachyon::ID > transitionMenuTransition
 internal: the transition the open menu is for
std::unordered_map< uint32_t, tachyon::VisualColorStyleIndex > wireColorStyles
 This frame's colors from the app (sockets, nodes, frames): packed RGBA -> its color style, a slot reused from frame to frame.
uint32_t seenRevision = 0
 Internal: the graph's revision this view last saw (NodeGraph::revision).
tachyon::ID canvasID = tachyon::ID::Invalid()
 Internal: the canvas element as last built; its nodes' element IDs are scoped under it (NodeElementID).

Internal: a frame's working lists, kept for their storage

NodeLists< tachyon::ElementRef > socketRefs
std::vector< tachyon::ElementRef > nodeRefs
 each node's element, as last built
std::vector< uint32_t > drivenOutputs
 the wired outputs' WireKeys, sorted
std::vector< int > nodeHiddenBy
 the collapsed frame hiding each node, or -1
std::vector< tachyon::IntRect > hiddenBox
 that frame's box, for a hidden node with crossing wires
NodeLists< NodeHiddenPort > hiddenPorts
 a hidden node's sockets on that box
std::vector< std::vector< PropertyEndpoint > > framePortsIn
 Each collapsed frame's rows: the inputs wired from outside it, and the outputs inside it feeding a node outside.
std::vector< std::vector< PropertyEndpoint > > framePortsOut
std::vector< std::pair< tachyon::ID, int > > nodesByID
 (stableID, index), sorted: a collapsed frame's members
std::vector< std::pair< tachyon::ID, int > > framesByID
std::string portText
 a collapsed frame's port name, as built

Detailed Description

How one view shows a NodeGraph: its pan and zoom, what's selected in it, what the user is doing in it, what it shows over the canvas and the callbacks that act on what it shows.

Keep one for each place the graph is shown.

Member Data Documentation

◆ selectedTransitionIDs

std::unordered_set<tachyon::ID> tachyon::NodeViewState::selectedTransitionIDs

selected transition stableIDs

◆ onOpenState

std::function<void(int node)> tachyon::NodeViewState::onOpenState

A double-click on a state that holds a machine of its own (NodeModel::subMachine): open it, typically by showing that machine's view and extending breadcrumb.

◆ onTransitionContextMenu

std::function<void(int transition)> tachyon::NodeViewState::onTransitionContextMenu

As onNodeContextMenu, for transition transition (an index into transitions): a right click on its arrow or label opens it and selects the transition.

◆ selectedFrameIDs

std::unordered_set<tachyon::ID> tachyon::NodeViewState::selectedFrameIDs

Selected frame stableIDs.

A click on a frame's title selects it as one on a node does; selecting is all it does to it.

◆ onFrameContextMenu

std::function<void(int frame)> tachyon::NodeViewState::onFrameContextMenu

As onNodeContextMenu, for frame frame (an index into frames): a right click on its title opens it and selects the frame.

◆ breadcrumb

std::vector<std::string> tachyon::NodeViewState::breadcrumb

Breadcrumb overlay at the canvas top-left, shown when non-empty.

◆ onBreadcrumb

std::function<void(int)> tachyon::NodeViewState::onBreadcrumb

called with the clicked segment index

◆ showZoomControls

bool tachyon::NodeViewState::showZoomControls = true

zoom overlay, bottom-left

◆ showMinimap

bool tachyon::NodeViewState::showMinimap = true

minimap overlay, bottom-right

◆ minZoom

float tachyon::NodeViewState::minZoom = 0.1f

The zoom range (1 = 100%) the wheel, the keys and the zoom controls stay in.

Text is drawn at the zoom's size, so it stays sharp above 100%.

◆ maxZoom

float tachyon::NodeViewState::maxZoom = 4.0f

◆ virtualizeLayout

bool tachyon::NodeViewState::virtualizeLayout = true

Lays out (and calls renderBody for) only the nodes in or near view: one far out of view stands in as its box, at its last size, with its sockets, so wires, the minimap and selection still have it.

Tab still reaches its controls: it's laid out as the focus moves into it. Off: every node, every frame.

◆ minimapScale

float tachyon::NodeViewState::minimapScale = 0.0f

Last frame's minimap mapping (canvas = origin + minimap pixels / scale), for clicks.

◆ minimapOrigin

tachyon::float2 tachyon::NodeViewState::minimapOrigin {}

◆ pendingConnection

PendingConnection tachyon::NodeViewState::pendingConnection

internal: the wire being dragged

◆ transform

tachyon::float3x2 tachyon::NodeViewState::transform

identity = centered view (no pan/zoom)

◆ lastInnerSize

tachyon::int2 tachyon::NodeViewState::lastInnerSize { 0, 0 }

last frame's canvas size, for centering

◆ lastCanvasRect

tachyon::IntRect tachyon::NodeViewState::lastCanvasRect {}

Last frame's canvas padding box, in screen pixels (as events have them), for NodeViewScreenToCanvas and NodeViewCanvasToScreen.

◆ lastGridOrigin

tachyon::int2 tachyon::NodeViewState::lastGridOrigin {}

Last frame's canvas border box less its content box: node.pos is measured from the border box, NodeViewScreenToCanvas's points from the content box.

◆ revealedFocusID

tachyon::ID tachyon::NodeViewState::revealedFocusID = tachyon::ID::Invalid()

internal: the focus last scrolled into view

◆ focusedNodeID

tachyon::ID tachyon::NodeViewState::focusedNodeID = tachyon::ID::Invalid()

internal: the node holding the focus last frame

◆ commandMode

CommandMode tachyon::NodeViewState::commandMode = CommandMode::Default

Command mode set while the canvas has focus.

◆ selectedNodeIDs

std::unordered_set<tachyon::ID> tachyon::NodeViewState::selectedNodeIDs

Selected node stableIDs.

◆ onSelectionChanged

std::function<void()> tachyon::NodeViewState::onSelectionChanged

Called when the selection changed, once per RenderNodeView that finds it changed: by the user (clicks, the marquee, keys), a removed node, or the app itself.

Read selectedNodeIDs for what it is now.

◆ selectionGeneration

uint32_t tachyon::NodeViewState::selectionGeneration = 0

Goes up by one each time onSelectionChanged would be called, for an app that would rather compare it than be called.

◆ reportedSelection

std::unordered_set<tachyon::ID> tachyon::NodeViewState::reportedSelection

internal: the selection last reported

◆ reportedFrameSelection

std::unordered_set<tachyon::ID> tachyon::NodeViewState::reportedFrameSelection

internal: the frames selected last reported

◆ lastClickedNodeID

tachyon::ID tachyon::NodeViewState::lastClickedNodeID = tachyon::ID::Invalid()

StableID of the last clicked node.

◆ nodeDoubleClick

DoubleClickTracker tachyon::NodeViewState::nodeDoubleClick

Double-click-to-collapse, per view so views (and test frames) don't share it.

◆ marquee

tachyon::Gesture<MarqueeStart> tachyon::NodeViewState::marquee

A press on the empty background: a marquee once it moves the drag distance.

Its points are screen space (marquee.drag.pressScreen is the start).

◆ marqueeCurrentScreen

tachyon::int2 tachyon::NodeViewState::marqueeCurrentScreen {}

◆ wireHandleCache

std::vector<CachedWireHandle> tachyon::NodeViewState::wireHandleCache

Last frame's draggable segments, since grab elements are laid out before routing.

◆ wireDrag

WireSegmentDrag tachyon::NodeViewState::wireDrag

◆ hoveredWire

tachyon::HoverPart<std::optional<uint32_t> > tachyon::NodeViewState::hoveredWire

The wire under the mouse (by WireKey), from the last frame: highlighted, removed by a middle click, and offered for deletion by a right click.

◆ onWireDroppedOnCanvas

std::function<void(PropertyEndpoint from, bool fromOutput, float2 canvasPos)> tachyon::NodeViewState::onWireDroppedOnCanvas

A new wire was released over the empty canvas (not on a node), e.g.

to offer the nodes it could connect to. from is the socket it was dragged from: an output when fromOutput, else an unwired input. canvasPos is where, in node.pos space. A wire pulled off an input and dropped there is a disconnect (onEdit), not this.

◆ wireMenuWire

std::optional<uint32_t> tachyon::NodeViewState::wireMenuWire

the wire the open context menu is for

◆ wireMenuPos

float2 tachyon::NodeViewState::wireMenuPos {}

internal: where on the canvas it was opened

◆ onCanvasContextMenu

std::function<void(float2 canvasPos)> tachyon::NodeViewState::onCanvasContextMenu

Builds the canvas's context menu (MenuItem and the like), each frame while it's open; without it there's none.

It opens on a right click (not a pan) on the empty canvas, or on the Menu key or Shift+F10 with the canvas focused and no node selected. canvasPos is where, in node.pos space (the canvas's centre from the keys).

◆ onNodeContextMenu

std::function<void(int node)> tachyon::NodeViewState::onNodeContextMenu

As onCanvasContextMenu, for node node (an index into nodes): opened by a right click on it, which selects it if it wasn't, or from the keys while one is selected (the one clicked last).

Not for a reroute, whose menu is the view's own.

◆ canvasMenuPos

std::optional<float2> tachyon::NodeViewState::canvasMenuPos

internal: where the open canvas menu is for

◆ nodeMenuNode

std::optional<tachyon::ID> tachyon::NodeViewState::nodeMenuNode

internal: the stableID the open node menu is for

◆ frameMenuFrame

std::optional<tachyon::ID> tachyon::NodeViewState::frameMenuFrame

internal: the stableID the open frame menu is for

◆ frameDrag

FrameDrag tachyon::NodeViewState::frameDrag

internal: a frame being moved or resized

◆ frameDoubleClick

DoubleClickTracker tachyon::NodeViewState::frameDoubleClick

internal: a double-click on a title renames

◆ renamingFrame

std::optional<tachyon::ID> tachyon::NodeViewState::renamingFrame

internal: the frame whose title is being edited

◆ renameText

std::string tachyon::NodeViewState::renameText

internal: its title as edited so far

◆ renameFocused

bool tachyon::NodeViewState::renameFocused = false

internal: the field has had the focus

◆ gridSize

int32_t tachyon::NodeViewState::gridSize = 0

internal: the grid the view was last drawn with

◆ frameBoxes

std::vector<tachyon::IntRect> tachyon::NodeViewState::frameBoxes

Internal: each frame's box as last drawn, by index (node.pos space): a collapsed one's node-like box, an empty rect for one hidden in a collapsed frame.

◆ socketRefs

NodeLists<tachyon::ElementRef> tachyon::NodeViewState::socketRefs

Each node's socket elements, [propIdx * 2 + isOutput], as last built: the wire pass reads them later in the frame.

◆ nodeRefs

std::vector<tachyon::ElementRef> tachyon::NodeViewState::nodeRefs

each node's element, as last built

◆ drivenOutputs

std::vector<uint32_t> tachyon::NodeViewState::drivenOutputs

the wired outputs' WireKeys, sorted

◆ nodeHiddenBy

std::vector<int> tachyon::NodeViewState::nodeHiddenBy

the collapsed frame hiding each node, or -1

◆ hiddenBox

std::vector<tachyon::IntRect> tachyon::NodeViewState::hiddenBox

that frame's box, for a hidden node with crossing wires

◆ hiddenPorts

NodeLists<NodeHiddenPort> tachyon::NodeViewState::hiddenPorts

a hidden node's sockets on that box

◆ framePortsIn

std::vector<std::vector<PropertyEndpoint> > tachyon::NodeViewState::framePortsIn

Each collapsed frame's rows: the inputs wired from outside it, and the outputs inside it feeding a node outside.

◆ framePortsOut

std::vector<std::vector<PropertyEndpoint> > tachyon::NodeViewState::framePortsOut

Each node's socket elements, [propIdx * 2 + isOutput], as last built: the wire pass reads them later in the frame.

◆ nodesByID

std::vector<std::pair<tachyon::ID, int> > tachyon::NodeViewState::nodesByID

(stableID, index), sorted: a collapsed frame's members

◆ framesByID

std::vector<std::pair<tachyon::ID, int> > tachyon::NodeViewState::framesByID

Each node's socket elements, [propIdx * 2 + isOutput], as last built: the wire pass reads them later in the frame.

◆ portText

std::string tachyon::NodeViewState::portText

a collapsed frame's port name, as built

◆ pan

tachyon::Gesture<tachyon::float3x2> tachyon::NodeViewState::pan

Internal: the view dragged (middle, or Alt + left); once dragged, not a click.

The transform before it, put back by Escape.

◆ menuPress

tachyon::Gesture tachyon::NodeViewState::menuPress

internal: a right press; its release without a drag opens a menu

◆ nodeDrag

tachyon::Gesture tachyon::NodeViewState::nodeDrag

internal: the press on a node; moves the selection once dragged

◆ minimapDrag

tachyon::Gesture<tachyon::float3x2> tachyon::NodeViewState::minimapDrag

Internal: a press in the minimap; the transform before it, put back by Escape.

◆ transitionDrag

tachyon::Gesture tachyon::NodeViewState::transitionDrag

Internal: a transition being drawn from a state's edge, the state it leaves, and where the pointer is (screen).

◆ transitionFrom

tachyon::ID tachyon::NodeViewState::transitionFrom = tachyon::ID::Invalid()

◆ transitionPointer

tachyon::int2 tachyon::NodeViewState::transitionPointer {}

◆ transitionPicking

bool tachyon::NodeViewState::transitionPicking = false

Internal: a transition started from a menu (StartTransition): it follows the pointer until a click on a state finishes it, or a click elsewhere or Escape drops it.

◆ stateEdgeHover

tachyon::HoverPart<tachyon::ID> tachyon::NodeViewState::stateEdgeHover

Internal: the state whose edge is under the pointer (a transition starts there).

◆ hoveredTransition

tachyon::HoverPart<std::optional<tachyon::ID> > tachyon::NodeViewState::hoveredTransition

Internal: the transition under the pointer, from the last frame: highlighted, and what a click selects.

Its arrows as last drawn, for hit tests.

◆ transitionClicks

DoubleClickTracker tachyon::NodeViewState::transitionClicks

internal: a double-click on a transition relabels it

◆ transitionLabelBoxes

std::vector<std::pair<tachyon::ID, tachyon::IntRect> > tachyon::NodeViewState::transitionLabelBoxes

Internal: each transition's label chip as last laid out (node.pos space): a click on it is a click on its transition.

◆ renamingTransition

std::optional<tachyon::ID> tachyon::NodeViewState::renamingTransition

internal: the transition whose label is being edited

◆ transitionMenuTransition

std::optional<tachyon::ID> tachyon::NodeViewState::transitionMenuTransition

internal: the transition the open menu is for

◆ wireColorStyles

std::unordered_map<uint32_t, tachyon::VisualColorStyleIndex> tachyon::NodeViewState::wireColorStyles

This frame's colors from the app (sockets, nodes, frames): packed RGBA -> its color style, a slot reused from frame to frame.

Wires take their source socket's from here, since RenderPolyline takes a style index.

◆ seenRevision

uint32_t tachyon::NodeViewState::seenRevision = 0

Internal: the graph's revision this view last saw (NodeGraph::revision).

◆ canvasID

tachyon::ID tachyon::NodeViewState::canvasID = tachyon::ID::Invalid()

Internal: the canvas element as last built; its nodes' element IDs are scoped under it (NodeElementID).


The documentation for this struct was generated from the following file: