リファレンス
SVGの盤
import { … } from "@johnmorrisdotca/suido/draw";
最小化と gzip 圧縮をしたサイズは 7.2 kB(読み込むものをすべて含み、esbuild で計測)
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Suido's drawing: SVG text for a board and a piece, the style that turns the
drawing into flowing water, and the function that paints a board in play.
A separate entry (@johnmorrisdotca/suido/draw), so a server that only
checks an answer never loads any of it.
エクスポート
| 名前 | 種類 | 概要 |
|---|---|---|
ArmState | 型 | What the water does at one opening of a piece. |
attachSuidoView | 関数 | Lets the box box move and zoom the board drawn in svg (which must have a viewBox of the whole board). |
boxOf | 関数 | The size of a board in the drawing's units. |
CellState | 型 | How one cell is to look. |
cellStates | 関数 | The state of every piece of a board whose pieces face as masks say. |
clampView | 関数 | A view kept inside the board, never further in than most and never showing past an edge. |
drawGuidePiece | 関数 | A piece of the guide (SUIDO_PIECE_GUIDE) as SVG text: its tiny board drawn by drawSuido, with the water in it where the guide says the picture has some, and the piece's name as its description for a screen reader. |
DrawOptions | 型 | What to draw with. |
drawPiece | 関数 | One piece on its own, as SVG text: for a legend, an icon, or a page that shows how the pieces look. |
drawSuido | 関数 | A board as SVG text. |
drawSuidoThumb | 関数 | A board as a small picture, in a few dozen elements however big the board is: for a page that shows a whole block of levels at once. |
needsZoom | 関数 | 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. |
paintSuido | 関数 | Update the existing board SVG with current facings and water, returning its flow state. |
panView | 関数 | A view moved by (dx, dy) in the drawing's units. |
stepFor | 関数 | The milliseconds the water takes through one cell, so that the deepest cell is reached in FILL_MS at most. |
SUIDO_FIT | 定数 | The whole board. |
SUIDO_MOST_ZOOM | 定数 | The furthest in a view goes: this many times the whole board. |
SUIDO_STYLE | 定数 | THE STYLE a Suido board is drawn with: colours as custom properties, the water's flow as transitions, and the one rule that matters for a game played with fingers: nothing on the board can be selected, dragged or double-tapped. |
SuidoBox | 型 | A board's size in the drawing's units: a hundred across a cell. |
SuidoView | 型 | The part of a board shown: how far in (1 is the whole board), and where its top left corner is, in the drawing's units. |
SuidoViewer | 型 | What attachSuidoView hands back. |
SuidoViewerOptions | 型 | What a viewer may be asked for. |
viewBoxOf | 関数 | The viewBox that shows a view. |
viewShowing | 関数 | The view moved the least that shows the whole of a cell (a margin of half a cell round it where there is room), and no further in than it was. |
zoomAbout | 関数 | A view zoomed by factor about the point (ax, ay) of the board, which stays under the same place in the box. |
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。