logigate/app/components/editor/Help.vue

115 lines
9.2 KiB
Vue
Raw Normal View History

<script setup lang="ts">
const ed = useEditor()
const SHORTCUTS: [string, string][] = [
['Esc (nothing selected)', 'Pause menu: save, save as copy, load, settings, main menu'],
['Click switch', 'Flip an input between 0 and 1 (give it a keyboard key in its settings)'],
['Click anything', 'A panel on the right shows its settings and what you can do with it: swap the part, clock speed, colours, keys, position'],
['Select several', 'Change them all at once: swap, rename D0, D1, …, switch all to 0 or 1, line up'],
['Pins (panel on the left)', 'Every input and output in one list: rename them one after another with Enter'],
['Drag from a pin', 'Draw a wire to another pin; dropping it on a part uses that part’s next free pin'],
['Click a pin, then another', 'The same without holding the mouse button'],
['Shift + click (or let go) on a pin while wiring', 'Connects it and keeps wiring from the same signal: click more pins, Esc stops'],
['Select parts, then W', 'Connect one by one: click where each of their pins goes, in order (Shift+W: their inputs)'],
['Drag a wire segment', 'Move that segment; drag a corner square to move a bend'],
['Alt + drag a wire', 'Pull a new bend out of it'],
['Ctrl + drag a wire', 'Start a new wire from the same signal'],
['Double-click a wire', 'Select the whole signal'],
['Shift + click', 'Add parts or wires to the selection'],
['Arrow keys', 'Move the selection one step (Shift: four)'],
['Drag several parts', 'Wires between them keep their shape; a wire to a part that stays keeps its bends while they stay clear of parts and other wires'],
['Double-click a component', 'Open it and see inside'],
['Drag on empty space', 'Select parts; across wires (no parts in the box) it selects every wire it crosses'],
['Drag right to left', 'Select everything the box touches, parts and wires (green box)'],
['Right click (or the menu key)', 'Everything you can do with what is under the pointer or selected; on empty space: paste, add a part here'],
['Right or middle drag, Space + drag', 'Move the view'],
['Mouse wheel', 'Zoom'],
['N, I, O, L, B, C, H, T, P, X', 'Place NAND, input, output, lamp, button, clock, hex display, note, input panel, pixel'],
['Bar at the bottom', 'Point at a kind of part to see them all; click to place, drag onto the canvas, pin the ones you use most to the bar itself (right-click a pinned part to unpin it)'],
['Mouse back / forward buttons, Alt + ← →', 'Back and forward through the circuits you went into and out of, like pages in the browser (the browser\'s own buttons do the same)'],
['Main (top bar)','Back to the main circuit; the names after it lead back to each component you entered (on a narrow bar the ones in between fold into …)'],
['Power off and on (circuit name in the top bar, or Space)', 'Latches, flip-flops and memory keep their bits when you go into a component and back, and in the saved project; this starts the circuit again from all zeros'],
['⋯ (top bar, small window)', 'Sound, settings, help and whatever else no longer fits in the bar'],
['[', 'Hide or show the panel on the left (This and Pins)'],
['Library (bottom bar: Components, or Space)', 'Components everyone published: search, add one to this project (what it uses comes along; not in a campaign) and place it. Publish your own, or a new version, from the menu on the circuit’s name'],
['Connectors (bottom bar)', 'Make a cable type of your own (HDMI, RJ45): its lines; place its Out and In ports; one cable joins them'],
['Split into lines (right-click a component)', 'A pin per line below a port\'s socket, to wire lines by hand; dropping a wire on the socket does the same. Join lines takes them away'],
['Select wires, Ctrl+G', 'Bundle them into one cable; an end whose wires all meet one part plugs straight into it'],
['Select a component, cable button beside its pins', 'A plug on S0–S3 (or any group); drag the cable out of its pin and let go where it goes, or on the next part\'s pins'],
['Point at a part', 'Its round buttons show, as if it were selected: cable plugs, split ports, plug in or out'],
['Drag a box around some pins of a part, or Shift + click pins', 'Picks exactly those pins: a cable plug on them, wire them one by one, invert or unwire them (buttons beside them, or right-click)'],
['Right-click a pin', 'What can be done right there: split a cable socket into wires, pull a cable out, invert an input'],
['Drag a docked panel up or down', 'It lets go of its component and stays a panel of its own; sideways it stays docked'],
['Round buttons beside the selection', 'Split a port into wires (or join them), pull a cable out of a plug, plug in or out, split a cable into wires, bundle selected wires'],
['Drag a part from the list onto pins', 'It lands on them and connects (green rings show where); Alt just places it'],
['Drag a part onto the pins it is wired to', 'When its pins line up with theirs one for one, it latches on (green rings): pins touching, no wires, and it moves with that part. Right-click: Latch onto / Unlatch'],
['Drag a plugged cable end away', 'Pull it out; drop its pins on a part\'s pins to plug it in again'],
['Drag a part onto a pin', 'Connects there when dropped (a green ring shows where); hold Alt to just place it'],
['Drag a wire by its end', 'Moves that end to another pin (grab it near the pin, or by the small circle)'],
['Drop a wire on a wire', 'From an input: it taps that wire\'s signal. From an output: it feeds what that wire fed'],
['Alt + click an input pin', 'Inverts it (a bubble); counted honestly as one NAND'],
['Send signal / Use signal', 'Name a signal (CLK, RESET) once and use it anywhere in the circuit without a wire'],
['Ctrl+F', 'Find a part, signal or component in every circuit, and where a component is used'],
['Space (tap)', 'Search at the mouse: recent parts and actions like a new component; type a few letters, arrows to choose, Enter to take it'],
['Shift+Enter in the search', 'Open the chosen component to edit it instead of placing it (or click its pencil); typing any circuit\'s name also offers "Open …"'],
['/, Shift+A or Ctrl+K', 'The same search box'],
['Ctrl+P', 'Print the circuit as a sheet with a title block, or save it as PDF'],
['Select switches or buttons, Combine', 'One input panel (all rows can become buttons); lamps or output pins combine into an output panel'],
['Select panels, Merge', 'One panel with all their rows; inside a component input panel rows are inputs, output panel rows outputs'],
['Design the box (This, As a component)', 'Move lamps, displays and the name on a component\'s box, draw lines, boxes, circles and text'],
['Select several lamps, pins or switches', 'Green boxes show free pins in a row they fit; point along one, click to wire them all'],
['Shift + click on canvas', 'Keep placing the same part'],
['Ctrl+C, Ctrl+V, Ctrl+D', 'Copy, paste, duplicate; names continue their series (D0 → D1)'],
['Delete', 'Remove the selection'],
['Ctrl+Z, Ctrl+Shift+Z', 'Undo, redo'],
['Logo (top left), Esc', 'Pause menu: save, load, settings, back to the main menu. Your work is saved'],
['Tidy this circuit / every circuit', 'In the Circuit panel (Tools) or with Space: hand-placed bends go, every wire is laid out anew around the parts. Ctrl+Z undoes it'],
['F', 'Fit the circuit to the screen'],
['Enter', 'Open the selected component'],
]
function close() {
ed.showHelp.value = false
try {
localStorage.setItem('logigate:help-seen', '1')
} catch {}
}
</script>
<template>
<div class="modal-backdrop" @click.self="close">
<div class="modal" role="dialog" aria-labelledby="help-title">
<div class="flex items-start justify-between gap-4">
<h2 id="help-title">From one NAND gate to a computer</h2>
<button class="tb-btn" title="Close" @click="close"><Icon name="lucide:x" class="size-4" /></button>
</div>
<ol class="steps">
<li>
<strong>NAND is the only gate.</strong> Its output is 0 only when both inputs are 1. Everything else (NOT, AND, OR, adders, memory) can be built from it.
</li>
<li>
<strong>Every circuit is a component.</strong> Inputs and outputs you place inside a circuit become its pins. Place it in another circuit and it shows up as one block; double-click to look inside.
</li>
<li>
<strong>It runs while you draw.</strong> Green wires carry a 1, grey wires a 0. Flip switches, press buttons, or start the clock in the top bar.
</li>
<li>
<strong>Try the challenges</strong> (top bar), or open the examples (NOT up to a 4-bit counter) to see how each step is made of the previous one.
</li>
<li>
<strong>Select parts and press "Make component"</strong> in the panel on the right to turn a piece of your drawing into a reusable block.
</li>
</ol>
<h3>Controls</h3>
<dl class="shortcuts">
<template v-for="[k, v] in SHORTCUTS" :key="k">
<dt>{{ k }}</dt>
<dd>{{ v }}</dd>
</template>
</dl>
<p class="hint">Your work is saved in this browser. Sign in (top right) to have it on every computer; use Share to get a link or export a file.</p>
<button class="btn btn-primary mt-4" @click="close">Start building</button>
</div>
</div>
</template>