insetTransform関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What to do to a region's own geometry to seat it in its box: shrink it to fit if it is too big, centre it in the frame, and leave it at its own size unless the box says it may be magnified.
インポート
import { insetTransform } from "@johnmorrisdotca/chizu";
定義
function insetTransform(bbox: readonly [number, number, number, number], box: MapBox, magnify?: boolean): InsetTransform
引数
| 名前 | 型 | 説明 |
|---|---|---|
bbox | readonly [number, number, number, number] | The native left, top, right and bottom bounds of the geometry. |
box | MapBox | The window in native map units, or the inset destination specified by this signature. |
magnify (省略可) | boolean | Whether the inset may enlarge its geometry instead of only shrinking it. |
戻り値
InsetTransform
What to do to a region's own geometry to seat it in its box: shrink it to fit if it is too big, centre it in the frame, and leave it at its own size unless the box says it may be magnified.
例
import { insetTransform } from "@johnmorrisdotca/chizu";
// A region 400 wide seated in a box 200 wide is halved and centred.
console.log(insetTransform([0, 0, 400, 100], { x: 10, y: 10, width: 200, height: 100 }));
// { scale: 0.5, x: 10, y: 35 }{ scale: 0.5, x: 10, y: 35 }出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。