edgeNudgefunction
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 it
import { edgeNudge } from "@johnmorrisdotca/meikyuu/play";
Definition
function edgeNudge(px: number, py: number, width: number, height: number): { dx: number; dy: number; }
Parameters
| Name | Type | Description |
|---|---|---|
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. |
Returns
{ 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.
Examples
import { edgeNudge } from "@johnmorrisdotca/meikyuu/play";
console.log(edgeNudge(5,100,390,844));{ dx: 6.204545454545454, dy: 0 }What it prints (run when this page was built)