lineupLabels関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The labels and rings for a picture: the biggest bodies first, each with as much as fits, a label dropped when it would cover one already placed, and a ring round a body too small to see. A body outside the picture has none.
インポート
import { lineupLabels } from "@johnmorrisdotca/wakusei-planets";
定義
function lineupLabels(dots: readonly LineupDot[], width: number, height: number, lang: LineupLang, options?: { font?: number; keep?: string; }): { labels: LineupLabel[]; rings: { id: string; cx: number; cy: number; r: number; }[]; }
引数
| 名前 | 型 | 説明 |
|---|---|---|
dots | readonly LineupDot[] | The bodies on the picture ( |
width | number | The picture's width in pixels. |
height | number | The picture's height in pixels. |
lang | LineupLang |
|
options (省略可) | { font?: number; keep?: string; } |
|
戻り値
{ labels: LineupLabel[]; rings: { id: string; cx: number; cy: number; r: number; }[]; }
The labels and the rings (rings: a centre and a radius for each body under 6 pixels across).
例
import { lineupBodies, lineupLabels, lineupProject, lineupView, placeLineup } from "@johnmorrisdotca/wakusei-planets";
const places = placeLineup(lineupBodies({ planets: true }), "row");
const plan = lineupLabels(lineupProject(places, lineupView(places, 0.05), 800, 450), 800, 450, "en");
console.log(plan.labels.length, plan.rings.length);2 0出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。