edgeNudgefunction
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 it
import { edgeNudge } from "@johnmorrisdotca/tsunagi/play";
Definition
function edgeNudge(x: number, y: number, box: { left: number; top: number; right: number; bottom: number; }): { dx: number; dy: number; }
Parameters
| Name | Type | Description |
|---|---|---|
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. |
Returns
{ 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.
Examples
import { edgeNudge } from "@johnmorrisdotca/tsunagi/play";
console.log(edgeNudge(5,100,{left:0,top:0,right:640,bottom:480}));{ dx: 6, dy: 0 }What it prints (run when this page was built)