needsZoomfunction
Whether the pieces of a board across a box boxPx wide are smaller than a thumb is comfortable with, so that a board offers to be zoomed.
Import it
import { needsZoom } from "@johnmorrisdotca/suido/draw";
Definition
function needsZoom(layout: { width: number; }, boxPx: number, smallest?: number): boolean
Parameters
| Name | Type | Description |
|---|---|---|
layout | { width: number; } | The decoded board with its dimensions, pipe masks and rule settings. |
boxPx | number | The available viewport width in pixels. |
smallest (optional) | number | The minimum desirable cell width in pixels. |
Returns
boolean
Whether the pieces of a board across a box boxPx wide are smaller than a thumb is comfortable with, so that a board offers to be zoomed.
Examples
import { SUIDO_5X5 } from "@johnmorrisdotca/suido/levels-5x5";
import { decodeLayout } from "@johnmorrisdotca/suido";
import { needsZoom } from "@johnmorrisdotca/suido/draw";
const row = SUIDO_5X5[0];
const code = row[0];
const layout = decodeLayout(code)!;
console.log(needsZoom(layout,390));falseWhat it prints (run when this page was built)