edgeNudge関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
How far to move a zoomed view in a frame, for a finger at (x, y) in a box: toward the edge it is near, or not at all.
インポート
import { edgeNudge } from "@johnmorrisdotca/tsunagi/play";
定義
function edgeNudge(x: number, y: number, box: { left: number; top: number; right: number; bottom: number; }): { dx: number; dy: number; }
引数
| 名前 | 型 | 説明 |
|---|---|---|
x | number | The horizontal point, edge-code or coordinate value specified by this signature. |
y | number | The vertical point, edge-code or coordinate value specified by this signature. |
box | { left: number; top: number; right: number; bottom: number; } | The available square view size or edge bounds. |
戻り値
{ dx: number; dy: number; }
How far to move a zoomed view in a frame, for a finger at (x, y) in a box: toward the edge it is near, or not at all.
例
import { edgeNudge } from "@johnmorrisdotca/tsunagi/play";
console.log(edgeNudge(5,100,{left:0,top:0,right:640,bottom:480}));{ dx: 6, dy: 0 }出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。