readCuboidKeyfunction
What a key means on a cuboid, given the depth a digit before it set (1 where
none did): the cube's keys (readKey) without the turns of the whole cube.
On a layer that only half turns, the key turns it a half, whichever way
Shift says, because that is the only turn it has.
Import it
import { readCuboidKey } from "@johnmorrisdotca/kyuubu/cuboid";
Definition
function readCuboidKey(key: string, shift: boolean, dims: CuboidDims, depth: number): CuboidKeyReading
Parameters
| Name | Type | Description |
|---|---|---|
key | string | The pressed key, or the cuboid preset key for a lookup. |
shift | boolean | Whether Shift reverses the key’s turn. |
dims | CuboidDims | The cuboid’s x, y and z dimensions, in that order. |
depth | number | The layer depth counted from the named face, starting at 1. |
Returns
CuboidKeyReading
What a key means on a cuboid, given the depth a digit before it set (1 where none did): the cube's keys (readKey) without the turns of the whole cube. On a layer that only half turns, the key turns it a half, whichever way Shift says, because that is the only turn it has.
Examples
import { readCuboidKey } from "@johnmorrisdotca/kyuubu/cuboid";
const dims = [2, 3, 3] as const;
console.log(readCuboidKey("u", false, dims, 1));{ move: { axis: 1, layer: 2, turns: 2 } }What it prints (run when this page was built)