Skip to the content

Meikyuu迷宮

Generate seeded mazes and arrow puzzles, follow numbered levels, and play on flat grids or three-dimensional surfaces.

Meikyuu is the Japanese word 迷宮 for labyrinth. About the name

Contents

Reference · Playable boards

visibleAreafunction

The part of the board the view shows.

Import it

import { visibleArea } from "@johnmorrisdotca/meikyuu/play";

Definition

function visibleArea(view: View, box: ViewBox): Box

Parameters

NameTypeDescription
viewView

The current pan and scale.

boxViewBox

The viewport dimensions and logical board bounds, or board bounds specified by the signature.

Returns

Box

The part of the board the view shows.

Examples

import type { MazeRecipe } from "@johnmorrisdotca/meikyuu";
import { buildMaze } from "@johnmorrisdotca/meikyuu";
import { fitView, visibleArea } from "@johnmorrisdotca/meikyuu/play";

const recipe: MazeRecipe = {shape:"square",w:5,h:5,algorithm:"backtracker",mode:"to-goal",seed:42};
const maze = buildMaze(recipe);
const grid = maze.grid;
const box = {width:390,height:844,area:grid.box};
const view = fitView(box);
console.log(visibleArea(view,box));
{
  x: -0.6000000000000001,
  y: -4.20871794871795,
  w: 6.2,
  h: 13.4174358974359
}

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/meikyuu 3.2.0.