ui/shape_edit.rs#
Source: lib/ui/shape_edit.rs
shape_edit -- editing shapes on a ui.diagram canvas (DG_EDIT): selection by click, marquee,
keyboard, Shift and Ctrl; the eight handles and the rotation handle of turned and flipped
frames, the rotation pin, yellow control points, vertices, the ends of 1D shapes with glue to
connection points (static) or to whole shapes (dynamic); moving with the grid, the dynamic grid
(alignment to other shapes' edges and middles) and guides; the connector and drawing tools; the
magnifier (Ctrl + Shift + click); one semantic record per shape and per handle. The app owns
the model and applies what the user did, reported as SeEv events; the widget keeps the
selection and the gesture in SeState. It knows nothing of diagram files: an app maps its
shapes to SeShape frames (diagram_core for JFDiagrammer).
ui.diagram(id, &mut dg, &m, DG_EDIT, paint, ver) the view: the paint, zoom, pan
ui.shape_edit(id, &mut st, &mut dg, &model, tool) -> Vec<SeEv>
right after it with the same id and DiagramState: the left
button, the keys while the canvas has the focus, the cursor,
the overlays (selection, handles, glue, guides, rubber bands)
ui.shape_edit_sems(id, &mut st, &dg, &model, &label) one K_LISTITEM record per visible
top-level shape (label(key)) and one K_BUTTON record per
handle of a single selection ("Größengriff unten rechts",
"Drehgriff", "Anfangspunkt", "Steuerpunkt 1" ...), per
connection arrow while they show ("Verbindungspfeil rechts",
"... unten", "... links", "... oben") and per insertion mark
while it shows ("Element einfügen", value = its tag): scripts
click and drag them, screen readers name them (a screen
reader's click on an arrow or a mark reports it as a click)
tools SE_POINTER, SE_CONNECT, SE_LINE, SE_RECT, SE_ELLIPSE, SE_TEXT, SE_PLACE, SE_FREEFORM,
SE_ARC, SE_CPOINT (JD21, the connection point tool)
SeState::quick: Vec<SeQuick> (JD21) the quick shapes the bar at a hot connection arrow
offers (see below)
Model (SeModel, borrowed per call; world units are the canvas's, y down):
SeShape { key, parent, bx, ends, pin, bbox, flags, points }
SeBox { o, u, v } the frame: the point o + fx u + fy v for fx, fy in 0..1; u runs along the
shape's width, v along its height (downwards on the screen for a shape
that is neither turned nor flipped; a flip reverses u or v); handles at
fx, fy in {0, 0.5, 1}, the rotation handle beyond the edge fy = 0
SePoint { at, kind, tag, dir, flags } SP_CONTROL (yellow), SP_CONN (connection points:
shown while connecting, with SeState::show_points those of every
visible shape, RA-06; SPF_OUTWARD: shown, no target), SP_VERTEX (shown
for a single selection when the app lists them: vertex editing);
(JD21) SP_SEGMENT (a midpoint of a connector's piece, a small diamond:
dragged like a vertex, chosen by no click; dir = half the piece; shown
while the piece is at least SEG_MIN DIP long on the screen; the pointer
shows the move across it unless SPF_FREE), SP_TARGET (another glue target the app offers: a vertex, a handle,
a control point; shown only as the target under a dragged end), SP_ARC
(an arc's control point, a circle), SP_ECC (an eccentricity handle, a
circle; pairs on a dashed line)
SeGuide { key, vertical, at } guides (blue, dashed, across the canvas); moves snap to them
(SeState::snap and snap_guides; an app hides guides by leaving them out)
SeMark { at, dir, tag, owner } the app's insertion marks (Visio's blue triangle between two
items of a list): a small triangle, its tip at `at`, pointing in `dir`
hit(p, tol, within) -> key the topmost shape at world point p within tol world units
(within = 0: a top-level shape; a group's key: the child of that group
under p, for the second click into a group), 0 = none; the app asks its
display list
Live gestures: Move, Resize, Rotate, Pin, End and Point report the whole change from the
start of the drag with every step (done = false) and once more when released (done = true);
Esc during one sends SeEv::Cancel. So the app takes its preview back and applies the new
total each step, and keeps the last one as the undo step. The frames of the selection follow
the model (the app's preview), the gesture keeps what it had at the start. The connector and
line tools and the drawing tools draw a rubber band and report Connect / Draw when released;
a click with them selects like the pointer. With Shift the rectangle and the ellipse tool draw
a square and a circle, and a move with Shift keeps to one axis (KB-09); a drag of the selection
that starts with Ctrl + Shift moves a copy of it (SeEv::MoveCopy, live like Move: the app
shows a preview each step and makes the copy when released; one axis while Shift is held,
KB-09). The freeform tool
records the pointer's way (a point every 2 px) and reports SeEv::Stroke when released; the arc
tool shows a quarter ellipse from the press to the pointer, bowing the way the drag started
(horizontally or vertically, decided once the pointer left the drag threshold), and reports
SeEv::Arc; both start and end glued to connection points like the line tool (CN-12).
Input (pointer tool): a press on a handle of the selection starts its drag; on a shape it
selects it (Shift adds, Ctrl toggles) and a drag moves the selection (grid, dynamic grid,
guides; Alt: free); a second, slow click on a selected group selects the child under the
pointer, on a selected child with SEF_UP its group (Visio's "members first"); a double click
edits the text (SeEv::Text); on the background a drag draws a marquee or, with
SeState::lasso, a free outline (shapes fully inside, with SeState::partial also those it
touches, ZF-06; Shift adds, Ctrl toggles). Corner handles keep the aspect ratio, edge
handles change one side (a locked aspect: both), Ctrl resizes about the middle; locked handles
are drawn grey and do nothing. The rotation handle turns about the pin (one shape) or the
middle of the selection: in 15-degree steps near the shape, in single degrees farther away.
An end or a control point that can glue snaps to a connection point under the pointer (static
glue); over a shape a dynamic connector's end glues to the whole shape (dynamic glue, the
shape's frame is highlighted); with Ctrl held a dynamic end swaps the two (CN-03): over a
connection point it glues to that point's shape as a whole, over a shape to the shape's
nearest connection point. Connection points with SPF_OUTWARD are no target for ends (SS-29).
(JD21, CN-02) Without a connection point in reach an SP_TARGET point of the app is the next
target (ends, control points, the connector and line tools; not the freeform and the arc
tool), then (ends and the connector and line tools, SeState::glue_guides) a guide within
reach: SeGlue::Guide, the end on its line, the guide drawn green.
(JD21, SP-05) Vertex editing: a click chooses a vertex (filled), Shift + click adds one to the
chosen ones or takes it away (SeState::chosen); a drag on one of several chosen moves them
together (SeEv::Points, live), Del takes them out (SeEv::PointsDelete; one: PointDelete). An
arc's control point (SP_ARC) is chosen alike (the app may list its eccentricity handles then);
the freeform tool takes back what the pointer goes back over (2 px back along the last piece,
within 3 px of it). (JD21, CN-01) The connection point tool (SE_CPOINT): the selection's
connection points show and are its only handles; a click chooses one (magenta), a drag moves
it (SeEv::Point), Del takes it out (SeEv::PointDelete), Ctrl + click on, inside or outside the
single selected shape adds one there (SeEv::PointInsert); a right click on one reports
SeEv::Context with it chosen (the app's menu of its kind). Another tool forgets the chosen
point.
Ctrl + Shift + click zooms in at the pointer (on a selected shape too), + drag zooms to the
rectangle (from a selected shape: the copy above), + right click zooms out (ZF-22), + right
drag pans the view (KB-04). Keys while the canvas has the focus: Esc
cancels the gesture, else clears the selection; Del deletes; Ctrl+A selects all; arrows nudge
by a grid step (Shift: a pixel) or pan without a selection; Tab / Shift+Tab walk the top-level
shapes (without a selection Tab takes the first, Shift+Tab the last, KB-06); F2 and Enter edit
the text of the single selection, so does typing a character (the
character is handed on). A right click selects the shape under the pointer first and reports
SeEv::Context; the menu itself (also from Shift+F10 and the menu key) is the app's
ui.context_menu right after this call.
Connection arrows (SeState::arrows, on by default; Ansicht › Verbindungspfeile): with the
pointer tool and no gesture, a pointer on a top-level shape shows four small filled triangles
in the accent colour around its box (SeShape::bbox), in the middle of each side, ARROW_GAP
(12) DIP out from the box and ARROW_LEN (10) DIP long; half transparent, the one under the
pointer opaque. Directions as seen: 0 right, 1 down, 2 left, 3 up. They stay while the
pointer is on the shape, on one of its handles, on an arrow or in the strip between the box
and an arrow (as wide as the arrow), and go at once elsewhere (on another shape: that
shape's arrows). None for 1D shapes, SEF_NOSELECT, SEF_NOARROWS (the app's choice: shapes
whose file refuses them, ...), children of groups, shapes smaller than ARROW_MIN (16) DIP on
the screen, nor right after a gesture or a click until the pointer moves again. An arrow
that would cover a rotation handle of the selection (the single shape's, or the one of the
box around several) moves out along its direction until it clears the handle by a few DIP
(Visio puts its top arrow beyond the rotation handle too); the strip that keeps the arrows
grows with it. Handles and control points of that shape (or of a selection box around it)
stay on top and are hit first; another selected shape's handle under a hot arrow is not. A click on an
arrow reports SeEv::Arrow { key, dir } and leaves the selection alone (the app selects what
it made); a drag from an arrow is the connector tool from that shape: a rubber band from
the middle of the box's side, glue and the target's highlight as SE_CONNECT, released
SeEv::Connect { tool: SE_CONNECT, a: that middle, ga: SeGlue::Shape(key), b, gb }; Esc
cancels. The arrow under the pointer is SeState::arrow_hover(), and each change of it is
SeEv::ArrowHover { key, dir } once (dir 255: off the arrows of `key`), for a preview.
Insertion marks (SeModel::marks): with the pointer tool and no gesture each mark shows while
the pointer is on its owner (the shape under the pointer, or inside the owner's box) or
within MARK_NEAR (16) DIP of it; a click reports SeEv::Mark { tag }, a drag does nothing.
(JD21) Quick shapes bar (SeState::quick, Visio's mini toolbar of an AutoConnect arrow, CN-07):
while an arrow is under the pointer and the app lists quick shapes, a bar with the first
QUICK_MAX (4) of them shows beside the arrow where the new shape does not go (above the box
for the arrows left and right, right of it for those up and down): a row of QUICK_TILE (28)
DIP tiles with their previews (the app's Draw, like the Shapes panel's tiles), on the flyout
colour with a thin frame, square. The arrow stays hot while the pointer is on the bar or
between it and the arrow; the tile under the pointer is drawn hot and each change of it is
SeEv::QuickHover { key, dir, tile } once (tile 255: on no tile any more; the app's live
preview), a click on a tile SeEv::Quick { key, dir, tile }; the bar goes with the arrows.
Screen readers and scripts get a K_BUTTON per tile named "Schnell-Shape: <name>" (value: the
tile's index).
/// tools of ui.shape_edit
SE_POINTER: u32 = 0
/// draw a dynamic connector: its ends glue to connection points or whole shapes
SE_CONNECT: u32 = 1
/// draw a line: its ends glue to connection points only (CN-12); vertex editing when the app
/// lists vertices
SE_LINE: u32 = 2
SE_RECT: u32 = 3
SE_ELLIPSE: u32 = 4
/// a text box: drag its frame, or click for one of the app's default size
SE_TEXT: u32 = 5
/// place what the app holds (a shape from a stencil, click + click): a click anywhere, on a
/// shape too, reports Draw { tool: SE_PLACE, a, b: a } at the snapped point; no handles, a
/// drag places nothing
SE_PLACE: u32 = 6
/// draw freehand: the pointer's way, reported as SeEv::Stroke (its ends glue like a line's)
SE_FREEFORM: u32 = 7
/// draw a quarter ellipse from the press to the release, reported as SeEv::Arc (its ends glue
/// like a line's)
SE_ARC: u32 = 8
/// (JD21) the connection point tool: the connection points of the single selection are
/// handles (a drag moves one, SeEv::Point; a click chooses it, Del takes it out,
/// SeEv::PointDelete), Ctrl + click on the selected shape adds one (SeEv::PointInsert)
SE_CPOINT: u32 = 9
/// shape flags (SeShape::flags)
SEF_1D: u32 = 1 // the two ends instead of the eight handles
SEF_GROUP: u32 = 2 // a group: a second click selects the child under the pointer
SEF_DYNAMIC: u32 = 4 // a dynamic connector: its ends also glue to whole shapes
SEF_LOCK_W: u32 = 8
SEF_LOCK_H: u32 = 0x10
SEF_LOCK_ASPECT: u32 = 0x20
SEF_LOCK_ROTATE: u32 = 0x40
SEF_LOCK_BEGIN: u32 = 0x80
SEF_LOCK_END: u32 = 0x100
SEF_LOCK_MOVE: u32 = 0x200 // LockMoveX and LockMoveY: no move by dragging
SEF_NOSELECT: u32 = 0x400 // never selected (LockSelect)
SEF_NOGLUE: u32 = 0x800 // nothing glues to it
SEF_BEGIN_GLUED: u32 = 0x1000 // the begin is glued to a point (static)
SEF_BEGIN_DYN: u32 = 0x2000 // the begin is glued to a whole shape (dynamic)
SEF_END_GLUED: u32 = 0x4000
SEF_END_DYN: u32 = 0x8000
SEF_LOCK_PIN: u32 = 0x1_0000 // no rotation pin handle
SEF_NOARROWS: u32 = 0x2_0000 // no connection arrows around it (see the file header)
SEF_NOSNAP: u32 = 0x4_0000 // moves do not snap to it (the dynamic grid leaves it out)
/// (JD21) a member of a "members first" group: a second, slow click on it selects its group
/// (SeShape::parent)
SEF_UP: u32 = 0x8_0000
/// kinds of SePoint
SP_CONTROL: u8 = 0
SP_CONN: u8 = 1
SP_VERTEX: u8 = 2
/// (JD21) another place an end or a control point glues to (a vertex, a handle or a control
/// point of a shape: the app makes a connection point there, CN-02): not drawn, never a handle;
/// the target under a dragged end shows like a connection point
SP_TARGET: u8 = 3
/// (JD21) the control point of an arc in vertex editing (a small circle; a drag reports
/// SeEv::Point, a click chooses it like a vertex)
SP_ARC: u8 = 4
/// (JD21) an eccentricity handle of an elliptical arc (a small circle on a dashed line through
/// the arc's control point; a drag reports SeEv::Point)
SP_ECC: u8 = 5
/// (JD21) a midpoint of a piece of a connector's way (Visio's midpoint handle): `dir` is half
/// the piece (world, from the handle to the piece's end); dragging it reports SeEv::Point like a
/// vertex; hidden (and not hit) while the piece is shorter than SEG_MIN DIP on the screen
SP_SEGMENT: u8 = 6
/// point flags (SePoint::flags)
SPF_GLUE: u32 = 1 // a control point that glues to connection points (SP-04)
/// a connection point that points outward only (Visio's Type 1): shown, but no end glues to it
/// (SS-29)
SPF_OUTWARD: u32 = 2
/// (JD21) a midpoint that moves anywhere (a straight way: a new vertex); without it the
/// pointer shows that the piece moves across
SPF_FREE: u32 = 4
struct SeBoxa frame in world units: the point o + fx u + fy v for fx, fy in 0..1o: [f32; 2]u: [f32; 2]v: [f32; 2]
impl SeBox
fn rect(r: [f32; 4]) -> SeBoxan axis-parallel frame x0, y0, x1, y1fn at(&self, fx: f32, fy: f32) -> [f32; 2]the point at fractions fx, fyfn frac(&self, p: [f32; 2]) -> Option<[f32; 2]>the fractions of a world point (None: a degenerate frame)fn aabb(&self) -> [f32; 4]the axis-parallel box x0, y0, x1, y1 around itfn size(&self) -> [f32; 2]the length of u and vstruct SeShapea shape as the editor sees itkey: u64parent: u64-- the group it belongs to (0: on the page; such a shape is what a click selects)bx: SeBox-- its frame (2D shapes)ends: [[f32; 2]; 2]-- begin and end (SEF_1D)pin: [f32; 2]-- the rotation pinbbox: [f32; 4]-- the box x0, y0, x1, y1 around what is drawn (marquee, alignment)flags: u32points: Range<u32>-- its control points, connection points and vertices (a range of SeModel::points)
struct SePointa point of a shape: a control point, a connection point or a vertexat: [f32; 2]kind: u8tag: u32-- the app's name for it (a row)dir: [f32; 2]-- a connection point's direction (world, unit; 0 0 = none)flags: u32
struct SeGuidea guide: a vertical (x = at) or horizontal (y = at) linekey: u64vertical: boolat: f32
struct SeMarkan insertion mark of the app (Visio's blue triangle between two items of a list): a small triangle with its tip atat(world) pointing indir(0 right, 1 down, 2 left, 3 up, as seen); it shows with the pointer tool while the pointer is on the shapeowneror near the mark, and a click on it reports SeEv::Mark { tag }at: [f32; 2]dir: u8tag: u32owner: u64
struct SeModel<'a>the app's shapes, borrowed for one callshapes: &'a [SeShape]points: &'a [SePoint]guides: &'a [SeGuide]marks: &'a [SeMark]-- insertion marks (lists: between two items)ver: u32-- changes whenever shapes are added, removed or reorderedhit: &'a dyn Fn([f32; 2], f32, u64) -> u64-- the topmost shape at a world point (see the file header)
struct SeQuick(JD21) a tile of the quick shapes bar at a hot connection arrow (SeState::quick)name: String-- its name (the button's name for screen readers and scripts)draw: Option<DrawRef>-- its preview, drawn into the tile (None: a generic shapes icon)ver: u32-- the preview's version (cmd_custom: change it when the drawing changes)
enum SeGluewhat an end or a control point is glued toNonePoint { key: u64, tag: u32 }-- a connection point (its tag) of a shape: static glueShape(u64)-- a whole shape: dynamic glueGuide(u64)-- (JD21) a guide (its key): the end lies on its line (SeState::glue_guides)
enum SeEvwhat the user did (ui.shape_edit's result, in order)Select-- st.sel changedMove { keys: Vec<u64>, total: [f32; 2], done: bool }-- movekeysby total (world units, from the start of the drag; a key nudge: done at once)MoveCopy { keys: Vec<u64>, total: [f32; 2], done: bool }-- a drag with Ctrl + Shift: a copy ofkeysgoestotalfrom them (live like Move: a preview each step, done: the copy, one undo step; KB-09)Resize { keys: Vec<u64>, from: SeBox, to: SeBox, done: bool }-- resize: the framefrom(one shape: its frame; several: the box around them) becametoRotate { keys: Vec<u64>, centre: [f32; 2], angle: f32, done: bool }-- turnkeysaboutcentrebyangleradians (counter-clockwise as seen)Pin { key: u64, at: [f32; 2], done: bool }-- the rotation pin of a shape goes toatEnd { key: u64, end: u8, at: [f32; 2], glue: SeGlue, done: bool }-- end 0 (begin) or 1 of a 1D shape goes toat, glued togluePoint { key: u64, idx: u32, tag: u32, at: [f32; 2], glue: SeGlue, done: bool }-- a control point or a vertex (indexidxof SeModel::points, the app's tag) goes toat; (JD21) also an arc's control point, an eccentricity handle, a connection point (SE_CPOINT)PointInsert { key: u64, at: [f32; 2] }-- Ctrl + click on the outline of a shape with vertices listed: add a vertex atat; (JD21) with SE_CPOINT on the selected shape: add a connection point therePointDelete { key: u64, tag: u32 }-- Del with a vertex chosen: remove it; (JD21) with SE_CPOINT the chosen connection pointPoints { key: u64, tags: Vec<u32>, total: [f32; 2], done: bool }-- (JD21) the vertices chosen with Shift (their tags, SeState::chosen) move together bytotal(world units, from the start of the drag; live like Point)PointsDelete { key: u64, tags: Vec<u32> }-- (JD21) Del with several vertices chosen: remove themCancel-- Esc during a live gesture: take the preview backConnect { tool: u32, a: [f32; 2], ga: SeGlue, b: [f32; 2], gb: SeGlue }-- the connector or line tool drew from a to bDraw { tool: u32, a: [f32; 2], b: [f32; 2] }-- a drawing tool drew the box from a to b (a == b: a click)Stroke { pts: Vec<[f32; 2]>, ga: SeGlue, gb: SeGlue }-- the freeform tool drew this way (world points, at least two); its begin glued toga, its end togb(connection points only)Arc { a: [f32; 2], ga: SeGlue, b: [f32; 2], gb: SeGlue, horizontal: bool }-- the arc tool drew a quarter ellipse from a to b that leaves a horizontally (horizontal) or vertically; glued like a line's endsText { key: u64, ch: Option<char> }-- edit the text of a shape (double click, F2, Enter, or a typed character)Context { key: u64, at: [i32; 2] }-- right click, Shift+F10 or the menu key on a shape (0: the page); at = window pxDelete-- Del with a selectionArrow { key: u64, dir: u8 }-- a click on the connection arrowdir(0 right, 1 down, 2 left, 3 up, as seen) of the top-level shapekey; the selection stays as it wasArrowHover { key: u64, dir: u8 }-- the pointer went onto the connection arrowdirof shapekey, or off the arrows ofkey(dir 255); once per changeMark { tag: u32 }-- a click on the insertion mark with this tag (SeModel::marks)Quick { key: u64, dir: u8, tile: u8 }-- (JD21) a click on tiletileof the quick shapes bar at the connection arrowdirof shapekey; the selection stays as it wasQuickHover { key: u64, dir: u8, tile: u8 }-- (JD21) the pointer went onto tiletileof the quick shapes bar of arrowdirof shapekey, or off the tiles (tile 255, dir 255); once per change (a live preview)
struct SeStatethe editor's state, kept by the app: the selection, the focused shape, the options, the gesture in progresssel: BTreeSet<u64>-- the selected shapes (keys)primary: u64-- the anchor of the selection (the first one selected; drawn thicker, ZF-06)focus: u64-- the shape with the keyboard focus (Tab walks)dyn_grid: bool-- the dynamic grid: moves snap to other shapes' edges and middles (ZF-05)glue: bool-- ends glue (Ansicht › Ausrichten und Kleben)show_points: bool-- show the connection points of every visible shape, not only while connecting (CN-01, RA-06; also while glue is off)lasso: bool-- a drag on the background draws a lasso (a free outline) instead of a rectangle (ZF-06)partial: bool-- the marquee and the lasso also take the shapes they only touch (ZF-06; off: only those wholly inside)snap: bool-- moves snap to guides and to the dynamic grid at all (off: a page that inhibits snapping, SS-39; the grid is DiagramState::snap)snap_guides: bool-- moves snap to guides (Ausrichten und Kleben › Führungslinien)vertex: Option<(u64, u32)>-- the vertex chosen with a click (Del removes it): its shape and tag; (JD21) also an arc's control point, and with SE_CPOINT the chosen connection pointchosen: BTreeSet<u32>-- (JD21) the tags of every vertex chosen of that shape (Shift + click adds and takes away; the one invertexamong them): a drag moves them together, Del takes them outglue_guides: bool-- (JD21) ends glue to guides (Ausrichten und Kleben › Kleben an Führungslinien)arrows: bool-- connection arrows around the shape under the pointer (Ansicht › Verbindungspfeile; see the file header)quick: Vec<SeQuick>-- (JD21) the quick shapes the bar at a hot connection arrow offers (the first QUICK_MAX; empty: no bar); the app sets them (Visio: the active stencil's quick shapes)
impl SeState
fn new() -> SeStatenothing selected; dynamic grid, glue, snapping and connection arrows onfn busy(&self) -> boola gesture is in progressfn live(&self) -> boola live gesture is in progress (the app shows a preview of it)fn right_taken(&self) -> boolthe right button's release in the last call of ui.shape_edit belonged to Ctrl + Shift (the magnifier zooming out, a pan): the app opens no context menu for itfn arrow_hover(&self) -> Option<(u64, u8)>the connection arrow under the pointer: the shape's key and the direction (0 right, 1 down, 2 left, 3 up, as seen)fn quick_hover(&self) -> Option<(u64, u8, u8)>(JD21) the tile of the quick shapes bar under the pointer: the shape's key, the arrow's direction, the tile's indexfn select(&mut self, keys: &[u64])select exactly these shapes (the app's commands: paste, group, a new shape)
impl Ui
fn shape_edit(&mut self, id: u32, st: &mut SeState, dg: &mut DiagramState, m: &SeModel, tool: u32) -> Vec<SeEv>ui_shape_edit(id, st, dg, m, tool) -> what the user did: the edit layer of the canvasid, called right after ui.diagram(id, dg, .., DG_EDIT, ..) (see the file header)fn shape_edit_sems(&mut self, id: u32, st: &mut SeState, dg: &DiagramState, m: &SeModel, label: &dyn Fn(u64) -> String)ui_shape_edit_sems(id, st, dg, m, label): one K_LISTITEM record per visible top-level shape (label(key); value = its index in the model; selected / focused states) and one K_BUTTON record per handle of a single selection; a screen reader's click on a shape selects it