pub struct DiagramState {
pub vp: Viewport,
pub sel: BTreeSet<u64>,
pub focus: u64,
pub grid: f32,
pub snap: bool,
pub hover: DHit,
pub edge_width: f32,
pub test_keys: u32,
pub tab_edges: bool,
pub name: String,
pub frame_bar: f32,
pub gpu: CanvasGpu,
/* private fields */
}Expand description
the widget’s state, kept by the app: the view, the selection (node and edge keys), the focused node, grid and snapping, the hover, the gesture in progress and the index
Fields§
§vp: Viewport§sel: BTreeSet<u64>§focus: u64the node with the keyboard focus (0 = none): Tab walks, Enter activates it
grid: f32grid step in world units (0 = no grid)
snap: boolmoves, waypoints and DG_PLACE clicks snap to the grid (Alt held: free)
hover: DHitwhat the pointer is over (after the last diagram call)
edge_width: f32the stroke width of the edges in world units (hit testing, the highlight)
test_keys: u32scripts cannot hold keys: 1 = as if Space were held, 2 = Ctrl
tab_edges: boolTab / Shift+Tab also walk the edges (after the nodes, in model order): the focused edge is selected, Enter activates it, the menu key asks for its context menu
name: Stringthe canvas’ name for screen readers (its K_CANVAS record; empty: none)
frame_bar: f32the height of a DN_FRAME node’s title bar in world units (its hit area, its record, the side of its DN_TOGGLE button)
gpu: CanvasGpuhow the view’s pan and zoom use the GPU (canvas.rs)
Implementations§
Source§impl DiagramState
impl DiagramState
Sourcepub fn new() -> DiagramState
pub fn new() -> DiagramState
grid 16, snapping on, edges 2 units wide; the first diagram call fits the content
Sourcepub fn request_fit(&mut self)
pub fn request_fit(&mut self)
fit the whole content into the view with the next diagram call
Sourcepub fn route(&self, key: u64) -> Option<&DgRoute>
pub fn route(&self, key: u64) -> Option<&DgRoute>
the route of edge key (as of the last diagram call)