Reference · Cube engine and views
mountGuidefunction
A guide drawn in an element, for the cube in view: the view shows the
hint, and a person makes each movement on it. The view must let a person
turn it (interactive).
Import it
import { mountGuide } from "@johnmorrisdotca/kyuubu";
Definition
function mountGuide(host: HTMLElement, view: CubeView, options: GuidePanelOptions): GuideHandle
Parameters
| Name | Type | Description |
|---|---|---|
host | HTMLElement | The DOM element that receives the view and controls. |
view | CubeView | The view matrix, or mounted CubeView for a guide. |
options | GuidePanelOptions | Options for this call; omitted fields retain their documented defaults. |
Returns
GuideHandle
A guide drawn in an element, for the cube in view: the view shows the hint, and a person makes each movement on it. The view must let a person turn it (interactive).
Examples
import { CubeView, mountGuide } from "@johnmorrisdotca/kyuubu";
const host = document.createElement("div");
const panel = document.createElement("div");
host.style.cssText = "width:300px;height:300px;position:relative";
document.body.append(host, panel);
const cube = new CubeView(host, { size: 3, interactive: true });
const guide = mountGuide(panel, cube, { moves: "R U R' U'" });
console.log(guide.guide.next?.text);
// Call guide.destroy() and cube.destroy() when removing them.