The mouse on a Board: wire pads, select and drag parts, operate, erase, tap a wire. More...
| Import Statement: | import Clayground.Lab |
The whole left-button gesture of a build lab, and the rule it lives by: the left button is always the board's. Navigation never competes for it - the camera (nav) is asked first and with its default buttons the answer for the left button is always no; then the hand (hands): an instrument out means the click is the instrument's. Only then is the press the board's, and what it does depends on what Board::hitAt found:
With a flow wired, that whole list is conditional: while a lesson runs the board is the flow's, and only what the running task named answers at all.
The gesture lives in named functions (pressAt, moveAt, releaseAt, clickAt, dragFrom) rather than in the signal handlers, so a flow, a test or an agent can perform the SAME drag a hand does - the inspector can synthesize a click but not a drag. A right click walks back one step (hand, dangling wire, eraser, selection - in that order); a right drag still turns the view and cancels nothing.
BoardInput { id: boardMouse board: board; nav: nav; hands: hands; stage: stage; view: view3d; grid: grid flow: root.currentFlow // while it runs, the board is its onOperate: (id) => root.toggleSwitch(id) }
See also Board, OrbitInput3D, InstrumentBelt, GridMode, and Flow.
board : Board |
dragSlop : real |
World units a press must travel before it is a drag.
flow : var |
The lab's Flow. While one runs, it decides what the board answers to.
A lesson explains, hands over exactly the interaction it asked for, takes the board back when that is done, and continues. With a flow wired here that rule is the mouse's: a press is checked against Flow::grants() before anything happens, a refused press says so through Flow::refuse() instead of quietly doing nothing, and hovering an inert part promises nothing - no highlight, no pointing hand. Left null, every press is the learner's, which is what a lab without a flow (and every flow written before this) gets.
gated : bool |
A flow is running, so it - not the learner - says what is live.
grid : var |
grid \brief A \l GridMode; Alt inverts it for one drag. Optional. : var |
hands : var |
hands \brief The \l InstrumentBelt; asked second. Optional. : var |
hint : string |
The hint-bar line for the current state, translated.
hoverActuator : bool |
The cursor is over the SELECTED part's actuator - the next click operates it.
Drives the cursor, the part's own highlight and the hint bar, so the three cannot say different things. Only once it is the selected part: before that the click selects, and a cursor promising a flip would be describing the click after next.
hoverActuatorIdle : bool |
Over an operable part that is not the one being worked on - the next click selects it.
nav : var |
nav \brief The \c OrbitInput3D; asked first about every press. : var |
stage : var |
stage \brief The \l LabStage3D, for \c worldAt. : var |
view : var |
view \brief The View3D the stage projects through. : var |
interacted() |
A part was selected or operated - a touch that was allowed through.
Not emitted for a press a running flow refused: those did not happen as far as the lab is concerned.
Note: The corresponding handler is onInteracted.
operate(int id) |
The selected part's actuator was clicked: the domain decides what operating means.
Note: The corresponding handler is onOperate.
void cancelAll() |
What Esc does on a board: drops the dangling wire, the eraser and the selection.
void clickAt(real x, real y, int mods) |
void dragFrom(real x1, real y1, real x2, real y2, int mods) |
bool granted(var hit) |
Whether a running flow lets the learner touch what hit found.
Everything, with no flow running. With one: only a part the current task named, and only as a part - a pad or a wire is the circuit the lesson is teaching, and rewiring it mid-sentence is the thing this exists to stop.
void moveAt(real mx, real my, int mods, bool isDown) |
void pressAt(real mx, real my, int button, int mods) |
void releaseAt() |
var worldAt(real mx, real my) |