Reference · Cube engine and views
DragHinttype
What to drag to make a turn of one layer, or of several about one axis as one (a wide turn).
Import it
import type { DragHint } from "@johnmorrisdotca/kyuubu";
Definition
type DragHint = {
axis: CubeAxis;
layers: number[];
turns: CubeTurns;
seam: boolean;
slots: number[];
face: CubeFace | null;
grab: number | null;
drag: [
number,
number
] | null;
quarters: 1 | -1 | 2;
atOnce: boolean;
arrow: HintArrow | null;
};
Members
| Name | Type | Description |
|---|---|---|
axis | CubeAxis | The turn's axis. |
layers | number[] | The layers that turn, counted from the axis's negative side. |
turns | CubeTurns | How far, by the right-hand rule. |
seam | boolean | Whether the turn is of two neighbouring layers on a cube of 3 or more: one drag that begins on the seam between them, at the tail of the arrow, or two fingers at once, turns both together. |
slots | number[] | Every sticker those layers carry, as indexes into the state: the stickers to light. |
face | "U" | "R" | "F" | "D" | "L" | "B" | null | The face the arrow lies on, or null where no side of the layer can be seen well enough from here: look round the cube first. |
grab | number | null | The sticker to take hold of, at the arrow's tail, in the first of the layers; null with |
drag | [number, number] | null | The way to drag across the screen (x right, y down), as a unit vector; null with |
quarters | 1 | -1 | 2 | What a drag along the arrow makes, as |
atOnce | boolean | Whether the layer is picked as soon as the drag begins ( |
arrow | HintArrow | null | The arrow to draw; null with |
Examples
import type { DragHint } from "@johnmorrisdotca/kyuubu";
import { dragHint, parseMove, viewMatrix } from "@johnmorrisdotca/kyuubu";
const value: DragHint = dragHint(parseMove("R", 3)!, 3, viewMatrix(-30, -20))!;
console.log(value.layers);[ 2 ]What it prints (run when this page was built)