The selection card: what is selected, what it reads, what you can do to it. More...
| Import Statement: | import Clayground.Lab |
| Inherits: |
Follows the selected part on screen (kept inside the window - zoomed in, the anchor can sit far below the viewport). Two lines from the domain (titleOf, readingOf), then the domain's own rows declared as children (a slider, a row of chips), then the rows every board part has: put it on the plot (WatchChip), pin a reading to it as a tag, and a one-line hint.
The card is also a keyboard target, and the only channel that survives having no pointer: j/\c k walk its rows, h/\c l adjust the focused one, Enter operates the part. Hand keys to LabKeys::selection; a domain row is adjusted through adjust, the kernel rows by the card itself. Declare a CardFocusRing in each domain row bound to focusedRow === "<row>" and every card shares one focus language.
A part's state belongs on its card - a resistor's ohms are a slider here, a gate's function a row of chips - which is what keeps building and operating from feeling like the same gesture.
PartCard { id: selCard board: board; view: view3d; camera: rig.camera; monitor: monitor; overlay: overlay flow: root.currentFlow titleOf: (p) => root.cardTitle(p) readingOf: (p) => root.fmtV(root.simOf(p.id).v) adjust: (p, row, d) => root.adjustRow(p, row, d) operate: (p) => root.operatePart(p) Row { visible: selCard.part !== null && selCard.part.type === "switch" CardFocusRing { on: selCard.focusedRow === "state" } } }
See also Board, WatchChip, CardFocusRing, and LabKeys.
adjust : var |
(part, row, d) -> bool - h/\c l on a domain row; false refuses.
anchorDz : real |
anchorDz \brief How far below the part's centre the card hangs, in world units. : real |
anchorY : real |
attributes : var |
attributes \readonly \brief What a tag may show: the monitor's quantity keys. : var |
board : Board |
camera : var |
camera \brief The camera the View3D renders with (projection dependency). : var |
flow : var |
The lab's Flow. While one runs, it says whether this card is live.
A flow selects parts as it explains them, so the card is up through most of a lesson - and a slider that still moves under it is a learner editing the circuit the next sentence quotes a number from. Wired here, the card answers only for a part the running task named (Flow::grants()); otherwise it reads, and a touch on it is refused out loud rather than ignored.
focusRow : int |
focusRow \brief Which row \c j/\c k landed on. : int |
focusedRow : string |
focusedRow \readonly : string |
hintOf : var |
hintOf \brief \c {(part) -> string}, the last line. : var |
keys : QtObject |
The adapter for LabKeys::selection.
live : bool |
The card's controls act right now.
minWidthOf : var |
minWidthOf \brief \c {(part) -> real}, a floor for the card's width. : var |
monitor : var |
monitor \brief The \l WatchMonitor the watch row toggles. : var |
operate : var |
(part) -> bool - Enter on the card; false refuses.
overlay : var |
overlay \brief The \l BoardOverlay the tag row pins into. : var |
part : var |
The selected part, live; null when nothing is selected.
readingOf : var |
readingOf \brief \c {(part) -> string}, the second line; "" hides it. : var |
rows : alias |
rows \brief The domain's rows, stacked between the reading and the watch row. : list<Item> |
titleOf : var |
titleOf \brief \c {(part) -> string}, the first line. : var |
view : var |
view \brief The View3D to project through. : var |
watchable : bool |
watchable \readonly \brief The part takes a plot and a tag (spec \c watch). : bool |
var rowsOf(var part) |
The rows in visual order: the spec's, then "watch" and "label" for a watchable part.