Let a gesture name the manual section that shows it
The help sheet says which move does a thing, and the manual has a picture of the thing being done, but nothing joined the two: a user reading "Pinch it with two fingers" had no way from there to the GIF of it. A GESTURE tag takes an optional `manual:` field naming a heading of docs/manual/README.md by its anchor. The scan checks every one against the anchors the bundled page is rendered with and fails when the manual has no such heading, so renaming a section cannot leave the sheet linking to the top of the page; gestures-check carries the same failure into CI. The anchor goes into gesture_book.rs as a new field, and into docs/gestures.md as a "See it" link to manual/README.md#anchor. The help sheet draws a "See it" button beside the title of each gesture that has one, which opens the bundled manual at that section. The field is additive: a tag without it is unchanged, and no gesture carries one yet.
This commit is contained in:
@@ -38,6 +38,10 @@ export struct GestureRow {
|
||||
touch: string,
|
||||
pointer: string,
|
||||
keys: string,
|
||||
// The manual section that shows the gesture being made, as a heading
|
||||
// anchor; empty where the manual has none. Checked against the manual by
|
||||
// the generator, so a non-empty one always lands on a heading.
|
||||
manual: string,
|
||||
}
|
||||
|
||||
// One route: how a modality performs the gesture.
|
||||
@@ -148,12 +152,28 @@ export component GestureSheet inherits Rectangle {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
if r.heading == "": Text {
|
||||
text: r.title;
|
||||
color: Theme.ink;
|
||||
font-size: Theme.text;
|
||||
font-weight: 600;
|
||||
wrap: word-wrap;
|
||||
// The title, and beside it "See it" where the manual
|
||||
// shows the gesture. On the title's line rather than
|
||||
// under the routes, so it is found while reading the
|
||||
// title — the moment of "what does that look like?".
|
||||
if r.heading == "": HorizontalLayout {
|
||||
spacing: Theme.gap;
|
||||
|
||||
Text {
|
||||
text: r.title;
|
||||
color: Theme.ink;
|
||||
font-size: Theme.text;
|
||||
font-weight: 600;
|
||||
wrap: word-wrap;
|
||||
horizontal-stretch: 1;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
|
||||
if r.manual != "": Button {
|
||||
text: "See it";
|
||||
accessible-label: "See " + r.title + " in the manual";
|
||||
clicked => { root.open-manual(r.manual); }
|
||||
}
|
||||
}
|
||||
|
||||
if r.touch != "": Route {
|
||||
|
||||
Reference in New Issue
Block a user