edgeNudge関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
How far to move the view in a frame for a finger at (px, py) of a box: the board moves the other way, toward the finger. It is gentle: nothing
at EDGE pixels from a side, rising in a line to EDGE_STEP pixels a frame at the side itself, so a finger that only brushes the edge
of the box moves the view hardly at all, and one held at the very edge moves it steadily.
インポート
import { edgeNudge } from "@johnmorrisdotca/meikyuu/play";
定義
function edgeNudge(px: number, py: number, width: number, height: number): { dx: number; dy: number; }
引数
| 名前 | 型 | 説明 |
|---|---|---|
px | number | The horizontal pointer position in viewport pixels. |
py | number | The vertical pointer position in viewport pixels. |
width | number | The native width in cells or pixels specified by this signature. |
height | number | The native height in cells or pixels specified by this signature. |
戻り値
{ dx: number; dy: number; }
How far to move the view in a frame for a finger at (px, py) of a box: the board moves the other way, toward the finger. It is gentle: nothing at EDGE pixels from a side, rising in a line to EDGE_STEP pixels a frame at the side itself, so a finger that only brushes the edge of the box moves the view hardly at all, and one held at the very edge moves it steadily.
例
import { edgeNudge } from "@johnmorrisdotca/meikyuu/play";
console.log(edgeNudge(5,100,390,844));{ dx: 6.204545454545454, dy: 0 }出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。