scaleBar関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A scale bar for a sheet: a round length in metres that fits maxPixels at the scale pixelsPerMetre, with ticks, and the ratio when the sheet is dpi dots to an inch.
インポート
import { scaleBar } from "@johnmorrisdotca/uchusen-rockets";
定義
function scaleBar(pixelsPerMetre: number, maxPixels: number, dpi?: number): ScaleBar
引数
| 名前 | 型 | 説明 |
|---|---|---|
pixelsPerMetre | number | The sheet's scale. |
maxPixels | number | The longest bar the sheet has room for. |
dpi (省略可) | number | The sheet's dots to the inch, for the ratio (default 96). |
戻り値
ScaleBar
The bar: its metres, its pixels, its ticks and the ratio as text.
例
import { scaleBar } from "@johnmorrisdotca/uchusen-rockets";
const bar = scaleBar(2, 300);
console.log(bar.metres, bar.pixels, bar.ticks.length, bar.ratio);100 200 6 1:1890出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。