MCPcopy Create free account
hub / github.com/TodePond/ScreenPond / getMappedPosition

Function getMappedPosition

source/position.js:56–60  ·  view source on GitHub ↗
(position, corners, safe = true)

Source from the content-addressed store, hash-verified

54// Corners... of a deeper screen
55// Return: If we treat the deeper screen as the co-ordinates, where should we place the position?
56export const getMappedPosition = (position, corners, safe = true) => {
57 const mappedPosition = ibilerp(position, corners);
58 if (!safe) return mappedPosition;
59 return mappedPosition.map((axis) => (isNaN(axis) ? 0 : axis));
60};
61
62export const getMappedPositions = (positions, corners) => {
63 const mappedPositions = positions.map((position) =>

Callers 6

pickInScreenFunction · 0.90
hand.jsFile · 0.90
getMousePositionFunction · 0.85
getMappedPositionsFunction · 0.85
isPositionInCornersFunction · 0.85
getScaledPositionFunction · 0.85

Calls 1

ibilerpFunction · 0.90

Tested by

no test coverage detected