Reference · Rules, tiles and records
edgePanfunction
Which way, and how far, the table pans this frame for a tile dragged to (px, py): toward the edge it is near.
Import it
import { edgePan } from "@johnmorrisdotca/kumimoji";
Definition
function edgePan(px: number, py: number, width: number, height: number): { dx: number; dy: number; }
Parameters
| Name | Type | Description |
|---|---|---|
px | number | The horizontal pointer position in pixels. |
py | number | The vertical pointer position in pixels. |
width | number | The available viewport width in pixels. |
height | number | The available viewport height in pixels. |
Returns
{ dx: number; dy: number; }
Which way, and how far, the table pans this frame for a tile dragged to (px, py): toward the edge it is near.
Examples
import { edgePan } from "@johnmorrisdotca/kumimoji";
console.log(edgePan(5,240,640,480));{ dx: 6.888888888888889, dy: 0 }What it prints (run when this page was built)