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

Function getZoomedPosition

source/position.js:104–115  ·  view source on GitHub ↗
(position, zoom, origin)

Source from the content-addressed store, hash-verified

102};
103
104export const getZoomedPosition = (position, zoom, origin) => {
105 const [x, y] = position;
106 const [ox, oy] = origin;
107 const originedPosition = [x - ox, y - oy];
108
109 const zoomedPosition = originedPosition.map((axis) => axis * zoom);
110
111 const [zx, zy] = zoomedPosition;
112 const movedPosition = [zx + ox, zy + oy];
113
114 return movedPosition;
115};
116
117export const getZoomedPositions = (positions, zoom, origin) => {
118 const zoomedPositions = positions.map((position) =>

Callers 1

getZoomedPositionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected