logigate/app/components/editor/Help.vue

80 lines
4.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script setup lang="ts">
const ed = useEditor()
const SHORTCUTS: [string, string][] = [
['Click switch', 'Flip an input between 0 and 1 (give it a keyboard key in its settings)'],
['Click anything', 'Its settings appear on the right: 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 tab (right)', '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'],
['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)'],
['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 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'],
['Select wires, Ctrl+G', 'Bundle them into one cable; an end whose wires all meet one part plugs straight into it'],
['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'],
['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'],
['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> on the left, 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> 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>